From e04abb54bc69d90a503852d60a89e8bac7b60ec8 Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 25 Oct 2023 12:21:35 -0700 Subject: Fix single iteration loop detection logic. (#3287) Co-authored-by: Yong He --- tests/ir/loop-unroll-simplify.slang | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tests/ir/loop-unroll-simplify.slang (limited to 'tests') diff --git a/tests/ir/loop-unroll-simplify.slang b/tests/ir/loop-unroll-simplify.slang new file mode 100644 index 000000000..f935b8b1e --- /dev/null +++ b/tests/ir/loop-unroll-simplify.slang @@ -0,0 +1,14 @@ +//TEST:SIMPLE(filecheck=CHECK): -entry main -target hlsl -profile cs_6_3 + +RWStructuredBuffer output; + +void main() +{ + // Test that the unrolled code does not have trivial single iteration loops. + // CHECK-NOT: break + [ForceUnroll] + for (int i = 0; i < 2; i++) + { + output[i] = i; + } +} -- cgit v1.2.3