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

Chris B via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 11 12:20:37 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
----------------
llvm-beanz wrote:

generally bitcasts are "free" in that they don't have any runtime implementation cost, and for lifetime markers which also have no runtime implementation cost, they're usually not a big deal. They do have some tiny cost on binary size, but I'd say this probably isn't worth fixing.

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


More information about the llvm-commits mailing list