Fix back-branch target for do-while loops.

To ensure back branches always go to a header block, create a header
block even for !testFirst loops.  Then unify common code between the
testFirst/!testFirst cases.

Generate the header-block code first, so update golden files.

Realize that certain infinite loops generate invalid SPIR-V, so put a
TODO to instead abort code generation in such cases.

Change-Id: I1e173c8f73daad186cfc666b7d72bd563ed7665d
This commit is contained in:
Dejan Mircevski
2016-01-11 15:57:11 -05:00
parent c8fbbab419
commit 832c65c33b
20 changed files with 2062 additions and 2029 deletions

View File

@@ -33,19 +33,19 @@ Linked vertex stage:
5: Label
8(i): 7(ptr) Variable Function
Store 8(i) 9
Branch 13
Branch 10
10: Label
18: 6(int) Load 8(i)
20: 6(int) IAdd 18 19
Store 8(i) 20
Branch 12
11: Label
Return
12: Label
Branch 13
13: Label
14: 6(int) Load 8(i)
17: 16(bool) SLessThan 14 15
LoopMerge 11 12 None
BranchConditional 17 10 11
FunctionEnd
LoopMerge 12 13 None
BranchConditional 17 11 12
11: Label
18: 6(int) Load 8(i)
20: 6(int) IAdd 18 19
Store 8(i) 20
Branch 13
12: Label
Return
13: Label
Branch 10
FunctionEnd