[clang] [DXIL] Don't generate per-variable guards for DirectX (PR #106096)
Greg Roth via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 27 08:51:00 PDT 2024
================
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -emit-llvm -o - -disable-llvm-passes %s | FileCheck %s
+
+// Verify that no per variable _Init_thread instructions are emitted for non-trivial static locals
+// These would normally be emitted by the MicrosoftCXXABI, but the DirectX backend should exlude them
+// Instead, check for the guardvar oparations that should protect the constructor initialization should
+// only take place once.
+
+RWBuffer<int> buf[10];
+
+void InitBuf(RWBuffer<int> buf) {
+ for (unsigned i; i < 100; i++)
----------------
pow2clk wrote:
Yeah. That's something I've been considering how to address. There are dozens of existing tests that use this same construction though. I think we should make DXC accept it as part of 202x or just out of band rather than forbid it in clang.
https://github.com/llvm/llvm-project/pull/106096
More information about the cfe-commits
mailing list