diff options
author | Antonio Frighetto <me@antoniofrighetto.com> | 2024-02-20 22:13:46 +0100 |
---|---|---|
committer | Antonio Frighetto <me@antoniofrighetto.com> | 2024-02-22 10:09:15 +0100 |
commit | 25e7e8d993f12f391ad90d23b5c3e2385ebafc81 (patch) | |
tree | 46b8947318726e10c4c36ba0fa2ae5e6ef08e499 /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | fde344aef20bc4280f01294ac6e14a5c2db2d572 (diff) | |
download | llvm-25e7e8d993f12f391ad90d23b5c3e2385ebafc81.zip llvm-25e7e8d993f12f391ad90d23b5c3e2385ebafc81.tar.gz llvm-25e7e8d993f12f391ad90d23b5c3e2385ebafc81.tar.bz2 |
[CGP] Permit tail call optimization on undefined return value
We may freely allow tail call optzs on undef values as well.
Fixes: https://github.com/llvm/llvm-project/issues/82387.
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 4036f18..feefe87 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -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) || + (isIntrinsicOrLFToBeTailCalled(TLInfo, CI) && + V == CI->getArgOperand(0))) { TailCallBBs.push_back(Pred); } } |