CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
126 lines
4.1 KiB
LLVM
126 lines
4.1 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt -passes=bdce -S < %s | FileCheck %s
|
|
|
|
; Funnel shift based rotate test cases from PR39771
|
|
|
|
declare i32 @llvm.fshr.i32(i32, i32, i32)
|
|
declare <2 x i32> @llvm.fshr.v2i32(<2 x i32>, <2 x i32>, <2 x i32>)
|
|
|
|
; First fshr operand is dead.
|
|
define i32 @pr39771_fshr_multi_use_instr(i32 %a) {
|
|
; CHECK-LABEL: @pr39771_fshr_multi_use_instr(
|
|
; CHECK-NEXT: [[X:%.*]] = or i32 [[A:%.*]], 2
|
|
; CHECK-NEXT: [[B:%.*]] = tail call i32 @llvm.fshr.i32(i32 0, i32 [[X]], i32 1)
|
|
; CHECK-NEXT: [[C:%.*]] = lshr i32 [[B]], 23
|
|
; CHECK-NEXT: [[D:%.*]] = xor i32 [[C]], [[B]]
|
|
; CHECK-NEXT: [[E:%.*]] = and i32 [[D]], 31
|
|
; CHECK-NEXT: ret i32 [[E]]
|
|
;
|
|
%x = or i32 %a, 2
|
|
%b = tail call i32 @llvm.fshr.i32(i32 %x, i32 %x, i32 1)
|
|
%c = lshr i32 %b, 23
|
|
%d = xor i32 %c, %b
|
|
%e = and i32 %d, 31
|
|
ret i32 %e
|
|
}
|
|
|
|
; First fshr operand is dead (vector variant).
|
|
define <2 x i32> @pr39771_fshr_multi_use_instr_vec(<2 x i32> %a) {
|
|
; CHECK-LABEL: @pr39771_fshr_multi_use_instr_vec(
|
|
; CHECK-NEXT: [[X:%.*]] = or <2 x i32> [[A:%.*]], splat (i32 2)
|
|
; CHECK-NEXT: [[B:%.*]] = tail call <2 x i32> @llvm.fshr.v2i32(<2 x i32> zeroinitializer, <2 x i32> [[X]], <2 x i32> splat (i32 1))
|
|
; CHECK-NEXT: [[C:%.*]] = lshr <2 x i32> [[B]], splat (i32 23)
|
|
; CHECK-NEXT: [[D:%.*]] = xor <2 x i32> [[C]], [[B]]
|
|
; CHECK-NEXT: [[E:%.*]] = and <2 x i32> [[D]], splat (i32 31)
|
|
; CHECK-NEXT: ret <2 x i32> [[E]]
|
|
;
|
|
%x = or <2 x i32> %a, <i32 2, i32 2>
|
|
%b = tail call <2 x i32> @llvm.fshr.v2i32(<2 x i32> %x, <2 x i32> %x, <2 x i32> <i32 1, i32 1>)
|
|
%c = lshr <2 x i32> %b, <i32 23, i32 23>
|
|
%d = xor <2 x i32> %c, %b
|
|
%e = and <2 x i32> %d, <i32 31, i32 31>
|
|
ret <2 x i32> %e
|
|
}
|
|
|
|
; First fshr operand is dead, but it comes from an argument, not instruction.
|
|
define i32 @pr39771_fshr_multi_use_arg(i32 %a) {
|
|
; CHECK-LABEL: @pr39771_fshr_multi_use_arg(
|
|
; CHECK-NEXT: [[B:%.*]] = tail call i32 @llvm.fshr.i32(i32 0, i32 [[A:%.*]], i32 1)
|
|
; CHECK-NEXT: [[C:%.*]] = lshr i32 [[B]], 23
|
|
; CHECK-NEXT: [[D:%.*]] = xor i32 [[C]], [[B]]
|
|
; CHECK-NEXT: [[E:%.*]] = and i32 [[D]], 31
|
|
; CHECK-NEXT: ret i32 [[E]]
|
|
;
|
|
%b = tail call i32 @llvm.fshr.i32(i32 %a, i32 %a, i32 1)
|
|
%c = lshr i32 %b, 23
|
|
%d = xor i32 %c, %b
|
|
%e = and i32 %d, 31
|
|
ret i32 %e
|
|
}
|
|
|
|
define i32 @pr39771_expanded_fshr_multi_use(i32 %a) {
|
|
; CHECK-LABEL: @pr39771_expanded_fshr_multi_use(
|
|
; CHECK-NEXT: [[TMP:%.*]] = lshr i32 [[A:%.*]], 1
|
|
; CHECK-NEXT: [[TMP2:%.*]] = shl i32 0, 31
|
|
; CHECK-NEXT: [[B:%.*]] = or i32 [[TMP]], [[TMP2]]
|
|
; CHECK-NEXT: [[C:%.*]] = lshr i32 [[B]], 23
|
|
; CHECK-NEXT: [[D:%.*]] = xor i32 [[C]], [[B]]
|
|
; CHECK-NEXT: [[E:%.*]] = and i32 [[D]], 31
|
|
; CHECK-NEXT: ret i32 [[E]]
|
|
;
|
|
%tmp = lshr i32 %a, 1
|
|
%tmp2 = shl i32 %a, 31
|
|
%b = or i32 %tmp, %tmp2
|
|
%c = lshr i32 %b, 23
|
|
%d = xor i32 %c, %b
|
|
%e = and i32 %d, 31
|
|
ret i32 %e
|
|
}
|
|
|
|
; %b operand of %c will be dead initially, but later found live.
|
|
define void @dead_use_invalidation(i32 %a) {
|
|
; CHECK-LABEL: @dead_use_invalidation(
|
|
; CHECK-NEXT: [[B:%.*]] = or i32 [[A:%.*]], 0
|
|
; CHECK-NEXT: [[C:%.*]] = shl i32 [[B]], 31
|
|
; CHECK-NEXT: [[D:%.*]] = and i32 [[C]], 1
|
|
; CHECK-NEXT: [[E:%.*]] = or i32 [[C]], 0
|
|
; CHECK-NEXT: [[F:%.*]] = or i32 [[D]], 0
|
|
; CHECK-NEXT: call void @dummy(i32 [[E]])
|
|
; CHECK-NEXT: call void @dummy(i32 [[F]])
|
|
; CHECK-NEXT: call void @dummy(i32 [[B]])
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
%b = or i32 %a, 0
|
|
%c = shl i32 %b, 31
|
|
%d = and i32 %c, 1
|
|
%e = or i32 %c, 0
|
|
%f = or i32 %d, 0
|
|
call void @dummy(i32 %e)
|
|
call void @dummy(i32 %f)
|
|
call void @dummy(i32 %b)
|
|
ret void
|
|
}
|
|
declare void @dummy(i32)
|
|
|
|
define i64 @deadcode_self_reference() {
|
|
; CHECK-LABEL: @deadcode_self_reference(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: ret i64 0
|
|
; CHECK: loop:
|
|
; CHECK-NEXT: [[OR:%.*]] = or i32 [[OR]], 0
|
|
; CHECK-NEXT: [[CONV:%.*]] = trunc i32 [[OR]] to i16
|
|
; CHECK-NEXT: [[CALL:%.*]] = call i16 @use(i16 [[CONV]])
|
|
; CHECK-NEXT: br label [[LOOP:%.*]]
|
|
;
|
|
entry:
|
|
ret i64 0
|
|
|
|
loop:
|
|
%or = or i32 %or, 0
|
|
%conv = trunc i32 %or to i16
|
|
%call = call i16 @use(i16 %conv)
|
|
br label %loop
|
|
}
|
|
|
|
declare void @use(i16)
|