Skip to content

Commit 922a0d3

Browse files
authored
[NFC][AMDGPU][Attributor] Exit earlier if entry CC (#114177)
Avoid calling TTI or other stuff unnecessarily
1 parent f672cc1 commit 922a0d3

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

llvm/lib/Target/AMDGPU/AMDGPUAttributor.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -767,14 +767,17 @@ struct AAAMDFlatWorkGroupSize : public AAAMDSizeRangeAttribute {
767767

768768
void initialize(Attributor &A) override {
769769
Function *F = getAssociatedFunction();
770+
771+
if (AMDGPU::isEntryFunctionCC(F->getCallingConv())) {
772+
indicatePessimisticFixpoint();
773+
return;
774+
}
775+
770776
auto &InfoCache = static_cast<AMDGPUInformationCache &>(A.getInfoCache());
771777
unsigned MinGroupSize, MaxGroupSize;
772778
std::tie(MinGroupSize, MaxGroupSize) = InfoCache.getFlatWorkGroupSizes(*F);
773779
intersectKnown(
774780
ConstantRange(APInt(32, MinGroupSize), APInt(32, MaxGroupSize + 1)));
775-
776-
if (AMDGPU::isEntryFunctionCC(F->getCallingConv()))
777-
indicatePessimisticFixpoint();
778781
}
779782

780783
ChangeStatus updateImpl(Attributor &A) override {
@@ -833,6 +836,12 @@ struct AAAMDWavesPerEU : public AAAMDSizeRangeAttribute {
833836

834837
void initialize(Attributor &A) override {
835838
Function *F = getAssociatedFunction();
839+
840+
if (AMDGPU::isEntryFunctionCC(F->getCallingConv())) {
841+
indicatePessimisticFixpoint();
842+
return;
843+
}
844+
836845
auto &InfoCache = static_cast<AMDGPUInformationCache &>(A.getInfoCache());
837846

838847
if (const auto *AssumedGroupSize = A.getAAFor<AAAMDFlatWorkGroupSize>(
@@ -847,9 +856,6 @@ struct AAAMDWavesPerEU : public AAAMDSizeRangeAttribute {
847856
ConstantRange Range(APInt(32, Min), APInt(32, Max + 1));
848857
intersectKnown(Range);
849858
}
850-
851-
if (AMDGPU::isEntryFunctionCC(F->getCallingConv()))
852-
indicatePessimisticFixpoint();
853859
}
854860

855861
ChangeStatus updateImpl(Attributor &A) override {

0 commit comments

Comments
 (0)