[clang] [HLSL] Emit lifetime.start before copy-in for inout parameters (PR #191917)
Alexandre Isoard via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 14 10:19:30 PDT 2026
================
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -O3 -disable-llvm-passes -emit-llvm -finclude-default-header -o - %s | FileCheck %s
+
+// Check that lifetime.start for an inout argument temporary is emitted
+// *before* the copy-in store, so that the store is within the lifetime
+// and is not treated as undefined behavior.
+
+void increment(inout int I) { I += 1; }
+void reset(out int I) { I = 0; }
+
+// CHECK-LABEL: define noundef i32 {{.*}}inout_test
----------------
isoard-amd wrote:
Yes, I will do that. (by the way, `extern` functions aren't generated, I'm unsure if it is a bug or a feature)
https://github.com/llvm/llvm-project/pull/191917
More information about the cfe-commits
mailing list