llvm-project/llvm/test/CodeGen/DirectX/legalize-lifetimes-valver-1.5.ll
Deric C. e13cb3e299
[DirectX] Update lifetime legalization to account for the removed size argument (#152791)
Fixes #152754 

- Fixes the ArgOperand index in `DXILOpLowering.cpp` used to obtain the
pointer operand of a lifetime intrinsic.
- Updates the tests
`llvm/test/CodeGen/DirectX/legalize-lifetimes-valver-1.5.ll`,
`llvm/test/CodeGen/DirectX/legalize-lifetimes-valver-1.6.ll`,
`llvm/test/CodeGen/DirectX/ShaderFlags/lifetimes-noint64op.ll`, and
`llvm/test/tools/dxil-dis/lifetimes.ll` to use the new size-less
lifetime intrinsic
- Removes lifetime intrinsics from the test
`llvm/test/CodeGen/DirectX/legalize-memset.ll` to be consistent with the
corresponding memcpy test which does not have lifetime intrinsics.
(Removal of lifetime intrinsics from tests like this was suggested here
in the past:
https://github.com/llvm/llvm-project/pull/139173#discussion_r2091778868)
- Rewrites the lifetime legalization functions in the EmbedDXILPass to
re-add the explicit size argument for DXIL
2025-08-08 14:32:27 -07:00

23 lines
913 B
LLVM

; RUN: opt -S -passes='dxil-op-lower' -mtriple=dxil-pc-shadermodel6.3-library %s | FileCheck %s
; CHECK-LABEL: define void @test_legal_lifetime() {
; CHECK-NEXT: [[ACCUM_I_FLAT:%.*]] = alloca [1 x i32], align 4
; CHECK-NEXT: [[GEP:%.*]] = getelementptr i32, ptr [[ACCUM_I_FLAT]], i32 0
; CHECK-NEXT: store [1 x i32] zeroinitializer, ptr [[ACCUM_I_FLAT]], align 4
; CHECK-NEXT: store i32 0, ptr [[GEP]], align 4
; CHECK-NEXT: store [1 x i32] zeroinitializer, ptr [[ACCUM_I_FLAT]], align 4
; CHECK-NEXT: ret void
;
define void @test_legal_lifetime() {
%accum.i.flat = alloca [1 x i32], align 4
%gep = getelementptr i32, ptr %accum.i.flat, i32 0
call void @llvm.lifetime.start.p0(ptr nonnull %accum.i.flat)
store i32 0, ptr %gep, align 4
call void @llvm.lifetime.end.p0(ptr nonnull %accum.i.flat)
ret void
}
; Set the validator version to 1.5
!dx.valver = !{!0}
!0 = !{i32 1, i32 5}