Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/SimplifyCFG/2025-07-29-non-canoncial-loop.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

63 lines
2.7 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 --keep-loops="true" -S | FileCheck --check-prefix=NO-THREADING %s
; Checks that we do not thread the control flow through the loop header loop_header as
; that will introduce a non-canonical loop.
; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 --keep-loops="false" -S | FileCheck --check-prefix=THREADING %s
; Checks that we thread the control flow through the loop header loop_header since we
; do not request --keep-loops.
define void @__start(i1 %cond) {
; NO-THREADING-LABEL: define void @__start(
; NO-THREADING-SAME: i1 [[COND:%.*]]) {
; NO-THREADING-NEXT: [[ENTRY:.*:]]
; NO-THREADING-NEXT: br label %[[LOOP_HEADER:.*]]
; NO-THREADING: [[LOOP_HEADER]]:
; NO-THREADING-NEXT: br i1 [[COND]], label %[[LOOP_BODY_1:.*]], label %[[LOOP_BODY_0:.*]]
; NO-THREADING: [[LOOP_BODY_0]]:
; NO-THREADING-NEXT: [[_0_:%.*]] = add i16 0, 0
; NO-THREADING-NEXT: br label %[[LOOP_EXIT:.*]]
; NO-THREADING: [[LOOP_BODY_1]]:
; NO-THREADING-NEXT: [[_1_:%.*]] = add i32 0, 1
; NO-THREADING-NEXT: br label %[[LOOP_EXIT]]
; NO-THREADING: [[LOOP_EXIT]]:
; NO-THREADING-NEXT: br i1 [[COND]], label %[[LOOP_HEADER]], label %[[EXIT:.*]]
; NO-THREADING: [[EXIT]]:
; NO-THREADING-NEXT: ret void
;
; THREADING-LABEL: define void @__start(
; THREADING-SAME: i1 [[COND:%.*]]) {
; THREADING-NEXT: [[ENTRY:.*:]]
; THREADING-NEXT: br i1 [[COND]], label %[[LOOP_BODY_1:.*]], label %[[LOOP_BODY_0:.*]]
; THREADING: [[LOOP_BODY_0]]:
; THREADING-NEXT: [[_0_:%.*]] = add i16 0, 0
; THREADING-NEXT: br label %[[LOOP_EXIT:.*]]
; THREADING: [[LOOP_BODY_1]]:
; THREADING-NEXT: [[_1_:%.*]] = add i32 0, 1
; THREADING-NEXT: br label %[[LOOP_EXIT]]
; THREADING: [[LOOP_EXIT]]:
; THREADING-NEXT: br i1 [[COND]], label %[[LOOP_BODY_1]], label %[[EXIT:.*]]
; THREADING: [[EXIT]]:
; THREADING-NEXT: ret void
;
entry:
br label %loop_header
loop_header: ; preds = %loop_exit, %entry
br i1 %cond, label %loop_body_1, label %loop_body_0
loop_body_0: ; preds = %loop_header
%_0_ = add i16 0, 0
br label %loop_exit
loop_body_1: ; preds = %loop_header
%_1_ = add i32 0, 1
br label %loop_exit
loop_exit: ; preds = %loop_body_1, %loop_body_0
br i1 %cond, label %loop_header, label %exit
exit: ; preds = %loop_exit
ret void
}