summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/conditional-tailcall.ll
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2016-09-13 00:21:32 +0000
committerHans Wennborg <hans@hanshq.net>2016-09-13 00:21:32 +0000
commit8a42d4b9cc038744eeb3f3276a6ecb36a32018c0 (patch)
tree3f9e3f239b0533d609a2b0c91ed72b742e9a6755 /llvm/test/CodeGen/X86/conditional-tailcall.ll
parent04c7db31e8072af2912cabc8af4b0b9347728e86 (diff)
downloadbcm5719-llvm-8a42d4b9cc038744eeb3f3276a6ecb36a32018c0.tar.gz
bcm5719-llvm-8a42d4b9cc038744eeb3f3276a6ecb36a32018c0.zip
X86: Conditional tail calls should not have isBarrier = 1
That confuses e.g. machine basic block placement, which then doesn't realize that control can fall through a block that ends with a conditional tail call. Instead, isBranch=1 should be set. Also, mark EFLAGS as used by these instructions. llvm-svn: 281281
Diffstat (limited to 'llvm/test/CodeGen/X86/conditional-tailcall.ll')
-rw-r--r--llvm/test/CodeGen/X86/conditional-tailcall.ll32
1 files changed, 30 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/X86/conditional-tailcall.ll b/llvm/test/CodeGen/X86/conditional-tailcall.ll
index 5dfdfd49ceb..502643d9a91 100644
--- a/llvm/test/CodeGen/X86/conditional-tailcall.ll
+++ b/llvm/test/CodeGen/X86/conditional-tailcall.ll
@@ -14,12 +14,40 @@ bb1:
bb2:
tail call void @bar()
ret void
-}
; CHECK-LABEL: f:
; CHECK: cmp
; CHECK: jne bar
; Check that the asm doesn't just look good, but uses the correct encoding.
; CHECK: encoding: [0x75,A]
-
; CHECK: jmp foo
+}
+
+
+declare x86_thiscallcc zeroext i1 @baz(i8*, i32)
+define x86_thiscallcc zeroext i1 @BlockPlacementTest(i8* %this, i32 %x) optsize {
+entry:
+ %and = and i32 %x, 42
+ %tobool = icmp eq i32 %and, 0
+ br i1 %tobool, label %land.end, label %land.rhs
+
+land.rhs:
+ %and6 = and i32 %x, 44
+ %tobool7 = icmp eq i32 %and6, 0
+ br i1 %tobool7, label %lor.rhs, label %land.end
+
+lor.rhs:
+ %call = tail call x86_thiscallcc zeroext i1 @baz(i8* %this, i32 %x) #2
+ br label %land.end
+
+land.end:
+ %0 = phi i1 [ false, %entry ], [ true, %land.rhs ], [ %call, %lor.rhs ]
+ ret i1 %0
+
+; Make sure machine block placement isn't confused by the conditional tail call,
+; but sees that it can fall through to the next block.
+; CHECK-LABEL: BlockPlacementTest
+; CHECK: je baz
+; CHECK-NOT: xor
+; CHECK: ret
+}
OpenPOWER on IntegriCloud