diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-08-28 16:44:09 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-08-28 16:44:09 +0000 |
commit | a787de32270237059d712108eedbd1c06300ca70 (patch) | |
tree | 74f730fd573323b7278e37afaa7c0cc777236f26 /llvm/lib/CodeGen/Analysis.cpp | |
parent | 69e7f6e4365a917b79e1d98238e2c31bcc2ee083 (diff) | |
download | llvm-a787de32270237059d712108eedbd1c06300ca70.zip llvm-a787de32270237059d712108eedbd1c06300ca70.tar.gz llvm-a787de32270237059d712108eedbd1c06300ca70.tar.bz2 |
[CodeGen] isInTailCallPosition didn't consider readnone tailcalls
A readnone tailcall may still have a chain of computation which follows
it that would invalidate a tailcall lowering. Don't skip the analysis
in such cases.
This fixes PR24613.
llvm-svn: 246304
Diffstat (limited to 'llvm/lib/CodeGen/Analysis.cpp')
-rw-r--r-- | llvm/lib/CodeGen/Analysis.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp index 98d4c8a..33ad8835 100644 --- a/llvm/lib/CodeGen/Analysis.cpp +++ b/llvm/lib/CodeGen/Analysis.cpp @@ -506,18 +506,16 @@ bool llvm::isInTailCallPosition(ImmutableCallSite CS, const TargetMachine &TM) { // If I will have a chain, make sure no other instruction that will have a // chain interposes between I and the return. - if (I->mayHaveSideEffects() || I->mayReadFromMemory() || - !isSafeToSpeculativelyExecute(I)) - for (BasicBlock::const_iterator BBI = std::prev(ExitBB->end(), 2);; --BBI) { - if (&*BBI == I) - break; - // Debug info intrinsics do not get in the way of tail call optimization. - if (isa<DbgInfoIntrinsic>(BBI)) - continue; - if (BBI->mayHaveSideEffects() || BBI->mayReadFromMemory() || - !isSafeToSpeculativelyExecute(BBI)) - return false; - } + for (BasicBlock::const_iterator BBI = std::prev(ExitBB->end(), 2);; --BBI) { + if (&*BBI == I) + break; + // Debug info intrinsics do not get in the way of tail call optimization. + if (isa<DbgInfoIntrinsic>(BBI)) + continue; + if (BBI->mayHaveSideEffects() || BBI->mayReadFromMemory() || + !isSafeToSpeculativelyExecute(BBI)) + return false; + } const Function *F = ExitBB->getParent(); return returnTypeIsEligibleForTailCall( |