xref: /llvm-project/llvm/test/CodeGen/X86/2013-01-09-DAGCombineBug.ll (revision f060f095aa68fb4b0ce54c842b9d20613891e69e)
1; RUN: llc -mtriple=x86_64-apple-macosx10.5.0 < %s
2
3; rdar://12968664
4
5define void @t() nounwind uwtable ssp {
6  br label %4
7
8; <label>:1                                       ; preds = %4, %2
9  ret void
10
11; <label>:2                                       ; preds = %6, %5, %3, %2
12  switch i32 undef, label %2 [
13    i32 1090573978, label %1
14    i32 1090573938, label %3
15    i32 1090573957, label %5
16  ]
17
18; <label>:3                                       ; preds = %4, %2
19  br i1 undef, label %2, label %4
20
21; <label>:4                                       ; preds = %6, %5, %3, %0
22  switch i32 undef, label %11 [
23    i32 1090573938, label %3
24    i32 1090573957, label %5
25    i32 1090573978, label %1
26    i32 165205179, label %6
27  ]
28
29; <label>:5                                       ; preds = %4, %2
30  br i1 undef, label %2, label %4
31
32; <label>:6                                       ; preds = %4
33  %7 = icmp eq i32 undef, 590901838
34  %8 = or i1 false, %7
35  %9 = or i1 true, %8
36  %10 = xor i1 %8, %9
37  br i1 %10, label %4, label %2
38
39; <label>:11                                      ; preds = %11, %4
40  br label %11
41}
42
43; PR15608
44@global = external constant [2 x i8]
45
46define void @PR15608() {
47bb:
48  br label %bb3
49
50bb1:                                              ; No predecessors!
51  %constexpr = ptrtoint ptr @global to i64
52  %constexpr1 = zext i64 %constexpr to i384
53  %constexpr2 = shl i384 %constexpr1, 192
54  %constexpr3 = or i384 %constexpr2, 425269881901436522087161771558896140289
55  %constexpr4 = lshr i384 %constexpr3, 128
56  %constexpr5 = trunc i384 %constexpr4 to i128
57  %constexpr6 = lshr i128 %constexpr5, 64
58  %constexpr7 = trunc i128 %constexpr6 to i64
59  %constexpr8 = zext i64 %constexpr7 to i192
60  %constexpr9 = shl i192 %constexpr8, 64
61  %constexpr10 = or i192 %constexpr9, 1
62  %constexpr11 = lshr i192 %constexpr10, 128
63  %constexpr12 = trunc i192 %constexpr11 to i1
64  %constexpr13 = zext i1 %constexpr12 to i64
65  %constexpr14 = xor i64 %constexpr13, 1
66  %constexpr15 = icmp ult i64 %constexpr14, 1
67  br i1 %constexpr15, label %bb2, label %bb3
68
69bb2:                                              ; preds = %bb1
70  unreachable
71
72bb3:                                              ; preds = %bb1, %bb
73  %constexpr16 = ptrtoint ptr @global to i64
74  %constexpr17 = zext i64 %constexpr16 to i384
75  %constexpr18 = shl i384 %constexpr17, 192
76  %constexpr19 = or i384 %constexpr18, 425269881901436522087161771558896140289
77  %constexpr20 = lshr i384 %constexpr19, 128
78  %constexpr21 = trunc i384 %constexpr20 to i128
79  %constexpr22 = lshr i128 %constexpr21, 64
80  %constexpr23 = trunc i128 %constexpr22 to i64
81  %constexpr24 = zext i64 %constexpr23 to i192
82  %constexpr25 = shl i192 %constexpr24, 64
83  %constexpr26 = or i192 %constexpr25, 1
84  %constexpr27 = lshr i192 %constexpr26, 128
85  %constexpr28 = trunc i192 %constexpr27 to i1
86  %constexpr29 = and i192 %constexpr26, -340282366920938463463374607431768211457
87  %constexpr30 = zext i1 %constexpr28 to i192
88  %constexpr31 = shl i192 %constexpr30, 128
89  %constexpr32 = or i192 %constexpr29, %constexpr31
90  %constexpr33 = lshr i192 %constexpr32, 128
91  %constexpr34 = trunc i192 %constexpr33 to i1
92  %constexpr35 = xor i1 %constexpr28, %constexpr34
93  br i1 %constexpr35, label %bb7, label %phi.constexpr
94
95phi.constexpr:                                    ; preds = %bb3
96  %constexpr36 = ptrtoint ptr @global to i64
97  %constexpr37 = zext i64 %constexpr36 to i384
98  %constexpr38 = shl i384 %constexpr37, 192
99  %constexpr39 = or i384 %constexpr38, 425269881901436522087161771558896140289
100  %constexpr40 = lshr i384 %constexpr39, 128
101  %constexpr41 = trunc i384 %constexpr40 to i128
102  %constexpr42 = lshr i128 %constexpr41, 64
103  %constexpr43 = trunc i128 %constexpr42 to i64
104  %constexpr44 = zext i64 %constexpr43 to i192
105  %constexpr45 = shl i192 %constexpr44, 64
106  %constexpr46 = or i192 %constexpr45, 1
107  %constexpr47 = and i192 %constexpr46, -340282366920938463463374607431768211457
108  %constexpr48 = lshr i192 %constexpr46, 128
109  %constexpr49 = trunc i192 %constexpr48 to i1
110  %constexpr50 = zext i1 %constexpr49 to i192
111  %constexpr51 = shl i192 %constexpr50, 128
112  %constexpr52 = or i192 %constexpr47, %constexpr51
113  %constexpr53 = lshr i192 %constexpr52, 128
114  %constexpr54 = trunc i192 %constexpr53 to i1
115  br label %bb4
116
117bb4:                                              ; preds = %phi.constexpr, %bb6
118  %tmp = phi i1 [ true, %bb6 ], [ %constexpr54, %phi.constexpr ]
119  br i1 false, label %bb8, label %bb5
120
121bb5:                                              ; preds = %bb4
122  br i1 %tmp, label %bb8, label %bb6
123
124bb6:                                              ; preds = %bb5
125  br i1 false, label %bb8, label %bb4
126
127bb7:                                              ; preds = %bb3
128  unreachable
129
130bb8:                                              ; preds = %bb6, %bb5, %bb4
131  unreachable
132}
133