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

105 lines
3.0 KiB
LLVM

; RUN: opt < %s -passes=partial-inliner -S -skip-partial-inlining-cost-analysis | FileCheck %s
@stat = external global i32, align 4
define i32 @vararg(i32 %count, ...) {
entry:
%vargs = alloca ptr, align 8
%stat1 = load i32, ptr @stat, align 4
%cmp = icmp slt i32 %stat1, 0
br i1 %cmp, label %bb2, label %bb1
bb1: ; preds = %entry
%vg1 = add nsw i32 %stat1, 1
store i32 %vg1, ptr @stat, align 4
call void @llvm.va_start(ptr %vargs)
%va1 = va_arg ptr %vargs, i32
call void @foo(i32 %count, i32 %va1) #2
call void @llvm.va_end(ptr %vargs)
br label %bb2
bb2: ; preds = %bb1, %entry
%res = phi i32 [ 1, %bb1 ], [ 0, %entry ]
ret i32 %res
}
declare void @foo(i32, i32)
declare void @llvm.va_start(ptr)
declare void @llvm.va_end(ptr)
define i32 @caller1(i32 %arg) {
bb:
%tmp = tail call i32 (i32, ...) @vararg(i32 %arg)
ret i32 %tmp
}
; CHECK-LABEL: @caller1
; CHECK: codeRepl.i:
; CHECK-NEXT: call void (i32, ptr, i32, ...) @vararg.3.bb1(i32 %stat1.i, ptr %vargs.i, i32 %arg)
define i32 @caller2(i32 %arg, float %arg2) {
bb:
%tmp = tail call i32 (i32, ...) @vararg(i32 %arg, i32 10, float %arg2)
ret i32 %tmp
}
; CHECK-LABEL: @caller2
; CHECK: codeRepl.i:
; CHECK-NEXT: call void (i32, ptr, i32, ...) @vararg.3.bb1(i32 %stat1.i, ptr %vargs.i, i32 %arg, i32 10, float %arg2)
; Test case to check that we do not extract a vararg function, if va_end is in
; a block that is not outlined.
define i32 @vararg_not_legal(i32 %count, ...) {
entry:
%vargs = alloca ptr, align 8
%stat1 = load i32, ptr @stat, align 4
%cmp = icmp slt i32 %stat1, 0
br i1 %cmp, label %bb2, label %bb1
bb1: ; preds = %entry
%vg1 = add nsw i32 %stat1, 1
store i32 %vg1, ptr @stat, align 4
call void @llvm.va_start(ptr %vargs)
%va1 = va_arg ptr %vargs, i32
call void @foo(i32 %count, i32 %va1)
br label %bb2
bb2: ; preds = %bb1, %entry
%res = phi i32 [ 1, %bb1 ], [ 0, %entry ]
%ptr = phi ptr [ %vargs, %bb1 ], [ %vargs, %entry]
call void @llvm.va_end(ptr %ptr)
ret i32 %res
}
; CHECK-LABEL: @caller3
; CHECK: tail call i32 (i32, ...) @vararg_not_legal(i32 %arg, i32 %arg)
define i32 @caller3(i32 %arg) {
bb:
%res = tail call i32 (i32, ...) @vararg_not_legal(i32 %arg, i32 %arg)
ret i32 %res
}
declare ptr @err(ptr)
define signext i32 @vararg2(ptr %l, ...) {
entry:
%c = load i1, ptr %l
br i1 %c, label %cleanup, label %cond.end
cond.end: ; preds = %entry
%call51 = call ptr @err(ptr nonnull %l)
unreachable
cleanup: ; preds = %entry
ret i32 0
}
define ptr @caller_with_signext(ptr %foo) {
entry:
%call1 = tail call signext i32 (ptr, ...) @vararg2(ptr %foo, i32 signext 8)
unreachable
}
; CHECK-LABEL: @caller_with_signext
; CHECK: codeRepl.i:
; CHECK-NEXT: call void (ptr, ...) @vararg2.1.cond.end(ptr %foo, i32 signext 8)