Skip to content

Commit d60bb01

Browse files
committed
[InstCombine] Pre-commit tests (NFC)
1 parent 9253ac2 commit d60bb01

File tree

1 file changed

+23
-6
lines changed
  • llvm/test/Transforms/InstCombine

1 file changed

+23
-6
lines changed

llvm/test/Transforms/InstCombine/add.ll

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,11 +1435,26 @@ define i32 @and31_add_sexts(i1 %x, i1 %y) {
14351435
ret i32 %r
14361436
}
14371437

1438-
; Negative test - extra use
1439-
14401438
define i32 @lshr_add_use_sexts(i1 %x, i1 %y, ptr %p) {
14411439
; CHECK-LABEL: @lshr_add_use_sexts(
14421440
; CHECK-NEXT: [[XS:%.*]] = sext i1 [[X:%.*]] to i32
1441+
; CHECK-NEXT: [[YS:%.*]] = sext i1 [[Y:%.*]] to i32
1442+
; CHECK-NEXT: store i32 [[YS]], ptr [[P:%.*]], align 4
1443+
; CHECK-NEXT: [[SUB:%.*]] = add nsw i32 [[XS]], [[YS]]
1444+
; CHECK-NEXT: [[R:%.*]] = lshr i32 [[SUB]], 31
1445+
; CHECK-NEXT: ret i32 [[R]]
1446+
;
1447+
%xs = sext i1 %x to i32
1448+
%ys = sext i1 %y to i32
1449+
store i32 %ys, ptr %p
1450+
%sub = add i32 %xs, %ys
1451+
%r = lshr i32 %sub, 31
1452+
ret i32 %r
1453+
}
1454+
1455+
define i32 @lshr_add_use_sexts_2(i1 %x, i1 %y, ptr %p) {
1456+
; CHECK-LABEL: @lshr_add_use_sexts_2(
1457+
; CHECK-NEXT: [[XS:%.*]] = sext i1 [[X:%.*]] to i32
14431458
; CHECK-NEXT: store i32 [[XS]], ptr [[P:%.*]], align 4
14441459
; CHECK-NEXT: [[YS:%.*]] = sext i1 [[Y:%.*]] to i32
14451460
; CHECK-NEXT: [[SUB:%.*]] = add nsw i32 [[XS]], [[YS]]
@@ -1456,18 +1471,20 @@ define i32 @lshr_add_use_sexts(i1 %x, i1 %y, ptr %p) {
14561471

14571472
; Negative test - extra use
14581473

1459-
define i32 @lshr_add_use2_sexts(i1 %x, i1 %y, ptr %p) {
1460-
; CHECK-LABEL: @lshr_add_use2_sexts(
1474+
declare void @use_sexts(i32, i32)
1475+
1476+
define i32 @lshr_add_use_sexts_both(i1 %x, i1 %y) {
1477+
; CHECK-LABEL: @lshr_add_use_sexts_both(
14611478
; CHECK-NEXT: [[XS:%.*]] = sext i1 [[X:%.*]] to i32
14621479
; CHECK-NEXT: [[YS:%.*]] = sext i1 [[Y:%.*]] to i32
1463-
; CHECK-NEXT: store i32 [[YS]], ptr [[P:%.*]], align 4
1480+
; CHECK-NEXT: call void @use_sexts(i32 [[XS]], i32 [[YS]])
14641481
; CHECK-NEXT: [[SUB:%.*]] = add nsw i32 [[XS]], [[YS]]
14651482
; CHECK-NEXT: [[R:%.*]] = lshr i32 [[SUB]], 31
14661483
; CHECK-NEXT: ret i32 [[R]]
14671484
;
14681485
%xs = sext i1 %x to i32
14691486
%ys = sext i1 %y to i32
1470-
store i32 %ys, ptr %p
1487+
call void @use_sexts(i32 %xs, i32 %ys)
14711488
%sub = add i32 %xs, %ys
14721489
%r = lshr i32 %sub, 31
14731490
ret i32 %r

0 commit comments

Comments
 (0)