summaryrefslogtreecommitdiffstats
path: root/tests/ir
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-05-09 09:44:33 -0700
committerGitHub <noreply@github.com>2023-05-09 09:44:33 -0700
commit38ed03a7203baacf36fca62539ac74fd45ed42d2 (patch)
tree9648daee25c0a2aaac2fa8cd7d91908fd2aeef2f /tests/ir
parent89a1234964a1927c4936a2758f72b7d6c9d0bc73 (diff)
Fix function side-effectness prop logic. (#2875)
Diffstat (limited to 'tests/ir')
-rw-r--r--tests/ir/dce-rw-buffer-load.slang21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ir/dce-rw-buffer-load.slang b/tests/ir/dce-rw-buffer-load.slang
new file mode 100644
index 000000000..01a14ee45
--- /dev/null
+++ b/tests/ir/dce-rw-buffer-load.slang
@@ -0,0 +1,21 @@
+//TEST:SIMPLE(filecheck=CHECK): -target hlsl -profile cs_5_0 -entry computeMain -line-directive-mode none
+
+// Test that we can DCE load of a rw buffer.
+
+RWStructuredBuffer<float> gOutputBuffer;
+
+float test()
+{
+ return gOutputBuffer[0];
+}
+
+[numthreads(1, 1, 1)]
+void computeMain(uint3 dispatchThreadID: SV_DispatchThreadID)
+{
+ test();
+}
+
+// CHECK: void computeMain
+// CHECK-NOT: test
+// CHECK: }
+