[llvm] [NFC][AMDGPU][Attributor] Exit earlier if entry CC (PR #114177)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 29 21:23:17 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Shilei Tian (shiltian)
<details>
<summary>Changes</summary>
Avoid calling TTI or other stuff unnecessarily
---
Full diff: https://github.com/llvm/llvm-project/pull/114177.diff
1 Files Affected:
- (modified) llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp (+12-6)
``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
index 6a69b9d2bfc716..04d3e482359ade 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp
@@ -767,14 +767,17 @@ struct AAAMDFlatWorkGroupSize : public AAAMDSizeRangeAttribute {
void initialize(Attributor &A) override {
Function *F = getAssociatedFunction();
+
+ if (AMDGPU::isEntryFunctionCC(F->getCallingConv())) {
+ indicatePessimisticFixpoint();
+ return;
+ }
+
auto &InfoCache = static_cast<AMDGPUInformationCache &>(A.getInfoCache());
unsigned MinGroupSize, MaxGroupSize;
std::tie(MinGroupSize, MaxGroupSize) = InfoCache.getFlatWorkGroupSizes(*F);
intersectKnown(
ConstantRange(APInt(32, MinGroupSize), APInt(32, MaxGroupSize + 1)));
-
- if (AMDGPU::isEntryFunctionCC(F->getCallingConv()))
- indicatePessimisticFixpoint();
}
ChangeStatus updateImpl(Attributor &A) override {
@@ -833,6 +836,12 @@ struct AAAMDWavesPerEU : public AAAMDSizeRangeAttribute {
void initialize(Attributor &A) override {
Function *F = getAssociatedFunction();
+
+ if (AMDGPU::isEntryFunctionCC(F->getCallingConv())) {
+ indicatePessimisticFixpoint();
+ return;
+ }
+
auto &InfoCache = static_cast<AMDGPUInformationCache &>(A.getInfoCache());
if (const auto *AssumedGroupSize = A.getAAFor<AAAMDFlatWorkGroupSize>(
@@ -847,9 +856,6 @@ struct AAAMDWavesPerEU : public AAAMDSizeRangeAttribute {
ConstantRange Range(APInt(32, Min), APInt(32, Max + 1));
intersectKnown(Range);
}
-
- if (AMDGPU::isEntryFunctionCC(F->getCallingConv()))
- indicatePessimisticFixpoint();
}
ChangeStatus updateImpl(Attributor &A) override {
``````````
</details>
https://github.com/llvm/llvm-project/pull/114177
More information about the llvm-commits
mailing list