1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -passes=instcombine -S < %s | FileCheck %s
4 define i64 @test_or(i64 %a) {
5 ; CHECK-LABEL: @test_or(
7 ; CHECK-NEXT: [[TMP0:%.*]] = or i64 [[A:%.*]], 15
8 ; CHECK-NEXT: br label [[LOOP:%.*]]
10 ; CHECK-NEXT: tail call void @use(i64 [[TMP0]])
11 ; CHECK-NEXT: br label [[LOOP]]
16 loop: ; preds = %loop, %entry
17 %iv = phi i64 [ %a, %entry ], [ %iv.next, %loop ]
18 %iv.next = or i64 %iv, 15
19 tail call void @use(i64 %iv.next)
24 define i64 @test_or2(i64 %a, i64 %b) {
25 ; CHECK-LABEL: @test_or2(
27 ; CHECK-NEXT: br label [[LOOP:%.*]]
29 ; CHECK-NEXT: [[IV_NEXT:%.*]] = or i64 [[A:%.*]], [[B:%.*]]
30 ; CHECK-NEXT: tail call void @use(i64 [[IV_NEXT]])
31 ; CHECK-NEXT: br label [[LOOP]]
36 loop: ; preds = %loop, %entry
37 %iv = phi i64 [ %a, %entry ], [ %iv.next, %loop ]
38 %iv.next = or i64 %iv, %b
39 tail call void @use(i64 %iv.next)
43 define i64 @test_or3(i64 %a, i64 %b) {
44 ; CHECK-LABEL: @test_or3(
46 ; CHECK-NEXT: br label [[LOOP:%.*]]
48 ; CHECK-NEXT: [[IV_NEXT:%.*]] = or i64 [[A:%.*]], [[B:%.*]]
49 ; CHECK-NEXT: tail call void @use(i64 [[IV_NEXT]])
50 ; CHECK-NEXT: br label [[LOOP]]
55 loop: ; preds = %loop, %entry
56 %iv = phi i64 [ %a, %entry ], [ %iv.next, %loop ]
57 %iv.next = or i64 %b, %iv
58 tail call void @use(i64 %iv.next)
62 define i64 @test_or4(i64 %a, ptr %p) {
63 ; CHECK-LABEL: @test_or4(
65 ; CHECK-NEXT: br label [[LOOP:%.*]]
67 ; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[A:%.*]], [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ]
68 ; CHECK-NEXT: [[STEP:%.*]] = load volatile i64, ptr [[P:%.*]], align 4
69 ; CHECK-NEXT: [[IV_NEXT]] = or i64 [[IV]], [[STEP]]
70 ; CHECK-NEXT: tail call void @use(i64 [[IV_NEXT]])
71 ; CHECK-NEXT: br label [[LOOP]]
76 loop: ; preds = %loop, %entry
77 %iv = phi i64 [ %a, %entry ], [ %iv.next, %loop ]
78 %step = load volatile i64, ptr %p
79 %iv.next = or i64 %iv, %step
80 tail call void @use(i64 %iv.next)
84 define i64 @test_and(i64 %a) {
85 ; CHECK-LABEL: @test_and(
87 ; CHECK-NEXT: [[TMP0:%.*]] = and i64 [[A:%.*]], 15
88 ; CHECK-NEXT: br label [[LOOP:%.*]]
90 ; CHECK-NEXT: tail call void @use(i64 [[TMP0]])
91 ; CHECK-NEXT: br label [[LOOP]]
96 loop: ; preds = %loop, %entry
97 %iv = phi i64 [ %a, %entry ], [ %iv.next, %loop ]
98 %iv.next = and i64 %iv, 15
99 tail call void @use(i64 %iv.next)
104 define i64 @test_and2(i64 %a, i64 %b) {
105 ; CHECK-LABEL: @test_and2(
107 ; CHECK-NEXT: br label [[LOOP:%.*]]
109 ; CHECK-NEXT: [[IV_NEXT:%.*]] = and i64 [[A:%.*]], [[B:%.*]]
110 ; CHECK-NEXT: tail call void @use(i64 [[IV_NEXT]])
111 ; CHECK-NEXT: br label [[LOOP]]
116 loop: ; preds = %loop, %entry
117 %iv = phi i64 [ %a, %entry ], [ %iv.next, %loop ]
118 %iv.next = and i64 %iv, %b
119 tail call void @use(i64 %iv.next)
123 define i64 @test_and3(i64 %a, i64 %b) {
124 ; CHECK-LABEL: @test_and3(
126 ; CHECK-NEXT: br label [[LOOP:%.*]]
128 ; CHECK-NEXT: [[IV_NEXT:%.*]] = and i64 [[A:%.*]], [[B:%.*]]
129 ; CHECK-NEXT: tail call void @use(i64 [[IV_NEXT]])
130 ; CHECK-NEXT: br label [[LOOP]]
135 loop: ; preds = %loop, %entry
136 %iv = phi i64 [ %a, %entry ], [ %iv.next, %loop ]
137 %iv.next = and i64 %b, %iv
138 tail call void @use(i64 %iv.next)
143 define i64 @test_and4(i64 %a, ptr %p) {
144 ; CHECK-LABEL: @test_and4(
146 ; CHECK-NEXT: br label [[LOOP:%.*]]
148 ; CHECK-NEXT: [[IV:%.*]] = phi i64 [ [[A:%.*]], [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[LOOP]] ]
149 ; CHECK-NEXT: [[STEP:%.*]] = load volatile i64, ptr [[P:%.*]], align 4
150 ; CHECK-NEXT: [[IV_NEXT]] = and i64 [[IV]], [[STEP]]
151 ; CHECK-NEXT: tail call void @use(i64 [[IV_NEXT]])
152 ; CHECK-NEXT: br label [[LOOP]]
157 loop: ; preds = %loop, %entry
158 %iv = phi i64 [ %a, %entry ], [ %iv.next, %loop ]
159 %step = load volatile i64, ptr %p
160 %iv.next = and i64 %iv, %step
161 tail call void @use(i64 %iv.next)
165 declare void @use(i64)