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

70 lines
2.1 KiB
LLVM

; Check the optimizer doesn't crash at inlining the function top and all of its callees are inlined.
; RUN: opt < %s -O3 -S | FileCheck %s
define dso_local ptr @second(ptr %p) {
entry:
%p.addr = alloca ptr, align 8
store ptr %p, ptr %p.addr, align 8
%tmp = load ptr, ptr %p.addr, align 8
%tmp1 = load ptr, ptr %tmp, align 8
ret ptr %tmp1
}
define dso_local void @top() {
entry:
; CHECK: {{.*}} = {{.*}} call {{.*}} @ext
; CHECK-NOT: {{.*}} = {{.*}} call {{.*}} @third
; CHECK-NOT: {{.*}} = {{.*}} call {{.*}} @second
; CHECK-NOT: {{.*}} = {{.*}} call {{.*}} @wrapper
%q = alloca ptr, align 8
store ptr @third, ptr %q, align 8
%tmp = call ptr @second(ptr %q)
; The call to 'wrapper' here is to ensure that its function attributes
; i.e., returning its parameter and having no side effect, will be decuded
; before the next round of inlining happens to 'top' to expose the bug.
%call = call ptr @wrapper(ptr %tmp)
; The indirect call here is to confuse the alias analyzer so that
; an incomplete graph will be built during the first round of inlining.
; This allows the current function to be processed before the actual
; callee, i.e., the function 'run', is processed. Once it's simplified to
; a direct call, it also enables an additional round of inlining with all
; function attributes deduced.
call void (...) %call()
ret void
}
define dso_local ptr @gen() {
entry:
%call = call ptr (...) @ext()
ret ptr %call
}
declare dso_local ptr @ext(...)
define dso_local ptr @wrapper(ptr %fn) {
entry:
ret ptr %fn
}
define dso_local void @run(ptr %fn) {
entry:
%fn.addr = alloca ptr, align 8
%f = alloca ptr, align 8
store ptr %fn, ptr %fn.addr, align 8
%tmp = load ptr, ptr %fn.addr, align 8
%call = call ptr @wrapper(ptr %tmp)
store ptr %call, ptr %f, align 8
%tmp1 = load ptr, ptr %f, align 8
call void (...) %tmp1()
ret void
}
define dso_local void @third() {
entry:
%f = alloca ptr, align 8
%call = call ptr @gen()
store ptr %call, ptr %f, align 8
%tmp = load ptr, ptr %f, align 8
call void @run(ptr %tmp)
ret void
}