[llvm] [CGP] Consider arguments and ret values in `dupRetToEnableTailCallOpts` (PR #76613)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 9 12:44:16 PST 2024


================
@@ -2631,8 +2685,12 @@ bool CodeGenPrepare::dupRetToEnableTailCallOpts(BasicBlock *BB,
       if (Instruction *I = Pred->rbegin()->getPrevNonDebugInstruction(true)) {
         CallInst *CI = dyn_cast<CallInst>(I);
         if (CI && CI->use_empty() && TLI->mayBeEmittedAsTailCall(CI) &&
-            attributesPermitTailCall(F, CI, RetI, *TLI))
-          TailCallBBs.push_back(Pred);
+            attributesPermitTailCall(F, CI, RetI, *TLI)) {
+          // Either we return void or the value must be the first argument of a
+          // known intrinsic or library function.
----------------
nikic wrote:

This one doesn't seem to actually check the "first argument" part.

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


More information about the llvm-commits mailing list