xref: /llvm-project/llvm/test/CodeGen/X86/2012-10-18-crash-dagco.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; RUN: llc -mcpu=corei7 -disable-cgp-select2branch < %s
2
3; We should not crash on this test.
4
5target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32"
6target triple = "x86_64-apple-darwin9.0.0"
7
8@global = external constant [411 x i8], align 1
9
10define void @snork() nounwind {
11bb:
12  br i1 undef, label %bb26, label %bb27
13
14bb26:                                             ; preds = %bb48, %bb26, %bb
15  switch i32 undef, label %bb26 [
16    i32 142771596, label %bb28
17  ]
18
19bb27:                                             ; preds = %bb48, %bb
20  switch i32 undef, label %bb49 [
21    i32 142771596, label %bb28
22  ]
23
24bb28:                                             ; preds = %bb27, %bb26
25  %tmp = load i32, ptr null
26  %tmp29 = trunc i32 %tmp to i8
27  store ptr undef, ptr undef
28  %tmp30 = load i32, ptr null
29  %tmp31 = icmp eq i32 %tmp30, 0
30  %tmp32 = getelementptr inbounds [411 x i8], ptr @global, i32 0, i32 undef
31  %tmp33 = load i8, ptr %tmp32, align 1
32  %tmp35 = load i8, ptr @global, align 1
33  %tmp36 = select i1 %tmp31, i8 %tmp35, i8 %tmp33
34  %tmp37 = select i1 undef, i8 %tmp29, i8 %tmp36
35  %tmp38 = zext i8 %tmp37 to i32
36  %tmp39 = select i1 undef, i32 0, i32 %tmp38
37  %tmp40 = getelementptr inbounds i32, ptr null, i32 %tmp39
38  %tmp41 = load i32, ptr %tmp40, align 4
39  %tmp42 = load i32, ptr undef, align 4
40  %tmp43 = load i32, ptr undef
41  %tmp44 = xor i32 %tmp42, %tmp43
42  %tmp45 = lshr i32 %tmp44, 8
43  %tmp46 = lshr i32 %tmp44, 7
44  call void @spam()
45  unreachable
46
47bb47:                                             ; No predecessors!
48  ret void
49
50bb48:                                             ; No predecessors!
51  br i1 undef, label %bb27, label %bb26
52
53bb49:                                             ; preds = %bb49, %bb27
54  br label %bb49
55
56bb50:                                             ; preds = %bb50
57  br label %bb50
58}
59
60declare void @spam() noreturn nounwind
61