1; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=core2 | FileCheck %s
2; Reduced from JavaScriptCore
3
4%"class.JSC::CodeLocationCall" = type { [8 x i8] }
5%"class.JSC::JSGlobalData" = type { [4 x i8] }
6%"class.JSC::FunctionPtr" = type { i8* }
7%"class.JSC::Structure" = type { [4 x i8] }
8%"class.JSC::UString" = type { i8* }
9%"class.JSC::JSString" = type { [16 x i8], i32, %"class.JSC::UString", i32 }
10
11declare hidden fastcc void @_ZN3JSCL23returnToThrowTrampolineEPNS_12JSGlobalDataENS_16ReturnAddressPtrERS2_(%"class.JSC::JSGlobalData"* nocapture, i8*, %"class.JSC::FunctionPtr"* nocapture) nounwind noinline ssp
12
13; Avoid hoisting the test above loads or copies
14; CHECK: %entry
15; CHECK: test
16; CHECK-NOT: mov
17; CHECK: je
18define i32 @cti_op_eq(i8** nocapture %args) nounwind ssp {
19entry:
20  %0 = load i8** null, align 8
21  %tmp13 = bitcast i8* %0 to %"class.JSC::CodeLocationCall"*
22  %tobool.i.i.i = icmp ugt i8* undef, inttoptr (i64 281474976710655 to i8*)
23  %or.cond.i = and i1 %tobool.i.i.i, undef
24  br i1 %or.cond.i, label %if.then.i, label %if.end.i
25
26if.then.i:                                        ; preds = %entry
27  br i1 undef, label %if.then.i.i.i, label %_ZN3JSC7JSValue19equalSlowCaseInlineEPNS_9ExecStateES0_S0_.exit
28
29if.then.i.i.i:                                    ; preds = %if.then.i
30  %conv.i.i.i.i = trunc i64 undef to i32
31  br label %_ZN3JSC7JSValue19equalSlowCaseInlineEPNS_9ExecStateES0_S0_.exit
32
33if.end.i:                                         ; preds = %entry
34  br i1 undef, label %land.rhs.i121.i, label %_ZNK3JSC7JSValue8isStringEv.exit122.i
35
36land.rhs.i121.i:                                  ; preds = %if.end.i
37  %tmp.i.i117.i = load %"class.JSC::Structure"** undef, align 8
38  br label %_ZNK3JSC7JSValue8isStringEv.exit122.i
39
40_ZNK3JSC7JSValue8isStringEv.exit122.i:            ; preds = %land.rhs.i121.i, %if.end.i
41  %brmerge.i = or i1 undef, false
42  %or.cond = or i1 false, %brmerge.i
43  br i1 %or.cond, label %_ZN3JSC7JSValue19equalSlowCaseInlineEPNS_9ExecStateES0_S0_.exit, label %if.then.i92.i
44
45if.then.i92.i:                                    ; preds = %_ZNK3JSC7JSValue8isStringEv.exit122.i
46  tail call void @_ZNK3JSC8JSString11resolveRopeEPNS_9ExecStateE(%"class.JSC::JSString"* undef, %"class.JSC::CodeLocationCall"* %tmp13) nounwind
47  unreachable
48
49_ZN3JSC7JSValue19equalSlowCaseInlineEPNS_9ExecStateES0_S0_.exit: ; preds = %_ZNK3JSC7JSValue8isStringEv.exit122.i, %if.then.i.i.i, %if.then.i
50
51  %1 = load i8** undef, align 8
52  br i1 undef, label %do.end39, label %do.body27
53
54do.body27:                                        ; preds = %_ZN3JSC7JSValue19equalSlowCaseInlineEPNS_9ExecStateES0_S0_.exit
55  %tmp30 = bitcast i8* %1 to %"class.JSC::JSGlobalData"*
56  %2 = getelementptr inbounds i8** %args, i64 -1
57  %3 = bitcast i8** %2 to %"class.JSC::FunctionPtr"*
58  tail call fastcc void @_ZN3JSCL23returnToThrowTrampolineEPNS_12JSGlobalDataENS_16ReturnAddressPtrERS2_(%"class.JSC::JSGlobalData"* %tmp30, i8* undef, %"class.JSC::FunctionPtr"* %3)
59  unreachable
60
61do.end39:                                         ; preds = %_ZN3JSC7JSValue19equalSlowCaseInlineEPNS_9ExecStateES0_S0_.exit
62  ret i32 undef
63}
64
65declare void @_ZNK3JSC8JSString11resolveRopeEPNS_9ExecStateE(%"class.JSC::JSString"*, %"class.JSC::CodeLocationCall"*)
66