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

81 lines
2.5 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt < %s -S -passes='simplifycfg<speculate-blocks>' | FileCheck %s --check-prefix=YES
; RUN: opt < %s -S -passes='simplifycfg<no-speculate-blocks>' | FileCheck %s --check-prefix=NO
define i32 @f(i1 %a) {
; YES-LABEL: define i32 @f
; YES-SAME: (i1 [[A:%.*]]) {
; YES-NEXT: entry:
; YES-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[A]], i32 5, i32 2
; YES-NEXT: ret i32 [[SPEC_SELECT]]
;
; NO-LABEL: define i32 @f
; NO-SAME: (i1 [[A:%.*]]) {
; NO-NEXT: entry:
; NO-NEXT: br i1 [[A]], label [[BB:%.*]], label [[BB2:%.*]]
; NO: bb:
; NO-NEXT: br label [[BB2]]
; NO: bb2:
; NO-NEXT: [[R:%.*]] = phi i32 [ 2, [[ENTRY:%.*]] ], [ 5, [[BB]] ]
; NO-NEXT: ret i32 [[R]]
;
entry:
br i1 %a, label %bb, label %bb2
bb:
br label %bb2
bb2:
%r = phi i32 [ 2, %entry ], [ 5, %bb ]
ret i32 %r
}
define void @fold_branch_to_common_dest(i8 %v0, i8 %v1) {
; YES-LABEL: define void @fold_branch_to_common_dest
; YES-SAME: (i8 [[V0:%.*]], i8 [[V1:%.*]]) {
; YES-NEXT: pred:
; YES-NEXT: [[C0:%.*]] = icmp eq i8 [[V0]], 0
; YES-NEXT: [[C1:%.*]] = icmp eq i8 [[V1]], 0
; YES-NEXT: [[OR_COND:%.*]] = select i1 [[C0]], i1 [[C1]], i1 false
; YES-NEXT: br i1 [[OR_COND]], label [[FINAL_LEFT:%.*]], label [[FINAL_RIGHT:%.*]]
; YES: common.ret:
; YES-NEXT: ret void
; YES: final_left:
; YES-NEXT: call void @sideeffect0()
; YES-NEXT: br label [[COMMON_RET:%.*]]
; YES: final_right:
; YES-NEXT: call void @sideeffect1()
; YES-NEXT: br label [[COMMON_RET]]
;
; NO-LABEL: define void @fold_branch_to_common_dest
; NO-SAME: (i8 [[V0:%.*]], i8 [[V1:%.*]]) {
; NO-NEXT: pred:
; NO-NEXT: [[C0:%.*]] = icmp eq i8 [[V0]], 0
; NO-NEXT: br i1 [[C0]], label [[DISPATCH:%.*]], label [[FINAL_RIGHT:%.*]]
; NO: dispatch:
; NO-NEXT: [[C1:%.*]] = icmp eq i8 [[V1]], 0
; NO-NEXT: br i1 [[C1]], label [[FINAL_LEFT:%.*]], label [[FINAL_RIGHT]]
; NO: common.ret:
; NO-NEXT: ret void
; NO: final_left:
; NO-NEXT: call void @sideeffect0()
; NO-NEXT: br label [[COMMON_RET:%.*]]
; NO: final_right:
; NO-NEXT: call void @sideeffect1()
; NO-NEXT: br label [[COMMON_RET]]
;
pred:
%c0 = icmp eq i8 %v0, 0
br i1 %c0, label %dispatch, label %final_right
dispatch:
%c1 = icmp eq i8 %v1, 0
br i1 %c1, label %final_left, label %final_right
final_left:
call void @sideeffect0()
ret void
final_right:
call void @sideeffect1()
ret void
}
declare void @sideeffect0()
declare void @sideeffect1()