[llvm] [AMDGPU][NewPass] Attempt to promote uniform ptr arguments to inreg (PR #210410)

Akash Dutta via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 09:48:59 PDT 2026


================
@@ -66,26 +60,15 @@ static bool isEligibleInRegUniformCallee(const Function &F) {
     return false;
   }
 
-  // A musttail call requires the enclosing function's parameter ABI attributes
-  // to match the callee's positionally, so adding inreg to any parameter of F
-  // breaks the contract, not just to one forwarded to the tail call.
-  for (const BasicBlock &BB : F)
-    for (const Instruction &I : BB)
-      if (const auto *CB = dyn_cast<CallBase>(&I))
-        if (CB->isMustTailCall())
-          return false;
-
-  // Every use must be a direct call to F. This subsumes hasAddressTaken(),
-  // which by default ignores some uses we care about (e.g. assume-like calls),
-  // and it is what lets the transform treat each user as a call site to update.
-  for (const User *U : F.users()) {
-    const auto *CB = dyn_cast<CallBase>(U);
-    if (!CB || CB->getCalledFunction() != &F)
-      return false;
-    if (CB->isMustTailCall() || isa<InvokeInst>(CB))
+  // Every use must be the callee of a direct call to F. isCallee distinguishes
+  // that from F appearing as a call operand. Reject musttail/invoke *to* F.
+  for (Use &U : F.uses()) {
----------------
akadutta wrote:

added early return condition for F.hasAddressTaken. Added IgnoreAssumeLikeCalls=false so that assume-like uses do not pass through 

https://github.com/llvm/llvm-project/pull/210410


More information about the llvm-commits mailing list