Skip to content

Commit 4b687cf

Browse files
committed
[InstCombine] Add pre-commit tests [NFC]
1 parent 1be0d9d commit 4b687cf

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,36 @@ define i8 @shl_add(i8 %x, i8 %y) {
346346
ret i8 %sh1
347347
}
348348

349+
define i8 @shl_add_multiuse(i8 %x) {
350+
; CHECK-LABEL: @shl_add_multiuse(
351+
; CHECK-NEXT: [[SH0:%.*]] = shl i8 [[X:%.*]], 3
352+
; CHECK-NEXT: [[R:%.*]] = add i8 [[SH0]], -42
353+
; CHECK-NEXT: call void @use(i8 [[SH0]])
354+
; CHECK-NEXT: [[SH1:%.*]] = shl i8 [[R]], 2
355+
; CHECK-NEXT: ret i8 [[SH1]]
356+
;
357+
%sh0 = shl i8 %x, 3
358+
%r = add i8 %sh0, -42
359+
call void @use(i8 %sh0)
360+
%sh1 = shl i8 %r, 2
361+
ret i8 %sh1
362+
}
363+
364+
define i8 @shl_add_multiuse_nonconstant(i8 %x, i8 %y) {
365+
; CHECK-LABEL: @shl_add_multiuse_nonconstant(
366+
; CHECK-NEXT: [[SH0:%.*]] = shl i8 [[X:%.*]], 3
367+
; CHECK-NEXT: [[R:%.*]] = add i8 [[SH0]], [[Y:%.*]]
368+
; CHECK-NEXT: call void @use(i8 [[SH0]])
369+
; CHECK-NEXT: [[SH1:%.*]] = shl i8 [[R]], 2
370+
; CHECK-NEXT: ret i8 [[SH1]]
371+
;
372+
%sh0 = shl i8 %x, 3
373+
%r = add i8 %sh0, %y
374+
call void @use(i8 %sh0)
375+
%sh1 = shl i8 %r, 2
376+
ret i8 %sh1
377+
}
378+
349379
define <2 x i8> @shl_add_nonuniform(<2 x i8> %x, <2 x i8> %y) {
350380
; CHECK-LABEL: @shl_add_nonuniform(
351381
; CHECK-NEXT: [[TMP1:%.*]] = shl <2 x i8> [[X:%.*]], <i8 5, i8 4>

0 commit comments

Comments
 (0)