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

58 lines
2.4 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt -S -passes=loop-fusion < %s | FileCheck %s
; The expected output keeps body1 and body2 as separate loops.
; body2 must execute only after body1 finishes so every store to %out
; uses the final value left in %ptr.
define void @fill(i32 %N, ptr %out) {
; CHECK-LABEL: define void @fill(
; CHECK-SAME: i32 [[N:%.*]], ptr [[OUT:%.*]]) {
; CHECK-NEXT: [[PRE1:.*]]:
; CHECK-NEXT: [[PTR:%.*]] = alloca i32, align 4
; CHECK-NEXT: br label %[[BODY1:.*]]
; CHECK: [[BODY1]]:
; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, %[[PRE1]] ], [ [[I_NEXT:%.*]], %[[BODY1]] ]
; CHECK-NEXT: store i32 [[I]], ptr [[PTR]], align 4
; CHECK-NEXT: [[I_NEXT]] = add i32 [[I]], 1
; CHECK-NEXT: [[COND_NOT:%.*]] = icmp eq i32 [[I_NEXT]], [[N]]
; CHECK-NEXT: br i1 [[COND_NOT]], label %[[BODY2_PREHEADER:.*]], label %[[BODY1]]
; CHECK: [[BODY2_PREHEADER]]:
; CHECK-NEXT: br label %[[BODY2:.*]]
; CHECK: [[BODY2]]:
; CHECK-NEXT: [[J:%.*]] = phi i32 [ [[J_NEXT:%.*]], %[[BODY2]] ], [ 0, %[[BODY2_PREHEADER]] ]
; CHECK-NEXT: [[VAL:%.*]] = load i32, ptr [[PTR]], align 4
; CHECK-NEXT: [[TMP0:%.*]] = sext i32 [[J]] to i64
; CHECK-NEXT: [[OUT_PTR:%.*]] = getelementptr [4 x i8], ptr [[OUT]], i64 [[TMP0]]
; CHECK-NEXT: store i32 [[VAL]], ptr [[OUT_PTR]], align 4
; CHECK-NEXT: [[J_NEXT]] = add i32 [[J]], 1
; CHECK-NEXT: [[COND2_NOT:%.*]] = icmp eq i32 [[J_NEXT]], [[N]]
; CHECK-NEXT: br i1 [[COND2_NOT]], label %[[EXIT:.*]], label %[[BODY2]]
; CHECK: [[EXIT]]:
; CHECK-NEXT: ret void
;
pre1:
%ptr = alloca i32, align 4
br label %body1
body1: ; preds = %body1, %pre1
%i = phi i32 [ 0, %pre1 ], [ %i_next, %body1 ]
store i32 %i, ptr %ptr, align 4
%i_next = add i32 %i, 1
%cond.not = icmp eq i32 %i_next, %N
br i1 %cond.not, label %body2, label %body1
body2: ; preds = %body2, %body1
%j = phi i32 [ %j_next, %body2 ], [ 0, %body1 ]
%val = load i32, ptr %ptr, align 4
%0 = sext i32 %j to i64
%out_ptr = getelementptr [4 x i8], ptr %out, i64 %0
store i32 %val, ptr %out_ptr, align 4
%j_next = add i32 %j, 1
%cond2.not = icmp eq i32 %j_next, %N
br i1 %cond2.not, label %exit, label %body2
exit: ; preds = %body2
ret void
}