Stackmap shadows should consider call returns a branch target.
[oota-llvm.git] / test / CodeGen / X86 / hoist-common.ll
1 ; RUN: llc < %s -mtriple=x86_64-apple-macosx  | FileCheck %s
2 ; This is supposed to be testing BranchFolding's common
3 ; code hoisting logic, but has been erroneously passing due
4 ; to there being a redundant xorl in the entry block
5 ; and no common code to hoist.
6 ; However, now that MachineSink sinks the redundant xor
7 ; hoist-common looks at it and rejects it for hoisting,
8 ; which causes this test to fail.
9 ; Since it seems this test is broken, marking XFAIL for now
10 ; until someone decides to remove it or fix what it tests.
11 ; XFAIL: *
12
13 ; Common "xorb al, al" instruction in the two successor blocks should be
14 ; moved to the entry block above the test + je.
15
16 ; rdar://9145558
17
18 define zeroext i1 @t(i32 %c) nounwind ssp {
19 entry:
20 ; CHECK-LABEL: t:
21 ; CHECK: xorl %eax, %eax
22 ; CHECK: test
23 ; CHECK: je
24   %tobool = icmp eq i32 %c, 0
25   br i1 %tobool, label %return, label %if.then
26
27 if.then:
28 ; CHECK: callq
29   %call = tail call zeroext i1 (...)* @foo() nounwind
30   br label %return
31
32 return:
33 ; CHECK: ret
34   %retval.0 = phi i1 [ %call, %if.then ], [ false, %entry ]
35   ret i1 %retval.0
36 }
37
38 declare zeroext i1 @foo(...)