Files
TheRock/compiler/amd-llvm/llvm/test/Transforms/ArgumentPromotion/opaque-ptr.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

101 lines
3.1 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --scrub-attributes
; RUN: opt -S -passes=argpromotion < %s | FileCheck %s
define internal i32 @callee_basic(ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@callee_basic
; CHECK-SAME: (i32 [[P_0_VAL:%.*]], i32 [[P_4_VAL:%.*]]) {
; CHECK-NEXT: [[Z:%.*]] = add i32 [[P_0_VAL]], [[P_4_VAL]]
; CHECK-NEXT: ret i32 [[Z]]
;
%x = load i32, ptr %p
%p1 = getelementptr i8, ptr %p, i64 4
%y = load i32, ptr %p1
%z = add i32 %x, %y
ret i32 %z
}
define void @caller_basic(ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@caller_basic
; CHECK-SAME: (ptr [[P:%.*]]) {
; CHECK-NEXT: [[P_VAL:%.*]] = load i32, ptr [[P]], align 4
; CHECK-NEXT: [[TMP1:%.*]] = getelementptr i8, ptr [[P]], i64 4
; CHECK-NEXT: [[P_VAL1:%.*]] = load i32, ptr [[TMP1]], align 4
; CHECK-NEXT: [[TMP2:%.*]] = call i32 @callee_basic(i32 [[P_VAL]], i32 [[P_VAL1]])
; CHECK-NEXT: ret void
;
call i32 @callee_basic(ptr %p)
ret void
}
; Same offset is loaded with two differen types: Don't promote.
define internal i32 @callee_different_types(ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@callee_different_types
; CHECK-SAME: (ptr [[P:%.*]]) {
; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P]], align 4
; CHECK-NEXT: [[Y_F:%.*]] = load float, ptr [[P]], align 4
; CHECK-NEXT: [[Y:%.*]] = fptoui float [[Y_F]] to i32
; CHECK-NEXT: [[Z:%.*]] = add i32 [[X]], [[Y]]
; CHECK-NEXT: ret i32 [[Z]]
;
%x = load i32, ptr %p
%y.f = load float, ptr %p
%y = fptoui float %y.f to i32
%z = add i32 %x, %y
ret i32 %z
}
define void @caller_different_types(ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@caller_different_types
; CHECK-SAME: (ptr [[P:%.*]]) {
; CHECK-NEXT: [[TMP1:%.*]] = call i32 @callee_different_types(ptr [[P]])
; CHECK-NEXT: ret void
;
call i32 @callee_different_types(ptr %p)
ret void
}
; The two loads overlap: Don't promote.
define internal i32 @callee_overlap(ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@callee_overlap
; CHECK-SAME: (ptr [[P:%.*]]) {
; CHECK-NEXT: [[X:%.*]] = load i32, ptr [[P]], align 4
; CHECK-NEXT: [[P1:%.*]] = getelementptr i8, ptr [[P]], i64 2
; CHECK-NEXT: [[Y:%.*]] = load i32, ptr [[P1]], align 4
; CHECK-NEXT: [[Z:%.*]] = add i32 [[X]], [[Y]]
; CHECK-NEXT: ret i32 [[Z]]
;
%x = load i32, ptr %p
%p1 = getelementptr i8, ptr %p, i64 2
%y = load i32, ptr %p1
%z = add i32 %x, %y
ret i32 %z
}
define void @caller_overlap(ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@caller_overlap
; CHECK-SAME: (ptr [[P:%.*]]) {
; CHECK-NEXT: [[TMP1:%.*]] = call i32 @callee_overlap(ptr [[P]])
; CHECK-NEXT: ret void
;
call i32 @callee_overlap(ptr %p)
ret void
}
; Don't promote calls with function type mismatch.
define void @caller_type_mismatch() {
; CHECK-LABEL: define {{[^@]+}}@caller_type_mismatch() {
; CHECK-NEXT: [[TMP1:%.*]] = call i32 @callee_type_mismatch(ptr null)
; CHECK-NEXT: ret void
;
call i32 @callee_type_mismatch(ptr null)
ret void
}
define internal void @callee_type_mismatch(ptr %p) {
; CHECK-LABEL: define {{[^@]+}}@callee_type_mismatch
; CHECK-SAME: (ptr [[P:%.*]]) {
; CHECK-NEXT: ret void
;
ret void
}