summaryrefslogtreecommitdiffstats
path: root/tests/language-feature/function-calls/forceinline-basic-block-inline-order.slang
diff options
context:
space:
mode:
authorMukund Keshava <mkeshava@nvidia.com>2025-05-11 02:29:37 +0530
committerGitHub <noreply@github.com>2025-05-10 20:59:37 +0000
commit083eecee3f56b90c7011895f53aaafa9db15856e (patch)
treea0a18f0905f2884374ee351713fe77af0843f679 /tests/language-feature/function-calls/forceinline-basic-block-inline-order.slang
parent48203ea02250ba517f749a222092f091d9bef15e (diff)
Add debug information for slang inling (#6621)
Diffstat (limited to 'tests/language-feature/function-calls/forceinline-basic-block-inline-order.slang')
-rw-r--r--tests/language-feature/function-calls/forceinline-basic-block-inline-order.slang39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/language-feature/function-calls/forceinline-basic-block-inline-order.slang b/tests/language-feature/function-calls/forceinline-basic-block-inline-order.slang
new file mode 100644
index 000000000..24bfd5dff
--- /dev/null
+++ b/tests/language-feature/function-calls/forceinline-basic-block-inline-order.slang
@@ -0,0 +1,39 @@
+//TEST:SIMPLE(filecheck=CHECK): -stage compute -entry computeMain -target spirv -O0 -g3
+RWStructuredBuffer<int> outputBuffer;
+
+// Test where outer function is inlined before the inner function.
+
+[ForceInline]
+int inlineSingleBasicBlock1(int value1, int value2)
+{
+ // Simple operation that should be inlined
+ return value1 * 2 + value2;
+}
+
+[__unsafeForceInlineEarly]
+int inlineSingleBasicBlock2(int value1, int value2)
+{
+ int result1 = inlineSingleBasicBlock1(10, 20);
+ // Simple operation that should be inlined
+ return value1 * 2 + value2 + result1;
+}
+
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int i = dispatchThreadID.x;
+
+ // Call the forceinline function
+ int result = inlineSingleBasicBlock2(16, 10);
+
+ outputBuffer[i] = result;
+}
+
+
+// CHECK-COUNT-2: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugInlinedAt %uint_{{[0-9]+}} %{{[0-9]+}}
+// CHECK-NOT: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugInlinedAt %uint_{{[0-9]+}} %{{[0-9]+}}
+// CHECK-COUNT-3: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugScope %{{[0-9]+}} %{{[0-9]+}}
+// CHECK-NOT: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugScope %{{[0-9]+}} %{{[0-9]+}}
+// CHECK-COUNT-1: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugNoScope
+// CHECK-NOT: %{{[0-9]+}} = OpExtInst %void %{{[0-9]+}} DebugNoScope \ No newline at end of file