[PATCH] D66096: [CodeGen/Analysis] Intrinsic llvm.assume should not block tail call optimization
Guozhi Wei via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 16 09:26:51 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL369125: [CodeGen/Analysis] Intrinsic llvm.assume should not block tail call optimization (authored by Carrot, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D66096?vs=214729&id=215622#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66096/new/
https://reviews.llvm.org/D66096
Files:
llvm/trunk/lib/CodeGen/Analysis.cpp
llvm/trunk/test/CodeGen/X86/tailcall-assume.ll
Index: llvm/trunk/lib/CodeGen/Analysis.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/Analysis.cpp
+++ llvm/trunk/lib/CodeGen/Analysis.cpp
@@ -536,9 +536,11 @@
// 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))
Index: llvm/trunk/test/CodeGen/X86/tailcall-assume.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/tailcall-assume.ll
+++ llvm/trunk/test/CodeGen/X86/tailcall-assume.ll
@@ -0,0 +1,15 @@
+; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s
+
+; Intrinsic call to @llvm.assume should not prevent tail call optimization.
+; CHECK-LABEL: foo:
+; CHECK: jmp bar # TAILCALL
+define i8* @foo() {
+ %1 = tail call i8* @bar()
+ %2 = icmp ne i8* %1, null
+ tail call void @llvm.assume(i1 %2)
+ ret i8* %1
+}
+
+declare i8* @bar()
+declare void @llvm.assume(i1)
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66096.215622.patch
Type: text/x-patch
Size: 1527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190816/b0383f56/attachment.bin>
More information about the llvm-commits
mailing list