================
@@ -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++)
----------------
damyanp wrote:

FWIW, DXC emits an error for this line: https://godbolt.org/z/5dT7o8fsh

Changing it to `unsigned int` makes it happy, but it seems neither compiler 
minds that `i` is uninitialized, which is interesting!

https://github.com/llvm/llvm-project/pull/106096
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to