Skip to content

Commit b4b3dbf

Browse files
committed
[InstCombine] Add pre-commit tests [NFC]
1 parent cc3fd19 commit b4b3dbf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

llvm/test/Transforms/InstCombine/shift-logic.ll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,21 @@ define i8 @lshr_add(i8 %x, i8 %y) {
389389
ret i8 %sh1
390390
}
391391

392+
define i8 @lshr_add_multiuse(i8 %x) {
393+
; CHECK-LABEL: @lshr_add_multiuse(
394+
; CHECK-NEXT: [[SH0:%.*]] = lshr i8 [[X:%.*]], 3
395+
; CHECK-NEXT: [[R:%.*]] = add nuw nsw i8 [[SH0]], 42
396+
; CHECK-NEXT: call void @use(i8 [[SH0]])
397+
; CHECK-NEXT: [[SH1:%.*]] = lshr i8 [[R]], 2
398+
; CHECK-NEXT: ret i8 [[SH1]]
399+
;
400+
%sh0 = lshr i8 %x, 3
401+
%r = add i8 %sh0, 42 ; constant operand on the 'add'
402+
call void @use(i8 %sh0)
403+
%sh1 = lshr i8 %r, 2
404+
ret i8 %sh1
405+
}
406+
392407
define <2 x i8> @lshr_add_nonuniform(<2 x i8> %x, <2 x i8> %y) {
393408
; CHECK-LABEL: @lshr_add_nonuniform(
394409
; CHECK-NEXT: [[SH0:%.*]] = lshr <2 x i8> [[X:%.*]], <i8 3, i8 4>

0 commit comments

Comments
 (0)