[llvm] [DirectX] Legalize lifetime intrinsics for DXIL (PR #148003)

Finn Plummer via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 11 09:15:13 PDT 2025


================
@@ -15,6 +16,14 @@
 ; CHECK-SM66-NEXT:    store i32 0, ptr [[GEP]], align 4
 ; CHECK-SM66-NEXT:    call void @llvm.lifetime.end.p0(i64 4, ptr nonnull [[ACCUM_I_FLAT]])
 ; 
+; CHECK-PREPARE-NEXT:    [[ACCUM_I_FLAT:%.*]] = alloca [1 x i32], align 4
+; CHECK-PREPARE-NEXT:    [[GEP:%.*]] = getelementptr i32, ptr [[ACCUM_I_FLAT]], i32 0
+; CHECK-PREPARE-NEXT:    [[BITCAST:%.*]] = bitcast ptr [[ACCUM_I_FLAT]] to ptr
+; CHECK-PREPARE-NEXT:    call void @llvm.lifetime.start.p0(i64 4, ptr nonnull [[BITCAST]])
+; CHECK-PREPARE-NEXT:    store i32 0, ptr [[GEP]], align 4
+; CHECK-PREPARE-NEXT:    [[BITCAST:%.*]] = bitcast ptr [[ACCUM_I_FLAT]] to ptr
----------------
inbelic wrote:

Without adding too much complexity to the code, is it possible to re-use this for both lifetimes?

You might be able to just iterate the users of `PtrOperand` and detect a bitcast to set as the operand.

Happy to just be told no. But wanted to make we thought of it

https://github.com/llvm/llvm-project/pull/148003


More information about the llvm-commits mailing list