Files
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

76 lines
2.2 KiB
LLVM

; RUN: llc < %s -asm-verbose=false -verify-machineinstrs | FileCheck %s
;; Test that a small but nontrivial switch in a loop (like in a
;; bytecode interpreter) lowers reasonably without any irreducible
;; control flow being introduced.
target triple = "wasm32"
declare void @a(ptr)
declare void @b(ptr)
; CHECK-LABEL: switch_in_loop:
; CHECK-NEXT: .functype switch_in_loop (i32, i32) -> (i32)
; CHECK: global.get __stack_pointer
; CHECK: global.set __stack_pointer
; CHECK: block
; CHECK: br_if 0
; CHECK: .LBB0_2:
; CHECK: loop
; CHECK: block
; CHECK: block
; CHECK: block
; CHECK: br_table {0, 1, 2}
; CHECK: .LBB0_3:
; CHECK: end_block
; CHECK: call a
; CHECK: br 1
; CHECK: .LBB0_4:
; CHECK: end_block
; CHECK: call b
; CHECK: .LBB0_5:
; CHECK: end_block
; CHECK: br_if 0
; CHECK: end_loop
; CHECK: .LBB0_7:
; CHECK: end_block
; CHECK: global.set __stack_pointer
; CHECK: end_function
define i32 @switch_in_loop(ptr %ops, i32 %len) {
entry:
%res = alloca i32
store i32 0, ptr %res
%cmp6 = icmp sgt i32 %len, 0
br i1 %cmp6, label %for.body, label %for.cond.cleanup
for.cond.cleanup.loopexit: ; preds = %sw.epilog
%.pre = load i32, ptr %res
br label %for.cond.cleanup
for.cond.cleanup: ; preds = %for.cond.cleanup.loopexit, %entry
%0 = phi i32 [ %.pre, %for.cond.cleanup.loopexit ], [ 0, %entry ]
ret i32 %0
for.body: ; preds = %entry, %sw.epilog
%i.07 = phi i32 [ %inc, %sw.epilog ], [ 0, %entry ]
%arrayidx = getelementptr inbounds i32, ptr %ops, i32 %i.07
%1 = load i32, ptr %arrayidx
switch i32 %1, label %sw.epilog [
i32 0, label %sw.bb
i32 1, label %sw.bb1
]
sw.bb: ; preds = %for.body
call void @a(ptr nonnull %res)
br label %sw.epilog
sw.bb1: ; preds = %for.body
call void @b(ptr nonnull %res)
br label %sw.epilog
sw.epilog: ; preds = %for.body, %sw.bb1, %sw.bb
%inc = add nuw nsw i32 %i.07, 1
%exitcond = icmp eq i32 %inc, %len
br i1 %exitcond, label %for.cond.cleanup.loopexit, label %for.body
}