1; RUN: llc < %s -mtriple=arm64-eabi
2
3; The target lowering for integer comparisons was replacing some DAG nodes
4; during operation legalization, which resulted in dangling pointers,
5; cycles in DAGs, and eventually crashes.  This is the testcase for
6; one of those crashes. (rdar://10653656)
7
8define void @test(i1 zeroext %IsArrow) nounwind ssp align 2 {
9entry:
10  br i1 undef, label %return, label %lor.lhs.false
11
12lor.lhs.false:
13  br i1 undef, label %return, label %if.end
14
15if.end:
16  %tmp.i = load i64, i64* undef, align 8
17  %and.i.i.i = and i64 %tmp.i, -16
18  br i1 %IsArrow, label %if.else_crit_edge, label %if.end32
19
20if.else_crit_edge:
21  br i1 undef, label %if.end32, label %return
22
23if.end32:
24  %0 = icmp ult i32 undef, 3
25  %1 = zext i64 %tmp.i to i320
26  %.pn.v = select i1 %0, i320 128, i320 64
27  %.pn = shl i320 %1, %.pn.v
28  %ins346392 = or i320 %.pn, 0
29  store i320 %ins346392, i320* undef, align 8
30  br i1 undef, label %sw.bb.i.i, label %exit
31
32sw.bb.i.i:
33  unreachable
34
35exit:
36  unreachable
37
38return:
39  ret void
40}
41