1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 3
2 ; RUN: opt -S -passes=instcombine < %s | FileCheck %s
4 ; Make sure we don't crash.
6 @j = internal constant i32 4
9 ; CHECK-LABEL: define void @y() {
11 ; CHECK-NEXT: br label [[FOR_COND_I:%.*]]
13 ; CHECK-NEXT: br i1 false, label [[FOR_COND_I]], label [[FOR_COND5_PREHEADER_I:%.*]]
14 ; CHECK: for.cond1.loopexit.i:
15 ; CHECK-NEXT: store i1 true, ptr poison, align 1
16 ; CHECK-NEXT: br i1 poison, label [[FOR_COND_I]], label [[FOR_COND5_PREHEADER_I]]
17 ; CHECK: for.cond5.preheader.i:
18 ; CHECK-NEXT: br i1 true, label [[FOR_COND1_LOOPEXIT_I:%.*]], label [[FOR_INC19_I:%.*]]
20 ; CHECK-NEXT: br i1 poison, label [[FOR_INC19_I]], label [[FOR_COND1_LOOPEXIT_I]]
25 for.cond.i: ; preds = %for.cond1.loopexit.i, %for.cond.i, %entry
26 %phi1 = phi ptr [ @j, %entry ], [ @j, %for.cond.i ], [ null, %for.cond1.loopexit.i ]
27 %load1 = load i32, ptr %phi1, align 4
28 br i1 false, label %for.cond.i, label %for.cond5.preheader.i
30 for.cond1.loopexit.i: ; preds = %for.inc19.i, %for.cond5.preheader.i
31 %load2 = load i32, ptr null, align 4
32 %conv.i = sext i32 %load2 to i64
33 %tobool4.not.i = icmp eq i64 0, %conv.i
34 br i1 %tobool4.not.i, label %for.cond.i, label %for.cond5.preheader.i
36 for.cond5.preheader.i: ; preds = %for.cond1.loopexit.i, %for.cond.i
37 %phi = phi i32 [ 0, %for.cond1.loopexit.i ], [ %load1, %for.cond.i ]
38 %sub6.i = or i32 %load1, 1
39 %cmp5.i.i = icmp sgt i32 %load1, 41
40 %a.1.3.i.i = select i1 %cmp5.i.i, i32 %sub6.i, i32 0
41 %add.4.i.i = add i32 %a.1.3.i.i, 1
42 %cmp8.4.i.i = icmp sgt i32 %a.1.3.i.i, 0
43 %spec.select.4.i.i1 = select i1 %cmp8.4.i.i, i32 %add.4.i.i, i32 0
44 %cmp11.4.i.i = icmp eq i32 %add.4.i.i, 0
45 %add.5.i.i = or i32 %add.4.i.i, %sub6.i
46 %cmp8.5.i.i = icmp sgt i32 %add.5.i.i, 0
47 %sel = select i1 %cmp5.i.i, i1 %cmp8.5.i.i, i1 false
48 %i.1.5.i.i = select i1 %sel, i32 0, i32 %spec.select.4.i.i1
49 %spec.select = select i1 %cmp11.4.i.i, i32 0, i32 %i.1.5.i.i
50 %add8.i = or i32 %spec.select, -1020499714
51 %cmp.i3 = icmp sgt i32 %add8.i, -1020499638
52 br i1 %cmp.i3, label %for.inc19.i, label %for.cond1.loopexit.i
54 for.inc19.i: ; preds = %for.inc19.i, %for.cond5.preheader.i
55 br i1 %sel, label %for.inc19.i, label %for.cond1.loopexit.i
57 ; uselistorder directives
58 uselistorder i32 %load1, { 1, 0, 2 }