[DAGCombiner] Add target hook function to decide folding (mul (add x, c1), c2)
[llvm-project.git] / llvm / test / Transforms / InstCombine / div-shift-crash.ll
blob33fc558f35b1801a0279af4a8c1ce164522dc7d8
1 ; RUN: opt -instcombine < %s
2 target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
3 target triple = "powerpc64-unknown-linux-gnu"
5 %struct.S0.0.1.2.3.4.13.22.31.44.48.53.54.55.56.58.59.60.66.68.70.74.77.106.107.108.109.110.113.117.118.128.129 = type <{ i64 }>
7 ; Function Attrs: nounwind
8 define void @main() #0 {
9 entry:
10   %l_819.i.i = alloca %struct.S0.0.1.2.3.4.13.22.31.44.48.53.54.55.56.58.59.60.66.68.70.74.77.106.107.108.109.110.113.117.118.128.129, align 8
11   br i1 undef, label %land.lhs.true, label %for.cond.i
13 land.lhs.true:                                    ; preds = %entry
14   br label %for.cond.i
16 for.cond.i:                                       ; preds = %land.lhs.true, %entry
17   %0 = getelementptr inbounds %struct.S0.0.1.2.3.4.13.22.31.44.48.53.54.55.56.58.59.60.66.68.70.74.77.106.107.108.109.110.113.117.118.128.129, %struct.S0.0.1.2.3.4.13.22.31.44.48.53.54.55.56.58.59.60.66.68.70.74.77.106.107.108.109.110.113.117.118.128.129* %l_819.i.i, i64 0, i32 0
18   br label %for.cond.i6.i.i
20 for.cond.i6.i.i:                                  ; preds = %for.body.i8.i.i, %for.cond.i
21   br i1 undef, label %for.body.i8.i.i, label %lbl_707.i.i.i
23 for.body.i8.i.i:                                  ; preds = %for.cond.i6.i.i
24   br label %for.cond.i6.i.i
26 lbl_707.i.i.i:                                    ; preds = %for.cond.i6.i.i
27   br i1 undef, label %lor.rhs.i.i.i, label %lor.end.i.i.i
29 lor.rhs.i.i.i:                                    ; preds = %lbl_707.i.i.i
30   br label %lor.end.i.i.i
32 lor.end.i.i.i:                                    ; preds = %lor.rhs.i.i.i, %lbl_707.i.i.i
33   br label %for.cond1.i.i.i.i
35 for.cond1.i.i.i.i:                                ; preds = %for.body4.i.i.i.i, %lor.end.i.i.i
36   br i1 undef, label %for.body4.i.i.i.i, label %func_39.exit.i.i
38 for.body4.i.i.i.i:                                ; preds = %for.cond1.i.i.i.i
39   br label %for.cond1.i.i.i.i
41 func_39.exit.i.i:                                 ; preds = %for.cond1.i.i.i.i
42   %l_8191.sroa.0.0.copyload.i.i = load i64, i64* %0, align 1
43   br label %for.cond1.i.i.i
45 for.cond1.i.i.i:                                  ; preds = %safe_div_func_uint32_t_u_u.exit.i.i.i, %func_39.exit.i.i
46   br i1 undef, label %for.cond7.i.i.i, label %func_11.exit.i
48 for.cond7.i.i.i:                                  ; preds = %for.end30.i.i.i, %for.cond1.i.i.i
49   %storemerge.i.i.i = phi i32 [ %sub.i.i.i, %for.end30.i.i.i ], [ 4, %for.cond1.i.i.i ]
50   br i1 undef, label %for.cond22.i.i.i, label %for.end32.i.i.i
52 for.cond22.i.i.i:                                 ; preds = %for.body25.i.i.i, %for.cond7.i.i.i
53   br i1 undef, label %for.body25.i.i.i, label %for.end30.i.i.i
55 for.body25.i.i.i:                                 ; preds = %for.cond22.i.i.i
56   br label %for.cond22.i.i.i
58 for.end30.i.i.i:                                  ; preds = %for.cond22.i.i.i
59   %sub.i.i.i = add nsw i32 0, -1
60   br label %for.cond7.i.i.i
62 for.end32.i.i.i:                                  ; preds = %for.cond7.i.i.i
63   %conv33.i.i.i = trunc i64 %l_8191.sroa.0.0.copyload.i.i to i32
64   %xor.i.i.i.i = xor i32 %storemerge.i.i.i, -701565022
65   %sub.i.i.i.i = sub nsw i32 0, %storemerge.i.i.i
66   %xor3.i.i.i.i = xor i32 %sub.i.i.i.i, %storemerge.i.i.i
67   %and4.i.i.i.i = and i32 %xor.i.i.i.i, %xor3.i.i.i.i
68   %cmp.i.i.i.i = icmp slt i32 %and4.i.i.i.i, 0
69   %sub5.i.i.i.i = sub nsw i32 -701565022, %storemerge.i.i.i
70   %.sub5.i.i.i.i = select i1 %cmp.i.i.i.i, i32 -701565022, i32 %sub5.i.i.i.i
71   br i1 undef, label %safe_div_func_uint32_t_u_u.exit.i.i.i, label %cond.false.i.i.i.i
73 cond.false.i.i.i.i:                               ; preds = %for.end32.i.i.i
74   %div.i.i.i.i = udiv i32 %conv33.i.i.i, %.sub5.i.i.i.i
75   br label %safe_div_func_uint32_t_u_u.exit.i.i.i
77 safe_div_func_uint32_t_u_u.exit.i.i.i:            ; preds = %cond.false.i.i.i.i, %for.end32.i.i.i
78   %cond.i.i.i.i = phi i32 [ %div.i.i.i.i, %cond.false.i.i.i.i ], [ %conv33.i.i.i, %for.end32.i.i.i ]
79   %cmp35.i.i.i = icmp ne i32 %cond.i.i.i.i, -7
80   br label %for.cond1.i.i.i
82 func_11.exit.i:                                   ; preds = %for.cond1.i.i.i
83   br i1 undef, label %for.body, label %for.end
85 for.body:                                         ; preds = %func_11.exit.i
86   unreachable
88 for.end:                                          ; preds = %func_11.exit.i
89   br label %for.cond15
91 for.cond15:                                       ; preds = %for.cond19, %for.end
92   br i1 undef, label %for.cond19, label %for.end45
94 for.cond19:                                       ; preds = %for.cond15
95   br label %for.cond15
97 for.end45:                                        ; preds = %for.cond15
98   unreachable
101 attributes #0 = { nounwind "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }