llvm-project/llvm/test/CodeGen/AMDGPU/promote-alloca-pointer-array.ll
Matt Arsenault c5fe075eaf
AMDGPU: Use freeze poison instead of undef in alloca promotion (#131285)
Previously the value created to represent the uninitialized memory
of the alloca was undef. Use freeze poison instead. Enables some
optimization improvements (which need defeating in the limit tests),
but also a few regressions. Seems to leave behind dead code in some
cases too.
2025-03-18 17:27:02 +07:00

18 lines
685 B
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -mtriple=amdgcn-- -mcpu=fiji -data-layout=A5 -passes=amdgpu-promote-alloca < %s | FileCheck -check-prefix=OPT %s
define i64 @test_pointer_array(i64 %v) {
; OPT-LABEL: @test_pointer_array(
; OPT-NEXT: entry:
; OPT-NEXT: [[A:%.*]] = freeze <3 x ptr> poison
; OPT-NEXT: [[TMP0:%.*]] = inttoptr i64 [[V:%.*]] to ptr
; OPT-NEXT: [[TMP1:%.*]] = insertelement <3 x ptr> [[A]], ptr [[TMP0]], i32 0
; OPT-NEXT: ret i64 [[V]]
;
entry:
%a = alloca [3 x ptr], align 16, addrspace(5)
store i64 %v, ptr addrspace(5) %a, align 16
%ld = load i64, ptr addrspace(5) %a, align 16
ret i64 %ld
}