[InstCombine] add test for limitation of knownbits with overshift; NFC

The tests above this were added for D30781 and used to provide
coverage for a limit of knownbits, but improvements in other
transforms killed that intended purpose. This was noted because
another proposed improvement in D117110 will further reduce
those tests.
This commit is contained in:
Sanjay Patel 2022-01-14 10:01:11 -05:00
parent 3bbf7f5ed8
commit f417f5f463
1 changed files with 27 additions and 0 deletions

View File

@ -99,6 +99,33 @@ block2:
ret i32 %conv2
}
; A limitation of knownbits with overshift prevents reducing to 'false'.
define i1 @knownbits_out_of_range_shift(i32 %x) {
; CHECK-LABEL: @knownbits_out_of_range_shift(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[BLOCK2:%.*]]
; CHECK: block1:
; CHECK-NEXT: br label [[BLOCK2]]
; CHECK: block2:
; CHECK-NEXT: [[P:%.*]] = phi i32 [ 63, [[ENTRY:%.*]] ], [ 31, [[BLOCK1:%.*]] ]
; CHECK-NEXT: [[L:%.*]] = lshr i32 [[X:%.*]], [[P]]
; CHECK-NEXT: [[R:%.*]] = icmp eq i32 [[L]], 2
; CHECK-NEXT: ret i1 [[R]]
;
entry:
br label %block2
block1:
br label %block2
block2:
%p = phi i32 [ 63, %entry ], [ 31, %block1 ]
%l = lshr i32 %x, %p
%r = icmp eq i32 %l, 2
ret i1 %r
}
; This should not end with more instructions than it started from.
define i32 @PR49475(i32 %x, i16 %y) {