@@ -691,20 +691,23 @@ struct AAAMDAttributesFunction : public AAAMDAttributes {
691
691
// Returns true if FlatScratchInit is needed, i.e., no-flat-scratch-init is
692
692
// not to be set.
693
693
bool needFlatScratchInit (Attributor &A) {
694
+ assert (isAssumed (FLAT_SCRATCH_INIT)); // only called if the bit is still set
695
+
694
696
// This is called on each callee; false means callee shouldn't have
695
697
// no-flat-scratch-init.
696
698
auto CheckForNoFlatScratchInit = [&](Instruction &I) {
697
699
const auto &CB = cast<CallBase>(I);
698
700
const Function *Callee = CB.getCalledFunction ();
699
- if (!Callee) // indirect call
700
- return CB.isInlineAsm ();
701
701
702
- if (Callee->isIntrinsic ())
703
- return Callee->getIntrinsicID () != Intrinsic::amdgcn_addrspacecast_nonnull;
702
+ if (Callee && Callee->isIntrinsic ())
703
+ return Callee->getIntrinsicID () !=
704
+ Intrinsic::amdgcn_addrspacecast_nonnull;
704
705
705
- const auto *CalleeInfo = A.getAAFor <AAAMDAttributes>(
706
- *this , IRPosition::function (*Callee), DepClassTy::REQUIRED);
707
- return CalleeInfo && CalleeInfo->isAssumed (FLAT_SCRATCH_INIT);
706
+ // Return true for all other cases, including (1)inline asm, (2)direct
707
+ // call, and (3)indirect call with known callees. For (2) and (3)
708
+ // updateImpl() already checked the callees and we know their
709
+ // FLAT_SCRATCH_INIT bit is set.
710
+ return true ;
708
711
};
709
712
710
713
bool UsedAssumedInformation = false ;
0 commit comments