@@ -1440,14 +1440,12 @@ define i32 @and31_add_sexts(i1 %x, i1 %y) {
1440
1440
define i32 @lshr_add_use_sexts (i1 %x , i1 %y , ptr %p ) {
1441
1441
; CHECK-LABEL: @lshr_add_use_sexts(
1442
1442
; CHECK-NEXT: [[XS:%.*]] = sext i1 [[X:%.*]] to i32
1443
- ; CHECK-NEXT: store i32 [[XS]], ptr [[P:%.*]], align 4
1444
1443
; CHECK-NEXT: [[YS:%.*]] = sext i1 [[Y:%.*]] to i32
1445
1444
; CHECK-NEXT: [[SUB:%.*]] = add nsw i32 [[XS]], [[YS]]
1446
1445
; CHECK-NEXT: [[R:%.*]] = lshr i32 [[SUB]], 31
1447
1446
; CHECK-NEXT: ret i32 [[R]]
1448
1447
;
1449
1448
%xs = sext i1 %x to i32
1450
- store i32 %xs , ptr %p
1451
1449
%ys = sext i1 %y to i32
1452
1450
%sub = add i32 %xs , %ys
1453
1451
%r = lshr i32 %sub , 31
@@ -1456,6 +1454,23 @@ define i32 @lshr_add_use_sexts(i1 %x, i1 %y, ptr %p) {
1456
1454
1457
1455
; Negative test - extra use
1458
1456
1457
+ define i32 @lshr_add_use_sexts (i1 %x , i1 %y , ptr %p ) {
1458
+ ; CHECK-LABEL: @lshr_add_use_sexts(
1459
+ ; CHECK-NEXT: [[XS:%.*]] = sext i1 [[X:%.*]] to i32
1460
+ ; CHECK-NEXT: store i32 [[XS]], ptr [[P:%.*]], align 4
1461
+ ; CHECK-NEXT: [[YS:%.*]] = sext i1 [[Y:%.*]] to i32
1462
+ ; CHECK-NEXT: [[SUB:%.*]] = add nsw i32 [[XS]], [[YS]]
1463
+ ; CHECK-NEXT: [[R:%.*]] = lshr i32 [[SUB]], 31
1464
+ ; CHECK-NEXT: ret i32 [[R]]
1465
+ ;
1466
+ %xs = sext i1 %x to i32
1467
+ store i32 %xs , ptr %p
1468
+ %ys = sext i1 %y to i32
1469
+ %sub = add i32 %xs , %ys
1470
+ %r = lshr i32 %sub , 31
1471
+ ret i32 %r
1472
+ }
1473
+
1459
1474
define i32 @lshr_add_use2_sexts (i1 %x , i1 %y , ptr %p ) {
1460
1475
; CHECK-LABEL: @lshr_add_use2_sexts(
1461
1476
; CHECK-NEXT: [[XS:%.*]] = sext i1 [[X:%.*]] to i32
0 commit comments