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

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 25 06:39:16 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()) {
----------------
shiltian wrote:

So my point is, if a function has address taken, that function is not eligible for promotion, and then there is no need for checking its uses about whether the callee at the call site is itself.

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


More information about the llvm-commits mailing list