summaryrefslogtreecommitdiff
path: root/llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp')
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp24
1 files changed, 10 insertions, 14 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp b/llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp
index 0e4c26170a8f..dafbeaeaec52 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp
@@ -9,7 +9,7 @@
/// \file
/// \brief This pass propagates attributes from kernels to the non-entry
/// functions. Most of the library functions were not compiled for specific ABI,
-/// yet will be correctly compiled if proper attrbutes are propagated from the
+/// yet will be correctly compiled if proper attributes are propagated from the
/// caller.
///
/// The pass analyzes call graph and propagates ABI target features through the
@@ -17,7 +17,7 @@
///
/// It can run in two modes: as a function or module pass. A function pass
/// simply propagates attributes. A module pass clones functions if there are
-/// callers with different ABI. If a function is clonned all call sites will
+/// callers with different ABI. If a function is cloned all call sites will
/// be updated to use a correct clone.
///
/// A function pass is limited in functionality but can run early in the
@@ -55,10 +55,7 @@ static constexpr const FeatureBitset TargetFeatures = {
// Attributes to propagate.
// TODO: Support conservative min/max merging instead of cloning.
-static constexpr const char* AttributeNames[] = {
- "amdgpu-waves-per-eu",
- "amdgpu-flat-work-group-size"
-};
+static constexpr const char *AttributeNames[] = {"amdgpu-waves-per-eu"};
static constexpr unsigned NumAttr =
sizeof(AttributeNames) / sizeof(AttributeNames[0]);
@@ -149,7 +146,7 @@ public:
bool process(Module &M);
};
-// Allows to propagate attributes early, but no clonning is allowed as it must
+// Allows to propagate attributes early, but no cloning is allowed as it must
// be a function pass to run before any optimizations.
// TODO: We shall only need a one instance of module pass, but that needs to be
// in the linker pipeline which is currently not possible.
@@ -168,7 +165,7 @@ public:
bool runOnFunction(Function &F) override;
};
-// Allows to propagate attributes with clonning but does that late in the
+// Allows to propagate attributes with cloning but does that late in the
// pipeline.
class AMDGPUPropagateAttributesLate : public ModulePass {
const TargetMachine *TM;
@@ -212,10 +209,10 @@ AMDGPUPropagateAttributes::findFunction(const FnProperties &PropsNeeded,
bool AMDGPUPropagateAttributes::process(Module &M) {
for (auto &F : M.functions())
- if (AMDGPU::isEntryFunctionCC(F.getCallingConv()))
+ if (AMDGPU::isKernel(F.getCallingConv()))
Roots.insert(&F);
- return process();
+ return Roots.empty() ? false : process();
}
bool AMDGPUPropagateAttributes::process(Function &F) {
@@ -228,8 +225,7 @@ bool AMDGPUPropagateAttributes::process() {
SmallSet<Function *, 32> NewRoots;
SmallSet<Function *, 32> Replaced;
- if (Roots.empty())
- return false;
+ assert(!Roots.empty());
Module &M = *(*Roots.begin())->getParent();
do {
@@ -273,7 +269,7 @@ bool AMDGPUPropagateAttributes::process() {
if (!NewF) {
const FnProperties NewProps = CalleeProps.adjustToCaller(CallerProps);
if (!AllowClone) {
- // This may set different features on different iteartions if
+ // This may set different features on different iterations if
// there is a contradiction in callers' attributes. In this case
// we rely on a second pass running on Module, which is allowed
// to clone.
@@ -383,7 +379,7 @@ bool AMDGPUPropagateAttributesEarly::runOnFunction(Function &F) {
TM = &TPC->getTM<TargetMachine>();
}
- if (!AMDGPU::isEntryFunctionCC(F.getCallingConv()))
+ if (!AMDGPU::isKernel(F.getCallingConv()))
return false;
return AMDGPUPropagateAttributes(TM, false).process(F);