[llvm] f121742 - AMDGPU: Rename attributor class for uniform-work-group-size
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 14 17:03:29 PDT 2021
Author: Matt Arsenault
Date: 2021-09-14T19:49:08-04:00
New Revision: f12174204c639f9780f17cf7b8e910be703b6b8c
URL: https://github.com/llvm/llvm-project/commit/f12174204c639f9780f17cf7b8e910be703b6b8c
DIFF: https://github.com/llvm/llvm-project/commit/f12174204c639f9780f17cf7b8e910be703b6b8c.diff
LOG: AMDGPU: Rename attributor class for uniform-work-group-size
This isn't really an AMDGPU specific attribute and could be moved to
generic code. It's also important to include the word uniform in the
name.
Added:
Modified:
llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
index ce776b44b0eeb..284e49b55ed62 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
@@ -214,17 +214,19 @@ struct AAAMDAttributes : public StateWrapper<
};
const char AAAMDAttributes::ID = 0;
-struct AAAMDWorkGroupSize
+struct AAUniformWorkGroupSize
: public StateWrapper<BooleanState, AbstractAttribute> {
using Base = StateWrapper<BooleanState, AbstractAttribute>;
- AAAMDWorkGroupSize(const IRPosition &IRP, Attributor &A) : Base(IRP) {}
+ AAUniformWorkGroupSize(const IRPosition &IRP, Attributor &A) : Base(IRP) {}
/// Create an abstract attribute view for the position \p IRP.
- static AAAMDWorkGroupSize &createForPosition(const IRPosition &IRP,
- Attributor &A);
+ static AAUniformWorkGroupSize &createForPosition(const IRPosition &IRP,
+ Attributor &A);
/// See AbstractAttribute::getName().
- const std::string getName() const override { return "AAAMDWorkGroupSize"; }
+ const std::string getName() const override {
+ return "AAUniformWorkGroupSize";
+ }
/// See AbstractAttribute::getIdAddr().
const char *getIdAddr() const override { return &ID; }
@@ -238,11 +240,11 @@ struct AAAMDWorkGroupSize
/// Unique ID (due to the unique address)
static const char ID;
};
-const char AAAMDWorkGroupSize::ID = 0;
+const char AAUniformWorkGroupSize::ID = 0;
-struct AAAMDWorkGroupSizeFunction : public AAAMDWorkGroupSize {
- AAAMDWorkGroupSizeFunction(const IRPosition &IRP, Attributor &A)
- : AAAMDWorkGroupSize(IRP, A) {}
+struct AAUniformWorkGroupSizeFunction : public AAUniformWorkGroupSize {
+ AAUniformWorkGroupSizeFunction(const IRPosition &IRP, Attributor &A)
+ : AAUniformWorkGroupSize(IRP, A) {}
void initialize(Attributor &A) override {
Function *F = getAssociatedFunction();
@@ -268,10 +270,10 @@ struct AAAMDWorkGroupSizeFunction : public AAAMDWorkGroupSize {
auto CheckCallSite = [&](AbstractCallSite CS) {
Function *Caller = CS.getInstruction()->getFunction();
- LLVM_DEBUG(dbgs() << "[AAAMDWorkGroupSize] Call " << Caller->getName()
+ LLVM_DEBUG(dbgs() << "[AAUniformWorkGroupSize] Call " << Caller->getName()
<< "->" << getAssociatedFunction()->getName() << "\n");
- const auto &CallerInfo = A.getAAFor<AAAMDWorkGroupSize>(
+ const auto &CallerInfo = A.getAAFor<AAUniformWorkGroupSize>(
*this, IRPosition::function(*Caller), DepClassTy::REQUIRED);
Change = Change | clampStateAndIndicateChange(this->getState(),
@@ -310,11 +312,13 @@ struct AAAMDWorkGroupSizeFunction : public AAAMDWorkGroupSize {
void trackStatistics() const override {}
};
-AAAMDWorkGroupSize &AAAMDWorkGroupSize::createForPosition(const IRPosition &IRP,
- Attributor &A) {
+AAUniformWorkGroupSize &
+AAUniformWorkGroupSize::createForPosition(const IRPosition &IRP,
+ Attributor &A) {
if (IRP.getPositionKind() == IRPosition::IRP_FUNCTION)
- return *new (A.Allocator) AAAMDWorkGroupSizeFunction(IRP, A);
- llvm_unreachable("AAAMDWorkGroupSize is only valid for function position");
+ return *new (A.Allocator) AAUniformWorkGroupSizeFunction(IRP, A);
+ llvm_unreachable(
+ "AAUniformWorkGroupSize is only valid for function position");
}
struct AAAMDAttributesFunction : public AAAMDAttributes {
@@ -493,14 +497,14 @@ class AMDGPUAttributor : public ModulePass {
BumpPtrAllocator Allocator;
AMDGPUInformationCache InfoCache(M, AG, Allocator, nullptr, *TM);
DenseSet<const char *> Allowed(
- {&AAAMDAttributes::ID, &AAAMDWorkGroupSize::ID, &AACallEdges::ID});
+ {&AAAMDAttributes::ID, &AAUniformWorkGroupSize::ID, &AACallEdges::ID});
Attributor A(Functions, InfoCache, CGUpdater, &Allowed);
for (Function &F : M) {
if (!F.isIntrinsic()) {
A.getOrCreateAAFor<AAAMDAttributes>(IRPosition::function(F));
- A.getOrCreateAAFor<AAAMDWorkGroupSize>(IRPosition::function(F));
+ A.getOrCreateAAFor<AAUniformWorkGroupSize>(IRPosition::function(F));
}
}
More information about the llvm-commits
mailing list