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