From eb3970897049269602cc18cee644e437c0aff928 Mon Sep 17 00:00:00 2001 From: Yong He Date: Tue, 7 May 2024 21:50:41 -0700 Subject: Make sure pointer local vars have `AliasedPointer` decoration. (#4132) --- tests/bugs/gh-4111.slang | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/bugs/gh-4111.slang (limited to 'tests') diff --git a/tests/bugs/gh-4111.slang b/tests/bugs/gh-4111.slang new file mode 100644 index 000000000..66d565d9f --- /dev/null +++ b/tests/bugs/gh-4111.slang @@ -0,0 +1,31 @@ +//TEST:SIMPLE(filecheck=CHECK): -target spirv + +// Check that a pointer typed local variable has `AliasedPointer` decoration. + +// CHECK: OpDecorate %b AliasedPointer +struct Buf +{ + uint test; +}; + +struct Push +{ + bool a_or_b; + Buf * a; + Buf * b; +}; + +[[vk::push_constant]] Push push; + +func tester(Buf * buf) +{ + buf->test = 1; +} + +[shader("compute")] +[numthreads(1, 1, 1)] +void main() +{ + Buf * b = push.a_or_b ? push.a : push.b; + tester(b); +} \ No newline at end of file -- cgit v1.2.3