[llvm] [CGP] Permit tail call optimization on undefined return value (PR #82419)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 02:43:18 PST 2024


================
@@ -2686,8 +2686,9 @@ bool CodeGenPrepare::dupRetToEnableTailCallOpts(BasicBlock *BB,
             attributesPermitTailCall(F, CI, RetI, *TLI)) {
           // Either we return void or the return value must be the first
           // argument of a known intrinsic or library function.
-          if (!V || (isIntrinsicOrLFToBeTailCalled(TLInfo, CI) &&
-                     V == CI->getArgOperand(0))) {
+          if (!V || isa<UndefValue>(V) ||
----------------
nikic wrote:

I think the explicit UndefValue check is fine. Especially if we also want to extend the phi case above to handle undef incoming values later.

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


More information about the llvm-commits mailing list