Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/SimplifyCFG/dup-preds.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

109 lines
4.1 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -sink-common-insts -S | FileCheck %s -check-prefix=SIMPLIFY-CFG
define i8 @test_duplicate_preds_merging(i8 %v1, i8 %v2) {
; SIMPLIFY-CFG-LABEL: @test_duplicate_preds_merging(
; SIMPLIFY-CFG-NEXT: entry:
; SIMPLIFY-CFG-NEXT: switch i8 [[V1:%.*]], label [[EXIT:%.*]] [
; SIMPLIFY-CFG-NEXT: i8 0, label [[THEN:%.*]]
; SIMPLIFY-CFG-NEXT: i8 1, label [[ELSE:%.*]]
; SIMPLIFY-CFG-NEXT: ]
; SIMPLIFY-CFG: then:
; SIMPLIFY-CFG-NEXT: switch i8 [[V2:%.*]], label [[EXIT]] [
; SIMPLIFY-CFG-NEXT: i8 0, label [[ELSE]]
; SIMPLIFY-CFG-NEXT: i8 1, label [[SWITCH_CASE_1:%.*]]
; SIMPLIFY-CFG-NEXT: i8 2, label [[SWITCH_CASE_1]]
; SIMPLIFY-CFG-NEXT: ]
; SIMPLIFY-CFG: switch.case.1:
; SIMPLIFY-CFG-NEXT: br label [[EXIT]]
; SIMPLIFY-CFG: else:
; SIMPLIFY-CFG-NEXT: br label [[EXIT]]
; SIMPLIFY-CFG: exit:
; SIMPLIFY-CFG-NEXT: [[RET:%.*]] = phi i8 [ 0, [[ELSE]] ], [ 2, [[THEN]] ], [ 1, [[SWITCH_CASE_1]] ], [ 3, [[ENTRY:%.*]] ]
; SIMPLIFY-CFG-NEXT: ret i8 [[RET]]
;
entry:
switch i8 %v1, label %exit [
i8 0, label %then
i8 1, label %else
]
then: ; preds = %entry
switch i8 %v2, label %exit [
i8 0, label %switch.case.0
i8 1, label %switch.case.1
i8 2, label %switch.case.2
]
switch.case.0: ; preds = %then
br label %exit
switch.case.1: ; preds = %then
br label %exit
switch.case.2: ; preds = %then
br label %exit
else: ; preds = %entry
br label %exit
exit: ; preds = %else, %switch.case.2, %switch.case.1, %switch.case.0, %then, %entry
%ret = phi i8 [ 0, %else ], [ 0, %switch.case.0 ], [ 1, %switch.case.1 ], [ 1, %switch.case.2 ], [ 2, %then ], [ 3, %entry ]
ret i8 %ret
}
define i8 @test_no_merge_address_taken(i8 %v1, i8 %v2, ptr %p) {
; SIMPLIFY-CFG-LABEL: @test_no_merge_address_taken(
; SIMPLIFY-CFG-NEXT: entry:
; SIMPLIFY-CFG-NEXT: store ptr blockaddress(@test_no_merge_address_taken, [[SWITCH_CASE_0:%.*]]), ptr [[P:%.*]], align 8
; SIMPLIFY-CFG-NEXT: switch i8 [[V1:%.*]], label [[EXIT:%.*]] [
; SIMPLIFY-CFG-NEXT: i8 0, label [[THEN:%.*]]
; SIMPLIFY-CFG-NEXT: i8 1, label [[ELSE:%.*]]
; SIMPLIFY-CFG-NEXT: ]
; SIMPLIFY-CFG: then:
; SIMPLIFY-CFG-NEXT: switch i8 [[V2:%.*]], label [[EXIT]] [
; SIMPLIFY-CFG-NEXT: i8 0, label [[SWITCH_CASE_0]]
; SIMPLIFY-CFG-NEXT: i8 1, label [[SWITCH_CASE_1:%.*]]
; SIMPLIFY-CFG-NEXT: i8 2, label [[SWITCH_CASE_1]]
; SIMPLIFY-CFG-NEXT: ]
; SIMPLIFY-CFG: switch.case.0:
; SIMPLIFY-CFG-NEXT: br label [[EXIT]]
; SIMPLIFY-CFG: switch.case.1:
; SIMPLIFY-CFG-NEXT: br label [[EXIT]]
; SIMPLIFY-CFG: else:
; SIMPLIFY-CFG-NEXT: br label [[EXIT]]
; SIMPLIFY-CFG: exit:
; SIMPLIFY-CFG-NEXT: [[RET:%.*]] = phi i8 [ 0, [[ELSE]] ], [ 0, [[SWITCH_CASE_0]] ], [ 1, [[SWITCH_CASE_1]] ], [ 3, [[ENTRY:%.*]] ], [ 2, [[THEN]] ]
; SIMPLIFY-CFG-NEXT: ret i8 [[RET]]
;
entry:
store ptr blockaddress(@test_no_merge_address_taken, %switch.case.0), ptr %p
switch i8 %v1, label %exit [
i8 0, label %then
i8 1, label %else
]
then: ; preds = %entry
switch i8 %v2, label %exit [
i8 0, label %switch.case.0
i8 1, label %switch.case.1
i8 2, label %switch.case.2
]
switch.case.0: ; preds = %then
br label %exit
switch.case.1: ; preds = %then
br label %exit
switch.case.2: ; preds = %then
br label %exit
else: ; preds = %entry
br label %exit
exit: ; preds = %else, %switch.case.2, %switch.case.1, %switch.case.0, %then, %entry
%ret = phi i8 [ 0, %else ], [ 0, %switch.case.0 ], [ 1, %switch.case.1 ], [ 1, %switch.case.2 ], [ 2, %then ], [ 3, %entry ]
ret i8 %ret
}