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
186 lines
7.2 KiB
LLVM
186 lines
7.2 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals --version 2
|
|
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
|
|
|
|
declare void @use(i32,...)
|
|
|
|
define i1 @both_sides_fold_slt(i32 %param, i1 %cond) {
|
|
; CHECK-LABEL: define i1 @both_sides_fold_slt
|
|
; CHECK-SAME: (i32 [[PARAM:%.*]], i1 [[COND:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: ret i1 false
|
|
;
|
|
entry:
|
|
%cond1 = select i1 %cond, i32 1, i32 %param
|
|
%cond6 = select i1 %cond, i32 9, i32 %param
|
|
%cmp = icmp slt i32 %cond6, %cond1
|
|
ret i1 %cmp
|
|
}
|
|
|
|
define i1 @both_sides_fold_eq(i32 %param, i1 %cond) {
|
|
; CHECK-LABEL: define i1 @both_sides_fold_eq
|
|
; CHECK-SAME: (i32 [[PARAM:%.*]], i1 [[COND:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[NOT_COND:%.*]] = xor i1 [[COND]], true
|
|
; CHECK-NEXT: ret i1 [[NOT_COND]]
|
|
;
|
|
entry:
|
|
%cond1 = select i1 %cond, i32 1, i32 %param
|
|
%cond6 = select i1 %cond, i32 9, i32 %param
|
|
%cmp = icmp eq i32 %cond6, %cond1
|
|
ret i1 %cmp
|
|
}
|
|
|
|
define i1 @one_side_fold_slt(i32 %val1, i32 %val2, i32 %param, i1 %cond) !prof !0 {
|
|
; CHECK-LABEL: define i1 @one_side_fold_slt
|
|
; CHECK-SAME: (i32 [[VAL1:%.*]], i32 [[VAL2:%.*]], i32 [[PARAM:%.*]], i1 [[COND:%.*]]) !prof [[PROF0:![0-9]+]] {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[TMP0:%.*]] = icmp slt i32 [[VAL2]], [[VAL1]]
|
|
; CHECK-NEXT: [[CMP:%.*]] = select i1 [[COND]], i1 [[TMP0]], i1 false, !prof [[PROF1:![0-9]+]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
entry:
|
|
%cond1 = select i1 %cond, i32 %val1, i32 %param, !prof !1
|
|
%cond6 = select i1 %cond, i32 %val2, i32 %param, !prof !1
|
|
%cmp = icmp slt i32 %cond6, %cond1
|
|
ret i1 %cmp
|
|
}
|
|
|
|
define i1 @one_side_fold_sgt(i32 %val1, i32 %val2, i32 %param, i1 %cond) !prof !0 {
|
|
; CHECK-LABEL: define i1 @one_side_fold_sgt
|
|
; CHECK-SAME: (i32 [[VAL1:%.*]], i32 [[VAL2:%.*]], i32 [[PARAM:%.*]], i1 [[COND:%.*]]) !prof [[PROF0]] {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[TMP0:%.*]] = icmp sgt i32 [[VAL2]], [[VAL1]]
|
|
; CHECK-NEXT: [[NOT_COND:%.*]] = xor i1 [[COND]], true
|
|
; CHECK-NEXT: [[CMP:%.*]] = select i1 [[NOT_COND]], i1 [[TMP0]], i1 false, !prof [[PROF2:![0-9]+]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
entry:
|
|
%cond1 = select i1 %cond, i32 %param, i32 %val1, !prof !1
|
|
%cond6 = select i1 %cond, i32 %param, i32 %val2, !prof !1
|
|
%cmp = icmp sgt i32 %cond6, %cond1
|
|
ret i1 %cmp
|
|
}
|
|
|
|
define i1 @one_side_fold_eq(i32 %val1, i32 %val2, i32 %param, i1 %cond) {
|
|
; CHECK-LABEL: define i1 @one_side_fold_eq
|
|
; CHECK-SAME: (i32 [[VAL1:%.*]], i32 [[VAL2:%.*]], i32 [[PARAM:%.*]], i1 [[COND:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[TMP0:%.*]] = icmp eq i32 [[VAL2]], [[VAL1]]
|
|
; CHECK-NEXT: [[NOT_COND:%.*]] = xor i1 [[COND]], true
|
|
; CHECK-NEXT: [[CMP:%.*]] = select i1 [[NOT_COND]], i1 true, i1 [[TMP0]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
entry:
|
|
%cond1 = select i1 %cond, i32 %val1, i32 %param
|
|
%cond6 = select i1 %cond, i32 %val2, i32 %param
|
|
%cmp = icmp eq i32 %cond6, %cond1
|
|
ret i1 %cmp
|
|
}
|
|
|
|
define i1 @no_side_fold_cond(i32 %val1, i32 %val2, i32 %param, i1 %cond1, i1 %cond2) {
|
|
; CHECK-LABEL: define i1 @no_side_fold_cond
|
|
; CHECK-SAME: (i32 [[VAL1:%.*]], i32 [[VAL2:%.*]], i32 [[PARAM:%.*]], i1 [[COND1:%.*]], i1 [[COND2:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[COND3:%.*]] = select i1 [[COND1]], i32 [[VAL1]], i32 [[PARAM]]
|
|
; CHECK-NEXT: [[COND6:%.*]] = select i1 [[COND2]], i32 [[VAL2]], i32 [[PARAM]]
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sle i32 [[COND6]], [[COND3]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
entry:
|
|
%cond3 = select i1 %cond1, i32 %val1, i32 %param
|
|
%cond6 = select i1 %cond2, i32 %val2, i32 %param
|
|
%cmp = icmp sle i32 %cond6, %cond3
|
|
ret i1 %cmp
|
|
}
|
|
|
|
define i1 @no_side_fold_op(i32 %val1, i32 %val2, i32 %val3, i1 %cond) {
|
|
; CHECK-LABEL: define i1 @no_side_fold_op
|
|
; CHECK-SAME: (i32 [[VAL1:%.*]], i32 [[VAL2:%.*]], i32 [[VAL3:%.*]], i1 [[COND:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[COND1:%.*]] = select i1 [[COND]], i32 [[VAL1]], i32 [[VAL2]]
|
|
; CHECK-NEXT: [[COND6:%.*]] = select i1 [[COND]], i32 [[VAL2]], i32 [[VAL3]]
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp sge i32 [[COND6]], [[COND1]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
entry:
|
|
%cond1 = select i1 %cond, i32 %val1, i32 %val2
|
|
%cond6 = select i1 %cond, i32 %val2, i32 %val3
|
|
%cmp = icmp sge i32 %cond6, %cond1
|
|
ret i1 %cmp
|
|
}
|
|
|
|
define i1 @one_select_mult_use(i32 %val1, i32 %val2, i32 %param, i1 %cond) {
|
|
; CHECK-LABEL: define i1 @one_select_mult_use
|
|
; CHECK-SAME: (i32 [[VAL1:%.*]], i32 [[VAL2:%.*]], i32 [[PARAM:%.*]], i1 [[COND:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[COND1:%.*]] = select i1 [[COND]], i32 [[VAL1]], i32 [[PARAM]]
|
|
; CHECK-NEXT: call void @use(i32 [[COND1]])
|
|
; CHECK-NEXT: [[TMP0:%.*]] = icmp slt i32 [[VAL2]], [[VAL1]]
|
|
; CHECK-NEXT: [[CMP:%.*]] = select i1 [[COND]], i1 [[TMP0]], i1 false
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
entry:
|
|
%cond1 = select i1 %cond, i32 %val1, i32 %param
|
|
%cond6 = select i1 %cond, i32 %val2, i32 %param
|
|
call void @use(i32 %cond1)
|
|
%cmp = icmp slt i32 %cond6, %cond1
|
|
ret i1 %cmp
|
|
}
|
|
|
|
define i1 @both_select_mult_use(i32 %val1, i32 %val2, i32 %param, i1 %cond) {
|
|
; CHECK-LABEL: define i1 @both_select_mult_use
|
|
; CHECK-SAME: (i32 [[VAL1:%.*]], i32 [[VAL2:%.*]], i32 [[PARAM:%.*]], i1 [[COND:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[COND1:%.*]] = select i1 [[COND]], i32 [[VAL1]], i32 [[PARAM]]
|
|
; CHECK-NEXT: [[COND6:%.*]] = select i1 [[COND]], i32 [[VAL2]], i32 [[PARAM]]
|
|
; CHECK-NEXT: call void @use(i32 [[COND1]], i32 [[COND6]])
|
|
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[COND6]], [[COND1]]
|
|
; CHECK-NEXT: ret i1 [[CMP]]
|
|
;
|
|
entry:
|
|
%cond1 = select i1 %cond, i32 %val1, i32 %param
|
|
%cond6 = select i1 %cond, i32 %val2, i32 %param
|
|
call void @use(i32 %cond1, i32 %cond6)
|
|
%cmp = icmp slt i32 %cond6, %cond1
|
|
ret i1 %cmp
|
|
}
|
|
|
|
define <4 x i1> @fold_vector_ops(<4 x i32> %val1, <4 x i32> %val2, <4 x i32> %param, i1 %cond) {
|
|
; CHECK-LABEL: define <4 x i1> @fold_vector_ops
|
|
; CHECK-SAME: (<4 x i32> [[VAL1:%.*]], <4 x i32> [[VAL2:%.*]], <4 x i32> [[PARAM:%.*]], i1 [[COND:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[TMP0:%.*]] = icmp eq <4 x i32> [[VAL2]], [[VAL1]]
|
|
; CHECK-NEXT: [[CMP:%.*]] = select i1 [[COND]], <4 x i1> [[TMP0]], <4 x i1> splat (i1 true)
|
|
; CHECK-NEXT: ret <4 x i1> [[CMP]]
|
|
;
|
|
entry:
|
|
%cond1 = select i1 %cond, <4 x i32> %val1, <4 x i32> %param
|
|
%cond6 = select i1 %cond, <4 x i32> %val2, <4 x i32> %param
|
|
%cmp = icmp eq <4 x i32> %cond6, %cond1
|
|
ret <4 x i1> %cmp
|
|
}
|
|
|
|
define <8 x i1> @fold_vector_cond_ops(<8 x i32> %val1, <8 x i32> %val2, <8 x i32> %param, <8 x i1> %cond) {
|
|
; CHECK-LABEL: define <8 x i1> @fold_vector_cond_ops
|
|
; CHECK-SAME: (<8 x i32> [[VAL1:%.*]], <8 x i32> [[VAL2:%.*]], <8 x i32> [[PARAM:%.*]], <8 x i1> [[COND:%.*]]) {
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: [[TMP0:%.*]] = icmp sgt <8 x i32> [[VAL2]], [[VAL1]]
|
|
; CHECK-NEXT: [[CMP:%.*]] = select <8 x i1> [[COND]], <8 x i1> [[TMP0]], <8 x i1> zeroinitializer
|
|
; CHECK-NEXT: ret <8 x i1> [[CMP]]
|
|
;
|
|
entry:
|
|
%cond1 = select <8 x i1> %cond, <8 x i32> %val1, <8 x i32> %param
|
|
%cond6 = select <8 x i1> %cond, <8 x i32> %val2, <8 x i32> %param
|
|
%cmp = icmp sgt <8 x i32> %cond6, %cond1
|
|
ret <8 x i1> %cmp
|
|
}
|
|
|
|
!0 = !{!"function_entry_count", i64 1000}
|
|
!1 = !{!"branch_weights", i32 2, i32 3}
|
|
|
|
;.
|
|
; CHECK: [[PROF0]] = !{!"function_entry_count", i64 1000}
|
|
; CHECK: [[PROF1]] = !{!"branch_weights", i32 2, i32 3}
|
|
; CHECK: [[PROF2]] = !{!"branch_weights", i32 3, i32 2}
|
|
;.
|