Skip to content

Commit 4f381af

Browse files
committed
[InstCombine] Add additional multi-use test for and/or replacement (NFC)
1 parent 4d12292 commit 4f381af

File tree

1 file changed

+17
-0
lines changed
  • llvm/test/Transforms/InstCombine

1 file changed

+17
-0
lines changed

llvm/test/Transforms/InstCombine/or.ll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,3 +1901,20 @@ define i32 @test_or_add_xor(i32 %a, i32 %b, i32 %c) {
19011901
%or = or i32 %add, %a
19021902
ret i32 %or
19031903
}
1904+
1905+
define i32 @test_or_and_and_multiuse(i32 %a, i32 %b, i32 %c) {
1906+
; CHECK-LABEL: @test_or_and_and_multiuse(
1907+
; CHECK-NEXT: [[AND1:%.*]] = and i32 [[A:%.*]], [[B:%.*]]
1908+
; CHECK-NEXT: [[AND2:%.*]] = and i32 [[AND1]], [[C:%.*]]
1909+
; CHECK-NEXT: call void @use(i32 [[AND1]])
1910+
; CHECK-NEXT: call void @use(i32 [[AND2]])
1911+
; CHECK-NEXT: [[OR:%.*]] = or i32 [[AND2]], [[A]]
1912+
; CHECK-NEXT: ret i32 [[OR]]
1913+
;
1914+
%and1 = and i32 %a, %b
1915+
%and2 = and i32 %and1, %c
1916+
call void @use(i32 %and1)
1917+
call void @use(i32 %and2)
1918+
%or = or i32 %and2, %a
1919+
ret i32 %or
1920+
}

0 commit comments

Comments
 (0)