1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
3 ; The tests in this file check that we do not simplify based on metadata that is
4 ; not available on all code paths.
6 ; RUN: opt < %s -S -newgvn | FileCheck %s
8 define i1 @test1(i32** %arg, i1 %arg2) {
10 ; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
12 ; CHECK-NEXT: [[LOAD1:%.*]] = load i32*, i32** [[ARG:%.*]], !nonnull !0
13 ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32* [[LOAD1]], null
14 ; CHECK-NEXT: ret i1 [[CMP1]]
16 ; CHECK-NEXT: [[LOAD2:%.*]] = load i32*, i32** [[ARG]]
17 ; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i32* [[LOAD2]], null
18 ; CHECK-NEXT: ret i1 [[CMP2]]
20 br i1 %arg2, label %bb1, label %bb2
23 %load1 = load i32*, i32** %arg, !nonnull !0
24 %cmp1 = icmp eq i32* %load1, null
28 %load2 = load i32*, i32** %arg
29 %cmp2 = icmp eq i32* %load2, null
33 define i1 @test2(i32** %arg, i1 %arg2) {
34 ; CHECK-LABEL: @test2(
35 ; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
37 ; CHECK-NEXT: [[LOAD1:%.*]] = load i32*, i32** [[ARG:%.*]]
38 ; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i32* [[LOAD1]], null
39 ; CHECK-NEXT: ret i1 [[CMP1]]
41 ; CHECK-NEXT: [[LOAD2:%.*]] = load i32*, i32** [[ARG]], !nonnull !0
42 ; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i32* [[LOAD2]], null
43 ; CHECK-NEXT: ret i1 [[CMP2]]
45 br i1 %arg2, label %bb1, label %bb2
48 %load1 = load i32*, i32** %arg
49 %cmp1 = icmp eq i32* %load1, null
53 %load2 = load i32*, i32** %arg, !nonnull !0
54 %cmp2 = icmp eq i32* %load2, null
59 define i1 @test3(i32* %ptr, i1 %arg2) {
60 ; CHECK-LABEL: @test3(
61 ; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
63 ; CHECK-NEXT: [[LOAD1:%.*]] = load i32, i32* [[PTR:%.*]], !range !1
64 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[LOAD1]], 999
65 ; CHECK-NEXT: ret i1 [[CMP1]]
67 ; CHECK-NEXT: [[LOAD2:%.*]] = load i32, i32* [[PTR]]
68 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i32 [[LOAD2]], 999
69 ; CHECK-NEXT: ret i1 [[CMP2]]
71 br i1 %arg2, label %bb1, label %bb2
74 %load1 = load i32, i32* %ptr, !range !1
75 %cmp1 = icmp ne i32 %load1, 999
79 %load2 = load i32, i32* %ptr
80 %cmp2 = icmp ne i32 %load2, 999
84 define i1 @test4(i32* %ptr, i1 %arg2) {
85 ; CHECK-LABEL: @test4(
86 ; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
88 ; CHECK-NEXT: [[LOAD1:%.*]] = load i32, i32* [[PTR:%.*]]
89 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[LOAD1]], 999
90 ; CHECK-NEXT: ret i1 [[CMP1]]
92 ; CHECK-NEXT: [[LOAD2:%.*]] = load i32, i32* [[PTR]], !range !1
93 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i32 [[LOAD2]], 999
94 ; CHECK-NEXT: ret i1 [[CMP2]]
96 br i1 %arg2, label %bb1, label %bb2
99 %load1 = load i32, i32* %ptr
100 %cmp1 = icmp ne i32 %load1, 999
104 %load2 = load i32, i32* %ptr, !range !1
105 %cmp2 = icmp ne i32 %load2, 999
109 define i1 @test5(i32* %ptr, i1 %arg2) {
110 ; CHECK-LABEL: @test5(
111 ; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
113 ; CHECK-NEXT: [[LOAD1:%.*]] = load i32, i32* [[PTR:%.*]], !range !1
114 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[LOAD1]], 999
115 ; CHECK-NEXT: ret i1 [[CMP1]]
117 ; CHECK-NEXT: [[LOAD2:%.*]] = load i32, i32* [[PTR]]
118 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[LOAD2]], 999
119 ; CHECK-NEXT: ret i1 [[CMP2]]
121 br i1 %arg2, label %bb1, label %bb2
124 %load1 = load i32, i32* %ptr, !range !1
125 %cmp1 = icmp slt i32 %load1, 999
129 %load2 = load i32, i32* %ptr
130 %cmp2 = icmp slt i32 %load2, 999
134 define i1 @test6(i32* %ptr, i1 %arg2) {
135 ; CHECK-LABEL: @test6(
136 ; CHECK-NEXT: br i1 [[ARG2:%.*]], label [[BB1:%.*]], label [[BB2:%.*]]
138 ; CHECK-NEXT: [[LOAD1:%.*]] = load i32, i32* [[PTR:%.*]]
139 ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[LOAD1]], 999
140 ; CHECK-NEXT: ret i1 [[CMP1]]
142 ; CHECK-NEXT: [[LOAD2:%.*]] = load i32, i32* [[PTR]], !range !1
143 ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[LOAD2]], 999
144 ; CHECK-NEXT: ret i1 [[CMP2]]
146 br i1 %arg2, label %bb1, label %bb2
149 %load1 = load i32, i32* %ptr
150 %cmp1 = icmp slt i32 %load1, 999
154 %load2 = load i32, i32* %ptr, !range !1
155 %cmp2 = icmp slt i32 %load2, 999
160 !1 = !{ i32 10, i32 20 }