Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/NewGVN/phi-edge-handling.ll
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

174 lines
4.1 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=newgvn -S | FileCheck %s
;; Block 6 is reachable, but edge 6->4 is not
;; This means the phi value is undef, not 0
; Function Attrs: ssp uwtable
define i16 @hoge() {
; CHECK-LABEL: @hoge(
; CHECK-NEXT: bb:
; CHECK-NEXT: switch i8 undef, label [[BB7:%.*]] [
; CHECK-NEXT: i8 0, label [[BB1:%.*]]
; CHECK-NEXT: i8 12, label [[BB2:%.*]]
; CHECK-NEXT: ]
; CHECK: bb1:
; CHECK-NEXT: br label [[BB6:%.*]]
; CHECK: bb2:
; CHECK-NEXT: br label [[BB4:%.*]]
; CHECK: bb3:
; CHECK-NEXT: unreachable
; CHECK: bb4:
; CHECK-NEXT: ret i16 undef
; CHECK: bb6:
; CHECK-NEXT: br i1 true, label [[BB3:%.*]], label [[BB4]]
; CHECK: bb7:
; CHECK-NEXT: unreachable
;
bb:
switch i8 undef, label %bb7 [
i8 0, label %bb1
i8 12, label %bb2
]
bb1: ; preds = %bb
br label %bb6
bb2: ; preds = %bb
br label %bb4
bb3: ; preds = %bb6
unreachable
bb4: ; preds = %bb6, %bb2
%tmp = phi i16 [ 0, %bb6 ], [ undef, %bb2 ]
ret i16 %tmp
bb6: ; preds = %bb4
br i1 true, label %bb3, label %bb4
bb7: ; preds = %bb
unreachable
}
define i8 @only_undef(i1 %cond) {
; CHECK-LABEL: @only_undef(
; CHECK-NEXT: br i1 [[COND:%.*]], label [[A:%.*]], label [[B:%.*]]
; CHECK: A:
; CHECK-NEXT: br label [[EXIT:%.*]]
; CHECK: B:
; CHECK-NEXT: br label [[EXIT]]
; CHECK: EXIT:
; CHECK-NEXT: ret i8 undef
;
br i1 %cond, label %A, label %B
A:
br label %EXIT
B:
br label %EXIT
EXIT:
%r = phi i8 [undef, %A], [undef, %B]
ret i8 %r
}
define i8 @only_poison(i1 %cond) {
; CHECK-LABEL: @only_poison(
; CHECK-NEXT: br i1 [[COND:%.*]], label [[A:%.*]], label [[B:%.*]]
; CHECK: A:
; CHECK-NEXT: br label [[EXIT:%.*]]
; CHECK: B:
; CHECK-NEXT: br label [[EXIT]]
; CHECK: EXIT:
; CHECK-NEXT: ret i8 poison
;
br i1 %cond, label %A, label %B
A:
br label %EXIT
B:
br label %EXIT
EXIT:
%r = phi i8 [poison, %A], [poison, %B]
ret i8 %r
}
define i8 @undef_poison(i1 %cond) {
; CHECK-LABEL: @undef_poison(
; CHECK-NEXT: br i1 [[COND:%.*]], label [[A:%.*]], label [[B:%.*]]
; CHECK: A:
; CHECK-NEXT: br label [[EXIT:%.*]]
; CHECK: B:
; CHECK-NEXT: br label [[EXIT]]
; CHECK: EXIT:
; CHECK-NEXT: ret i8 undef
;
br i1 %cond, label %A, label %B
A:
br label %EXIT
B:
br label %EXIT
EXIT:
%r = phi i8 [undef, %A], [poison, %B]
ret i8 %r
}
define i8 @value_undef(i1 %cond, i8 %v) {
; CHECK-LABEL: @value_undef(
; CHECK-NEXT: br i1 [[COND:%.*]], label [[A:%.*]], label [[B:%.*]]
; CHECK: A:
; CHECK-NEXT: br label [[EXIT:%.*]]
; CHECK: B:
; CHECK-NEXT: br label [[EXIT]]
; CHECK: EXIT:
; CHECK-NEXT: [[R:%.*]] = phi i8 [ undef, [[A]] ], [ [[V:%.*]], [[B]] ]
; CHECK-NEXT: ret i8 [[R]]
;
br i1 %cond, label %A, label %B
A:
br label %EXIT
B:
br label %EXIT
EXIT:
%r = phi i8 [undef, %A], [%v, %B]
ret i8 %r
}
define i8 @value_undef_noundef(i1 %cond, i8 noundef %v) {
; CHECK-LABEL: @value_undef_noundef(
; CHECK-NEXT: br i1 [[COND:%.*]], label [[A:%.*]], label [[B:%.*]]
; CHECK: A:
; CHECK-NEXT: br label [[EXIT:%.*]]
; CHECK: B:
; CHECK-NEXT: br label [[EXIT]]
; CHECK: EXIT:
; CHECK-NEXT: ret i8 [[V:%.*]]
;
br i1 %cond, label %A, label %B
A:
br label %EXIT
B:
br label %EXIT
EXIT:
%r = phi i8 [undef, %A], [%v, %B]
ret i8 %r
}
define i8 @value_poison(i1 %cond, i8 %v) {
; CHECK-LABEL: @value_poison(
; CHECK-NEXT: br i1 [[COND:%.*]], label [[A:%.*]], label [[B:%.*]]
; CHECK: A:
; CHECK-NEXT: br label [[EXIT:%.*]]
; CHECK: B:
; CHECK-NEXT: br label [[EXIT]]
; CHECK: EXIT:
; CHECK-NEXT: ret i8 [[V:%.*]]
;
br i1 %cond, label %A, label %B
A:
br label %EXIT
B:
br label %EXIT
EXIT:
%r = phi i8 [poison, %A], [%v, %B]
ret i8 %r
}