diff options
author | Guozhi Wei <carrot@google.com> | 2019-08-16 16:26:12 +0000 |
---|---|---|
committer | Guozhi Wei <carrot@google.com> | 2019-08-16 16:26:12 +0000 |
commit | e03f6a16317625b97e9332eed7c6875fae6b1d94 (patch) | |
tree | 0927ad94b00b216619af36873ee8b673d2ed109f /llvm/lib/CodeGen | |
parent | ac83aab035f2e7ea12cb623156ed4d1e8cd2816d (diff) | |
download | bcm5719-llvm-e03f6a16317625b97e9332eed7c6875fae6b1d94.tar.gz bcm5719-llvm-e03f6a16317625b97e9332eed7c6875fae6b1d94.zip |
[CodeGen/Analysis] Intrinsic llvm.assume should not block tail call optimization
In function Analysis.cpp:isInTailCallPosition, instructions between call and ret are checked to see if they block tail call optimization. If an instruction is an intrinsic call, only llvm.lifetime_end is allowed and other intrinsic functions block tail call. When compiling tcmalloc, we found llvm.assume between a hot function call and ret, it blocks the optimization. But llvm.assume doesn't generate instructions, it should not block tail call.
Differential Revision: https://reviews.llvm.org/D66096
llvm-svn: 369125
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/Analysis.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/Analysis.cpp b/llvm/lib/CodeGen/Analysis.cpp index e72938ba9be..f1bbb341df1 100644 --- a/llvm/lib/CodeGen/Analysis.cpp +++ b/llvm/lib/CodeGen/Analysis.cpp @@ -536,9 +536,11 @@ bool llvm::isInTailCallPosition(ImmutableCallSite CS, const TargetMachine &TM) { // Debug info intrinsics do not get in the way of tail call optimization. if (isa<DbgInfoIntrinsic>(BBI)) continue; - // A lifetime end intrinsic should not stop tail call optimization. + // A lifetime end or assume intrinsic should not stop tail call + // optimization. if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(BBI)) - if (II->getIntrinsicID() == Intrinsic::lifetime_end) + if (II->getIntrinsicID() == Intrinsic::lifetime_end || + II->getIntrinsicID() == Intrinsic::assume) continue; if (BBI->mayHaveSideEffects() || BBI->mayReadFromMemory() || !isSafeToSpeculativelyExecute(&*BBI)) |