Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/Inline/simplification-in-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

42 lines
1.7 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -S -passes=inline < %s | FileCheck %s
; Make sure the loop condition is not incorrectly simplified during inlinig.
define internal i32 @pow(i32 %Base, i32 %Power) {
entry:
%IsZero = icmp eq i32 %Power, 0
br i1 %IsZero, label %while.end, label %while.body
while.body:
%Val = phi i32 [ %mul, %while.body ], [ 1, %entry ]
%Power.Phi = phi i32 [ %dec, %while.body ], [ %Power, %entry ]
%dec = add i32 %Power.Phi, -1
%mul = mul i32 %Val, %Base
%tobool.not = icmp eq i32 %dec, 0
br i1 %tobool.not, label %while.end, label %while.body
while.end:
%Res = phi i32 [ 1, %entry ], [ %mul, %while.body ]
ret i32 %Res
}
define i32 @caller(i32 %Base, i32 %Power) {
; CHECK-LABEL: define i32 @caller
; CHECK-SAME: (i32 [[BASE:%.*]], i32 [[POWER:%.*]]) {
; CHECK-NEXT: [[ISZERO_I:%.*]] = icmp eq i32 [[POWER]], 0
; CHECK-NEXT: br i1 [[ISZERO_I]], label [[POW_EXIT:%.*]], label [[WHILE_BODY_I:%.*]]
; CHECK: while.body.i:
; CHECK-NEXT: [[VAL_I:%.*]] = phi i32 [ [[MUL_I:%.*]], [[WHILE_BODY_I]] ], [ 1, [[TMP0:%.*]] ]
; CHECK-NEXT: [[POWER_PHI_I:%.*]] = phi i32 [ [[DEC_I:%.*]], [[WHILE_BODY_I]] ], [ [[POWER]], [[TMP0]] ]
; CHECK-NEXT: [[DEC_I]] = add i32 [[POWER_PHI_I]], -1
; CHECK-NEXT: [[MUL_I]] = mul i32 [[VAL_I]], [[BASE]]
; CHECK-NEXT: [[TOBOOL_NOT_I:%.*]] = icmp eq i32 [[DEC_I]], 0
; CHECK-NEXT: br i1 [[TOBOOL_NOT_I]], label [[POW_EXIT]], label [[WHILE_BODY_I]]
; CHECK: pow.exit:
; CHECK-NEXT: [[RES_I:%.*]] = phi i32 [ 1, [[TMP0]] ], [ [[MUL_I]], [[WHILE_BODY_I]] ]
; CHECK-NEXT: ret i32 [[RES_I]]
;
%res = call i32 @pow(i32 %Base, i32 %Power)
ret i32 %res
}