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

50 lines
1.3 KiB
LLVM

; RUN: opt -S -passes=inline %s -debug-only=inline-cost 2>&1 | FileCheck %s
; REQUIRES: asserts
@a = global i32 4
; Only the load and ret should be included in the instruction count, not
; the instructions feeding the assume.
; CHECK: Analyzing call of inner...
; CHECK: NumInstructions: 2
define i32 @inner(ptr %y) {
%a1 = load volatile i32, ptr @a
; Because these instructions are used only by the @llvm.assume intrinsic,
; they're free and should not be included in the instruction count when
; computing the inline cost.
%a2 = mul i32 %a1, %a1
%a3 = sub i32 %a1, %a2
%a4 = udiv i32 %a3, -13
%a5 = mul i32 %a4, %a4
%a6 = add i32 %a5, %a5
%ca = icmp sgt i32 %a6, -7
%r = call i1 @llvm.type.test(ptr %y, metadata !0)
%ca2 = icmp eq i1 %ca, %r
tail call void @llvm.assume(i1 %ca2)
ret i32 %a1
}
; Only the ret should be included in the instruction count, the load and icmp
; are both ephemeral.
; CHECK: Analyzing call of inner2...
; CHECK: NumInstructions: 1
define void @inner2(ptr %y) {
%v = load i8, ptr %y
%c = icmp eq i8 %v, 42
call void @llvm.assume(i1 %c)
ret void
}
define i32 @outer(ptr %y) optsize {
%r = call i32 @inner(ptr %y)
call void @inner2(ptr %y)
ret i32 %r
}
declare void @llvm.assume(i1) nounwind
declare i1 @llvm.type.test(ptr, metadata) nounwind readnone
!0 = !{i32 0, !"typeid1"}