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
175 lines
3.9 KiB
LLVM
175 lines
3.9 KiB
LLVM
; RUN: opt -passes=early-cse -earlycse-debug-hash -S < %s | FileCheck %s
|
|
; RUN: opt -passes='early-cse<memssa>' -S < %s | FileCheck %s
|
|
; Same as GVN/edge.ll, but updated to reflect EarlyCSE's less powerful
|
|
; implementation. EarlyCSE currently doesn't exploit equality comparisons
|
|
; against constants.
|
|
|
|
define i32 @f1(i32 %x) {
|
|
; CHECK-LABEL: define i32 @f1(
|
|
bb0:
|
|
%cmp = icmp eq i32 %x, 0
|
|
br i1 %cmp, label %bb2, label %bb1
|
|
bb1:
|
|
br label %bb2
|
|
bb2:
|
|
%cond = phi i32 [ %x, %bb0 ], [ 0, %bb1 ]
|
|
%foo = add i32 %cond, %x
|
|
ret i32 %foo
|
|
; CHECK: bb2:
|
|
; CHECK: %cond = phi i32 [ %x, %bb0 ], [ 0, %bb1 ]
|
|
}
|
|
|
|
define i32 @f2(i32 %x) {
|
|
; CHECK-LABEL: define i32 @f2(
|
|
bb0:
|
|
%cmp = icmp ne i32 %x, 0
|
|
br i1 %cmp, label %bb1, label %bb2
|
|
bb1:
|
|
br label %bb2
|
|
bb2:
|
|
%cond = phi i32 [ %x, %bb0 ], [ 0, %bb1 ]
|
|
%foo = add i32 %cond, %x
|
|
ret i32 %foo
|
|
; CHECK: bb2:
|
|
; CHECK: %cond = phi i32 [ %x, %bb0 ], [ 0, %bb1 ]
|
|
}
|
|
|
|
define i32 @f3(i32 %x) {
|
|
; CHECK-LABEL: define i32 @f3(
|
|
bb0:
|
|
switch i32 %x, label %bb1 [ i32 0, label %bb2]
|
|
bb1:
|
|
br label %bb2
|
|
bb2:
|
|
%cond = phi i32 [ %x, %bb0 ], [ 0, %bb1 ]
|
|
%foo = add i32 %cond, %x
|
|
ret i32 %foo
|
|
; CHECK: bb2:
|
|
; CHECK: %cond = phi i32 [ %x, %bb0 ], [ 0, %bb1 ]
|
|
}
|
|
|
|
declare void @g(i1)
|
|
define void @f4(ptr %x) {
|
|
; CHECK-LABEL: define void @f4(
|
|
bb0:
|
|
%y = icmp eq ptr null, %x
|
|
br i1 %y, label %bb2, label %bb1
|
|
bb1:
|
|
br label %bb2
|
|
bb2:
|
|
%zed = icmp eq ptr null, %x
|
|
call void @g(i1 %zed)
|
|
; CHECK: call void @g(i1 %y)
|
|
ret void
|
|
}
|
|
|
|
define double @fcmp_oeq_not_zero(double %x, double %y) {
|
|
entry:
|
|
%cmp = fcmp oeq double %y, 2.0
|
|
br i1 %cmp, label %if, label %return
|
|
|
|
if:
|
|
%div = fdiv double %x, %y
|
|
br label %return
|
|
|
|
return:
|
|
%retval = phi double [ %div, %if ], [ %x, %entry ]
|
|
ret double %retval
|
|
|
|
; CHECK-LABEL: define double @fcmp_oeq_not_zero(
|
|
; CHECK: %div = fdiv double %x, %y
|
|
}
|
|
|
|
define double @fcmp_une_not_zero(double %x, double %y) {
|
|
entry:
|
|
%cmp = fcmp une double %y, 2.0
|
|
br i1 %cmp, label %return, label %else
|
|
|
|
else:
|
|
%div = fdiv double %x, %y
|
|
br label %return
|
|
|
|
return:
|
|
%retval = phi double [ %div, %else ], [ %x, %entry ]
|
|
ret double %retval
|
|
|
|
; CHECK-LABEL: define double @fcmp_une_not_zero(
|
|
; CHECK: %div = fdiv double %x, %y
|
|
}
|
|
|
|
; PR22376 - We can't propagate zero constants because -0.0
|
|
; compares equal to 0.0. If %y is -0.0 in this test case,
|
|
; we would produce the wrong sign on the infinity return value.
|
|
define double @fcmp_oeq_zero(double %x, double %y) {
|
|
entry:
|
|
%cmp = fcmp oeq double %y, 0.0
|
|
br i1 %cmp, label %if, label %return
|
|
|
|
if:
|
|
%div = fdiv double %x, %y
|
|
br label %return
|
|
|
|
return:
|
|
%retval = phi double [ %div, %if ], [ %x, %entry ]
|
|
ret double %retval
|
|
|
|
; CHECK-LABEL: define double @fcmp_oeq_zero(
|
|
; CHECK: %div = fdiv double %x, %y
|
|
}
|
|
|
|
define double @fcmp_une_zero(double %x, double %y) {
|
|
entry:
|
|
%cmp = fcmp une double %y, -0.0
|
|
br i1 %cmp, label %return, label %else
|
|
|
|
else:
|
|
%div = fdiv double %x, %y
|
|
br label %return
|
|
|
|
return:
|
|
%retval = phi double [ %div, %else ], [ %x, %entry ]
|
|
ret double %retval
|
|
|
|
; CHECK-LABEL: define double @fcmp_une_zero(
|
|
; CHECK: %div = fdiv double %x, %y
|
|
}
|
|
|
|
; We also cannot propagate a value if it's not a constant.
|
|
; This is because the value could be 0.0 or -0.0.
|
|
|
|
define double @fcmp_oeq_maybe_zero(double %x, double %y, double %z1, double %z2) {
|
|
entry:
|
|
%z = fadd double %z1, %z2
|
|
%cmp = fcmp oeq double %y, %z
|
|
br i1 %cmp, label %if, label %return
|
|
|
|
if:
|
|
%div = fdiv double %x, %z
|
|
br label %return
|
|
|
|
return:
|
|
%retval = phi double [ %div, %if ], [ %x, %entry ]
|
|
ret double %retval
|
|
|
|
; CHECK-LABEL: define double @fcmp_oeq_maybe_zero(
|
|
; CHECK: %div = fdiv double %x, %z
|
|
}
|
|
|
|
define double @fcmp_une_maybe_zero(double %x, double %y, double %z1, double %z2) {
|
|
entry:
|
|
%z = fadd double %z1, %z2
|
|
%cmp = fcmp une double %y, %z
|
|
br i1 %cmp, label %return, label %else
|
|
|
|
else:
|
|
%div = fdiv double %x, %z
|
|
br label %return
|
|
|
|
return:
|
|
%retval = phi double [ %div, %else ], [ %x, %entry ]
|
|
ret double %retval
|
|
|
|
; CHECK-LABEL: define double @fcmp_une_maybe_zero(
|
|
; CHECK: %div = fdiv double %x, %z
|
|
}
|