Split loop header from condition testing for for/while loops.
diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 71127c7..9d42e3c 100755
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -1391,12 +1391,22 @@
 {
     auto blocks = builder.makeNewLoop();
     builder.createBranch(&blocks.head);
+    // Spec requires back edges to target header blocks, and every header block
+    // must dominate its merge block.  Make a header block first to ensure these
+    // conditions are met.  By definition, it will contain OpLoopMerge, followed
+    // by a block-ending branch.  But we don't want to put any other body/test
+    // instructions in it, since the body/test may have arbitrary instructions,
+    // including merges of its own.
+    builder.setBuildPoint(&blocks.head);
+    builder.createLoopMerge(&blocks.merge, &blocks.continue_target, spv::LoopControlMaskNone);
     if (node->testFirst() && node->getTest()) {
-        builder.setBuildPoint(&blocks.head);
+        spv::Block& test = builder.makeNewBlock();
+        builder.createBranch(&test);
+
+        builder.setBuildPoint(&test);
         node->getTest()->traverse(this);
         spv::Id condition =
             builder.accessChainLoad(convertGlslangToSpvType(node->getTest()->getType()));
-        builder.createLoopMerge(&blocks.merge, &blocks.continue_target, spv::LoopControlMaskNone);
         builder.createConditionalBranch(condition, &blocks.body, &blocks.merge);
 
         builder.setBuildPoint(&blocks.body);
@@ -1411,14 +1421,6 @@
             node->getTerminal()->traverse(this);
         builder.createBranch(&blocks.head);
     } else {
-        // Spec requires back edges to target header blocks, and every header
-        // block must dominate its merge block.  Make a header block first to
-        // ensure these conditions are met.  By definition, it will contain
-        // OpLoopMerge, followed by a block-ending branch.  But we don't want to
-        // put any other body instructions in it, since the body may have
-        // arbitrary instructions, including merges of its own.
-        builder.setBuildPoint(&blocks.head);
-        builder.createLoopMerge(&blocks.merge, &blocks.continue_target, spv::LoopControlMaskNone);
         builder.createBranch(&blocks.body);
 
         breakForLoop.push(true);
diff --git a/Test/baseResults/spv.dataOutIndirect.vert.out b/Test/baseResults/spv.dataOutIndirect.vert.out
index 08c07a9..62da85f 100755
--- a/Test/baseResults/spv.dataOutIndirect.vert.out
+++ b/Test/baseResults/spv.dataOutIndirect.vert.out
@@ -8,66 +8,68 @@
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 39
+// Id's are bound by 40
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 24 27 33 38
+                              EntryPoint Vertex 4  "main" 25 28 34 39
                               Source GLSL 130
                               Name 4  "main"
                               Name 8  "i"
-                              Name 24  "colorOut"
-                              Name 27  "color"
-                              Name 33  "gl_Position"
-                              Name 38  "gl_VertexID"
-                              Decorate 33(gl_Position) BuiltIn Position
-                              Decorate 38(gl_VertexID) BuiltIn VertexId
+                              Name 25  "colorOut"
+                              Name 28  "color"
+                              Name 34  "gl_Position"
+                              Name 39  "gl_VertexID"
+                              Decorate 34(gl_Position) BuiltIn Position
+                              Decorate 39(gl_VertexID) BuiltIn VertexId
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1
                7:             TypePointer Function 6(int)
                9:      6(int) Constant 1
-              15:      6(int) Constant 5
-              16:             TypeBool
-              18:             TypeFloat 32
-              19:             TypeVector 18(float) 4
-              20:             TypeInt 32 0
-              21:     20(int) Constant 6
-              22:             TypeArray 19(fvec4) 21
-              23:             TypePointer Output 22
-    24(colorOut):     23(ptr) Variable Output
-              26:             TypePointer Input 19(fvec4)
-       27(color):     26(ptr) Variable Input
-              29:             TypePointer Output 19(fvec4)
- 33(gl_Position):     29(ptr) Variable Output
-              34:      6(int) Constant 2
-              37:             TypePointer Input 6(int)
- 38(gl_VertexID):     37(ptr) Variable Input
+              16:      6(int) Constant 5
+              17:             TypeBool
+              19:             TypeFloat 32
+              20:             TypeVector 19(float) 4
+              21:             TypeInt 32 0
+              22:     21(int) Constant 6
+              23:             TypeArray 20(fvec4) 22
+              24:             TypePointer Output 23
+    25(colorOut):     24(ptr) Variable Output
+              27:             TypePointer Input 20(fvec4)
+       28(color):     27(ptr) Variable Input
+              30:             TypePointer Output 20(fvec4)
+ 34(gl_Position):     30(ptr) Variable Output
+              35:      6(int) Constant 2
+              38:             TypePointer Input 6(int)
+ 39(gl_VertexID):     38(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
             8(i):      7(ptr) Variable Function
                               Store 8(i) 9
                               Branch 10
               10:             Label
-              14:      6(int) Load 8(i)
-              17:    16(bool) SLessThan 14 15
                               LoopMerge 12 13 None
-                              BranchConditional 17 11 12
+                              Branch 14
+              14:             Label
+              15:      6(int) Load 8(i)
+              18:    17(bool) SLessThan 15 16
+                              BranchConditional 18 11 12
               11:               Label
-              25:      6(int)   Load 8(i)
-              28:   19(fvec4)   Load 27(color)
-              30:     29(ptr)   AccessChain 24(colorOut) 25
-                                Store 30 28
+              26:      6(int)   Load 8(i)
+              29:   20(fvec4)   Load 28(color)
+              31:     30(ptr)   AccessChain 25(colorOut) 26
+                                Store 31 29
                                 Branch 13
               13:               Label
-              31:      6(int)   Load 8(i)
-              32:      6(int)   IAdd 31 9
-                                Store 8(i) 32
+              32:      6(int)   Load 8(i)
+              33:      6(int)   IAdd 32 9
+                                Store 8(i) 33
                                 Branch 10
               12:             Label
-              35:     29(ptr) AccessChain 24(colorOut) 34
-              36:   19(fvec4) Load 35
-                              Store 33(gl_Position) 36
+              36:     30(ptr) AccessChain 25(colorOut) 35
+              37:   20(fvec4) Load 36
+                              Store 34(gl_Position) 37
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/spv.for-continue-break.vert.out b/Test/baseResults/spv.for-continue-break.vert.out
index 33c6138..608ec66 100644
--- a/Test/baseResults/spv.for-continue-break.vert.out
+++ b/Test/baseResults/spv.for-continue-break.vert.out
@@ -5,86 +5,88 @@
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 47
+// Id's are bound by 48
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 45 46
+                              EntryPoint Vertex 4  "main" 46 47
                               Source ESSL 300
                               Name 4  "main"
                               Name 8  "i"
-                              Name 18  "A"
-                              Name 26  "B"
-                              Name 28  "C"
-                              Name 35  "D"
-                              Name 37  "E"
-                              Name 38  "F"
-                              Name 42  "G"
-                              Name 45  "gl_VertexID"
-                              Name 46  "gl_InstanceID"
-                              Decorate 45(gl_VertexID) BuiltIn VertexId
-                              Decorate 46(gl_InstanceID) BuiltIn InstanceId
+                              Name 19  "A"
+                              Name 27  "B"
+                              Name 29  "C"
+                              Name 36  "D"
+                              Name 38  "E"
+                              Name 39  "F"
+                              Name 43  "G"
+                              Name 46  "gl_VertexID"
+                              Name 47  "gl_InstanceID"
+                              Decorate 46(gl_VertexID) BuiltIn VertexId
+                              Decorate 47(gl_InstanceID) BuiltIn InstanceId
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1
                7:             TypePointer Function 6(int)
                9:      6(int) Constant 0
-              15:      6(int) Constant 10
-              16:             TypeBool
-              19:      6(int) Constant 1
-              21:      6(int) Constant 2
-              30:      6(int) Constant 3
-              39:      6(int) Constant 12
-              43:      6(int) Constant 99
-              44:             TypePointer Input 6(int)
- 45(gl_VertexID):     44(ptr) Variable Input
-46(gl_InstanceID):     44(ptr) Variable Input
+              16:      6(int) Constant 10
+              17:             TypeBool
+              20:      6(int) Constant 1
+              22:      6(int) Constant 2
+              31:      6(int) Constant 3
+              40:      6(int) Constant 12
+              44:      6(int) Constant 99
+              45:             TypePointer Input 6(int)
+ 46(gl_VertexID):     45(ptr) Variable Input
+47(gl_InstanceID):     45(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
             8(i):      7(ptr) Variable Function
-           18(A):      7(ptr) Variable Function
-           26(B):      7(ptr) Variable Function
-           28(C):      7(ptr) Variable Function
-           35(D):      7(ptr) Variable Function
-           37(E):      7(ptr) Variable Function
-           38(F):      7(ptr) Variable Function
-           42(G):      7(ptr) Variable Function
+           19(A):      7(ptr) Variable Function
+           27(B):      7(ptr) Variable Function
+           29(C):      7(ptr) Variable Function
+           36(D):      7(ptr) Variable Function
+           38(E):      7(ptr) Variable Function
+           39(F):      7(ptr) Variable Function
+           43(G):      7(ptr) Variable Function
                               Store 8(i) 9
                               Branch 10
               10:             Label
-              14:      6(int) Load 8(i)
-              17:    16(bool) SLessThan 14 15
                               LoopMerge 12 13 None
-                              BranchConditional 17 11 12
+                              Branch 14
+              14:             Label
+              15:      6(int) Load 8(i)
+              18:    17(bool) SLessThan 15 16
+                              BranchConditional 18 11 12
               11:               Label
-                                Store 18(A) 19
-              20:      6(int)   Load 8(i)
-              22:      6(int)   SMod 20 21
-              23:    16(bool)   IEqual 22 9
-                                SelectionMerge 25 None
-                                BranchConditional 23 24 25
-              24:                 Label
-                                  Store 26(B) 19
+                                Store 19(A) 20
+              21:      6(int)   Load 8(i)
+              23:      6(int)   SMod 21 22
+              24:    17(bool)   IEqual 23 9
+                                SelectionMerge 26 None
+                                BranchConditional 24 25 26
+              25:                 Label
+                                  Store 27(B) 20
                                   Branch 13
-              25:               Label
-              29:      6(int)   Load 8(i)
-              31:      6(int)   SMod 29 30
-              32:    16(bool)   IEqual 31 9
-                                SelectionMerge 34 None
-                                BranchConditional 32 33 34
-              33:                 Label
-                                  Store 35(D) 19
+              26:               Label
+              30:      6(int)   Load 8(i)
+              32:      6(int)   SMod 30 31
+              33:    17(bool)   IEqual 32 9
+                                SelectionMerge 35 None
+                                BranchConditional 33 34 35
+              34:                 Label
+                                  Store 36(D) 20
                                   Branch 12
-              34:               Label
-                                Store 38(F) 39
+              35:               Label
+                                Store 39(F) 40
                                 Branch 13
               13:               Label
-              40:      6(int)   Load 8(i)
-              41:      6(int)   IAdd 40 19
-                                Store 8(i) 41
+              41:      6(int)   Load 8(i)
+              42:      6(int)   IAdd 41 20
+                                Store 8(i) 42
                                 Branch 10
               12:             Label
-                              Store 42(G) 43
+                              Store 43(G) 44
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/spv.for-nobody.vert.out b/Test/baseResults/spv.for-nobody.vert.out
index 231e3ac..820dd5e 100644
--- a/Test/baseResults/spv.for-nobody.vert.out
+++ b/Test/baseResults/spv.for-nobody.vert.out
@@ -7,53 +7,55 @@
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 27
+// Id's are bound by 28
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 22 25 26
+                              EntryPoint Vertex 4  "main" 23 26 27
                               Source GLSL 450
                               Name 4  "main"
                               Name 8  "i"
-                              Name 22  "r"
-                              Name 25  "gl_VertexID"
-                              Name 26  "gl_InstanceID"
-                              Decorate 22(r) Location 0
-                              Decorate 25(gl_VertexID) BuiltIn VertexId
-                              Decorate 26(gl_InstanceID) BuiltIn InstanceId
+                              Name 23  "r"
+                              Name 26  "gl_VertexID"
+                              Name 27  "gl_InstanceID"
+                              Decorate 23(r) Location 0
+                              Decorate 26(gl_VertexID) BuiltIn VertexId
+                              Decorate 27(gl_InstanceID) BuiltIn InstanceId
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1
                7:             TypePointer Function 6(int)
                9:      6(int) Constant 0
-              15:      6(int) Constant 10
-              16:             TypeBool
-              19:      6(int) Constant 1
-              21:             TypePointer Output 6(int)
-           22(r):     21(ptr) Variable Output
-              24:             TypePointer Input 6(int)
- 25(gl_VertexID):     24(ptr) Variable Input
-26(gl_InstanceID):     24(ptr) Variable Input
+              16:      6(int) Constant 10
+              17:             TypeBool
+              20:      6(int) Constant 1
+              22:             TypePointer Output 6(int)
+           23(r):     22(ptr) Variable Output
+              25:             TypePointer Input 6(int)
+ 26(gl_VertexID):     25(ptr) Variable Input
+27(gl_InstanceID):     25(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
             8(i):      7(ptr) Variable Function
                               Store 8(i) 9
                               Branch 10
               10:             Label
-              14:      6(int) Load 8(i)
-              17:    16(bool) SLessThan 14 15
                               LoopMerge 12 13 None
-                              BranchConditional 17 11 12
+                              Branch 14
+              14:             Label
+              15:      6(int) Load 8(i)
+              18:    17(bool) SLessThan 15 16
+                              BranchConditional 18 11 12
               11:               Label
                                 Branch 13
               13:               Label
-              18:      6(int)   Load 8(i)
-              20:      6(int)   IAdd 18 19
-                                Store 8(i) 20
+              19:      6(int)   Load 8(i)
+              21:      6(int)   IAdd 19 20
+                                Store 8(i) 21
                                 Branch 10
               12:             Label
-              23:      6(int) Load 8(i)
-                              Store 22(r) 23
+              24:      6(int) Load 8(i)
+                              Store 23(r) 24
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/spv.for-simple.vert.out b/Test/baseResults/spv.for-simple.vert.out
index 570ee5b..3d090e5 100755
--- a/Test/baseResults/spv.for-simple.vert.out
+++ b/Test/baseResults/spv.for-simple.vert.out
@@ -5,50 +5,52 @@
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 26
+// Id's are bound by 27
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 24 25
+                              EntryPoint Vertex 4  "main" 25 26
                               Source ESSL 300
                               Name 4  "main"
                               Name 8  "i"
-                              Name 18  "j"
-                              Name 24  "gl_VertexID"
-                              Name 25  "gl_InstanceID"
-                              Decorate 24(gl_VertexID) BuiltIn VertexId
-                              Decorate 25(gl_InstanceID) BuiltIn InstanceId
+                              Name 19  "j"
+                              Name 25  "gl_VertexID"
+                              Name 26  "gl_InstanceID"
+                              Decorate 25(gl_VertexID) BuiltIn VertexId
+                              Decorate 26(gl_InstanceID) BuiltIn InstanceId
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1
                7:             TypePointer Function 6(int)
                9:      6(int) Constant 0
-              15:      6(int) Constant 10
-              16:             TypeBool
-              19:      6(int) Constant 12
-              21:      6(int) Constant 1
-              23:             TypePointer Input 6(int)
- 24(gl_VertexID):     23(ptr) Variable Input
-25(gl_InstanceID):     23(ptr) Variable Input
+              16:      6(int) Constant 10
+              17:             TypeBool
+              20:      6(int) Constant 12
+              22:      6(int) Constant 1
+              24:             TypePointer Input 6(int)
+ 25(gl_VertexID):     24(ptr) Variable Input
+26(gl_InstanceID):     24(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
             8(i):      7(ptr) Variable Function
-           18(j):      7(ptr) Variable Function
+           19(j):      7(ptr) Variable Function
                               Store 8(i) 9
                               Branch 10
               10:             Label
-              14:      6(int) Load 8(i)
-              17:    16(bool) SLessThan 14 15
                               LoopMerge 12 13 None
-                              BranchConditional 17 11 12
+                              Branch 14
+              14:             Label
+              15:      6(int) Load 8(i)
+              18:    17(bool) SLessThan 15 16
+                              BranchConditional 18 11 12
               11:               Label
-                                Store 18(j) 19
+                                Store 19(j) 20
                                 Branch 13
               13:               Label
-              20:      6(int)   Load 8(i)
-              22:      6(int)   IAdd 20 21
-                                Store 8(i) 22
+              21:      6(int)   Load 8(i)
+              23:      6(int)   IAdd 21 22
+                                Store 8(i) 23
                                 Branch 10
               12:             Label
                               Return
diff --git a/Test/baseResults/spv.forLoop.frag.out b/Test/baseResults/spv.forLoop.frag.out
index 95a795a..9e68e6b 100755
--- a/Test/baseResults/spv.forLoop.frag.out
+++ b/Test/baseResults/spv.forLoop.frag.out
@@ -5,30 +5,30 @@
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 127
+// Id's are bound by 132
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 11 36 101
+                              EntryPoint Fragment 4  "main" 11 37 105
                               ExecutionMode 4 OriginLowerLeft
                               Source GLSL 130
                               Name 4  "main"
                               Name 9  "color"
                               Name 11  "BaseColor"
                               Name 15  "i"
-                              Name 23  "Count"
-                              Name 28  "bigColor"
-                              Name 36  "gl_FragColor"
-                              Name 39  "sum"
-                              Name 41  "i"
-                              Name 52  "v4"
-                              Name 62  "i"
-                              Name 69  "tv4"
-                              Name 86  "r"
-                              Name 92  "i"
-                              Name 101  "f"
-                              Name 114  "i"
+                              Name 24  "Count"
+                              Name 29  "bigColor"
+                              Name 37  "gl_FragColor"
+                              Name 40  "sum"
+                              Name 42  "i"
+                              Name 54  "v4"
+                              Name 64  "i"
+                              Name 72  "tv4"
+                              Name 89  "r"
+                              Name 95  "i"
+                              Name 105  "f"
+                              Name 118  "i"
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -39,166 +39,176 @@
               13:             TypeInt 32 1
               14:             TypePointer Function 13(int)
               16:     13(int) Constant 0
-              22:             TypePointer UniformConstant 13(int)
-       23(Count):     22(ptr) Variable UniformConstant
-              25:             TypeBool
-              27:             TypePointer UniformConstant 7(fvec4)
-    28(bigColor):     27(ptr) Variable UniformConstant
-              33:     13(int) Constant 1
-              35:             TypePointer Output 7(fvec4)
-36(gl_FragColor):     35(ptr) Variable Output
-              38:             TypePointer Function 6(float)
-              40:    6(float) Constant 0
-              47:     13(int) Constant 4
-              49:             TypeInt 32 0
-              50:             TypeVector 49(int) 4
-              51:             TypePointer UniformConstant 50(ivec4)
-          52(v4):     51(ptr) Variable UniformConstant
-              54:             TypePointer UniformConstant 49(int)
-              74:     49(int) Constant 4
-              87:             TypeVector 6(float) 3
-             100:             TypePointer Input 6(float)
-          101(f):    100(ptr) Variable Input
-             103:     49(int) Constant 3
-             120:     13(int) Constant 16
+              23:             TypePointer UniformConstant 13(int)
+       24(Count):     23(ptr) Variable UniformConstant
+              26:             TypeBool
+              28:             TypePointer UniformConstant 7(fvec4)
+    29(bigColor):     28(ptr) Variable UniformConstant
+              34:     13(int) Constant 1
+              36:             TypePointer Output 7(fvec4)
+37(gl_FragColor):     36(ptr) Variable Output
+              39:             TypePointer Function 6(float)
+              41:    6(float) Constant 0
+              49:     13(int) Constant 4
+              51:             TypeInt 32 0
+              52:             TypeVector 51(int) 4
+              53:             TypePointer UniformConstant 52(ivec4)
+          54(v4):     53(ptr) Variable UniformConstant
+              56:             TypePointer UniformConstant 51(int)
+              77:     51(int) Constant 4
+              90:             TypeVector 6(float) 3
+             104:             TypePointer Input 6(float)
+          105(f):    104(ptr) Variable Input
+             107:     51(int) Constant 3
+             125:     13(int) Constant 16
          4(main):           2 Function None 3
                5:             Label
         9(color):      8(ptr) Variable Function
            15(i):     14(ptr) Variable Function
-         39(sum):     38(ptr) Variable Function
-           41(i):     14(ptr) Variable Function
-           62(i):     14(ptr) Variable Function
-         69(tv4):      8(ptr) Variable Function
-           86(r):      8(ptr) Variable Function
-           92(i):     14(ptr) Variable Function
-          114(i):     14(ptr) Variable Function
+         40(sum):     39(ptr) Variable Function
+           42(i):     14(ptr) Variable Function
+           64(i):     14(ptr) Variable Function
+         72(tv4):      8(ptr) Variable Function
+           89(r):      8(ptr) Variable Function
+           95(i):     14(ptr) Variable Function
+          118(i):     14(ptr) Variable Function
               12:    7(fvec4) Load 11(BaseColor)
                               Store 9(color) 12
                               Store 15(i) 16
                               Branch 17
               17:             Label
-              21:     13(int) Load 15(i)
-              24:     13(int) Load 23(Count)
-              26:    25(bool) SLessThan 21 24
                               LoopMerge 19 20 None
-                              BranchConditional 26 18 19
+                              Branch 21
+              21:             Label
+              22:     13(int) Load 15(i)
+              25:     13(int) Load 24(Count)
+              27:    26(bool) SLessThan 22 25
+                              BranchConditional 27 18 19
               18:               Label
-              29:    7(fvec4)   Load 28(bigColor)
-              30:    7(fvec4)   Load 9(color)
-              31:    7(fvec4)   FAdd 30 29
-                                Store 9(color) 31
+              30:    7(fvec4)   Load 29(bigColor)
+              31:    7(fvec4)   Load 9(color)
+              32:    7(fvec4)   FAdd 31 30
+                                Store 9(color) 32
                                 Branch 20
               20:               Label
-              32:     13(int)   Load 15(i)
-              34:     13(int)   IAdd 32 33
-                                Store 15(i) 34
+              33:     13(int)   Load 15(i)
+              35:     13(int)   IAdd 33 34
+                                Store 15(i) 35
                                 Branch 17
               19:             Label
-              37:    7(fvec4) Load 9(color)
-                              Store 36(gl_FragColor) 37
-                              Store 39(sum) 40
-                              Store 41(i) 16
-                              Branch 42
-              42:             Label
-              46:     13(int) Load 41(i)
-              48:    25(bool) SLessThan 46 47
-                              LoopMerge 44 45 None
-                              BranchConditional 48 43 44
-              43:               Label
-              53:     13(int)   Load 41(i)
-              55:     54(ptr)   AccessChain 52(v4) 53
-              56:     49(int)   Load 55
-              57:    6(float)   ConvertUToF 56
-              58:    6(float)   Load 39(sum)
-              59:    6(float)   FAdd 58 57
-                                Store 39(sum) 59
-                                Branch 45
-              45:               Label
-              60:     13(int)   Load 41(i)
-              61:     13(int)   IAdd 60 33
-                                Store 41(i) 61
-                                Branch 42
-              44:             Label
-                              Store 62(i) 16
-                              Branch 63
-              63:             Label
-              67:     13(int) Load 62(i)
-              68:    25(bool) SLessThan 67 47
-                              LoopMerge 65 66 None
-                              BranchConditional 68 64 65
-              64:               Label
-              70:     13(int)   Load 62(i)
-              71:     13(int)   Load 62(i)
-              72:     54(ptr)   AccessChain 52(v4) 71
-              73:     49(int)   Load 72
-              75:     49(int)   IMul 73 74
-              76:    6(float)   ConvertUToF 75
-              77:     38(ptr)   AccessChain 69(tv4) 70
-                                Store 77 76
-                                Branch 66
-              66:               Label
-              78:     13(int)   Load 62(i)
-              79:     13(int)   IAdd 78 33
-                                Store 62(i) 79
-                                Branch 63
+              38:    7(fvec4) Load 9(color)
+                              Store 37(gl_FragColor) 38
+                              Store 40(sum) 41
+                              Store 42(i) 16
+                              Branch 43
+              43:             Label
+                              LoopMerge 45 46 None
+                              Branch 47
+              47:             Label
+              48:     13(int) Load 42(i)
+              50:    26(bool) SLessThan 48 49
+                              BranchConditional 50 44 45
+              44:               Label
+              55:     13(int)   Load 42(i)
+              57:     56(ptr)   AccessChain 54(v4) 55
+              58:     51(int)   Load 57
+              59:    6(float)   ConvertUToF 58
+              60:    6(float)   Load 40(sum)
+              61:    6(float)   FAdd 60 59
+                                Store 40(sum) 61
+                                Branch 46
+              46:               Label
+              62:     13(int)   Load 42(i)
+              63:     13(int)   IAdd 62 34
+                                Store 42(i) 63
+                                Branch 43
+              45:             Label
+                              Store 64(i) 16
+                              Branch 65
               65:             Label
-              80:    6(float) Load 39(sum)
-              81:    7(fvec4) CompositeConstruct 80 80 80 80
-              82:    7(fvec4) Load 69(tv4)
-              83:    7(fvec4) FAdd 81 82
-              84:    7(fvec4) Load 36(gl_FragColor)
-              85:    7(fvec4) FAdd 84 83
-                              Store 36(gl_FragColor) 85
-              88:    7(fvec4) Load 11(BaseColor)
-              89:   87(fvec3) VectorShuffle 88 88 0 1 2
-              90:    7(fvec4) Load 86(r)
-              91:    7(fvec4) VectorShuffle 90 89 4 5 6 3
-                              Store 86(r) 91
-                              Store 92(i) 16
-                              Branch 93
-              93:             Label
-              97:     13(int) Load 92(i)
-              98:     13(int) Load 23(Count)
-              99:    25(bool) SLessThan 97 98
-                              LoopMerge 95 96 None
-                              BranchConditional 99 94 95
-              94:               Label
-             102:    6(float)   Load 101(f)
-             104:     38(ptr)   AccessChain 86(r) 103
-                                Store 104 102
+                              LoopMerge 67 68 None
+                              Branch 69
+              69:             Label
+              70:     13(int) Load 64(i)
+              71:    26(bool) SLessThan 70 49
+                              BranchConditional 71 66 67
+              66:               Label
+              73:     13(int)   Load 64(i)
+              74:     13(int)   Load 64(i)
+              75:     56(ptr)   AccessChain 54(v4) 74
+              76:     51(int)   Load 75
+              78:     51(int)   IMul 76 77
+              79:    6(float)   ConvertUToF 78
+              80:     39(ptr)   AccessChain 72(tv4) 73
+                                Store 80 79
+                                Branch 68
+              68:               Label
+              81:     13(int)   Load 64(i)
+              82:     13(int)   IAdd 81 34
+                                Store 64(i) 82
+                                Branch 65
+              67:             Label
+              83:    6(float) Load 40(sum)
+              84:    7(fvec4) CompositeConstruct 83 83 83 83
+              85:    7(fvec4) Load 72(tv4)
+              86:    7(fvec4) FAdd 84 85
+              87:    7(fvec4) Load 37(gl_FragColor)
+              88:    7(fvec4) FAdd 87 86
+                              Store 37(gl_FragColor) 88
+              91:    7(fvec4) Load 11(BaseColor)
+              92:   90(fvec3) VectorShuffle 91 91 0 1 2
+              93:    7(fvec4) Load 89(r)
+              94:    7(fvec4) VectorShuffle 93 92 4 5 6 3
+                              Store 89(r) 94
+                              Store 95(i) 16
+                              Branch 96
+              96:             Label
+                              LoopMerge 98 99 None
+                              Branch 100
+             100:             Label
+             101:     13(int) Load 95(i)
+             102:     13(int) Load 24(Count)
+             103:    26(bool) SLessThan 101 102
+                              BranchConditional 103 97 98
+              97:               Label
+             106:    6(float)   Load 105(f)
+             108:     39(ptr)   AccessChain 89(r) 107
+                                Store 108 106
+                                Branch 99
+              99:               Label
+             109:     13(int)   Load 95(i)
+             110:     13(int)   IAdd 109 34
+                                Store 95(i) 110
                                 Branch 96
-              96:               Label
-             105:     13(int)   Load 92(i)
-             106:     13(int)   IAdd 105 33
-                                Store 92(i) 106
-                                Branch 93
-              95:             Label
-             107:    7(fvec4) Load 86(r)
-             108:   87(fvec3) VectorShuffle 107 107 0 1 2
-             109:    7(fvec4) Load 36(gl_FragColor)
-             110:   87(fvec3) VectorShuffle 109 109 0 1 2
-             111:   87(fvec3) FAdd 110 108
-             112:    7(fvec4) Load 36(gl_FragColor)
-             113:    7(fvec4) VectorShuffle 112 111 4 5 6 3
-                              Store 36(gl_FragColor) 113
-                              Store 114(i) 16
-                              Branch 115
-             115:             Label
-             119:     13(int) Load 114(i)
-             121:    25(bool) SLessThan 119 120
-                              LoopMerge 117 118 None
-                              BranchConditional 121 116 117
-             116:               Label
-             122:    6(float)   Load 101(f)
-             123:    7(fvec4)   Load 36(gl_FragColor)
-             124:    7(fvec4)   VectorTimesScalar 123 122
-                                Store 36(gl_FragColor) 124
-                                Branch 118
-             118:               Label
-             125:     13(int)   Load 114(i)
-             126:     13(int)   IAdd 125 47
-                                Store 114(i) 126
-                                Branch 115
-             117:             Label
+              98:             Label
+             111:    7(fvec4) Load 89(r)
+             112:   90(fvec3) VectorShuffle 111 111 0 1 2
+             113:    7(fvec4) Load 37(gl_FragColor)
+             114:   90(fvec3) VectorShuffle 113 113 0 1 2
+             115:   90(fvec3) FAdd 114 112
+             116:    7(fvec4) Load 37(gl_FragColor)
+             117:    7(fvec4) VectorShuffle 116 115 4 5 6 3
+                              Store 37(gl_FragColor) 117
+                              Store 118(i) 16
+                              Branch 119
+             119:             Label
+                              LoopMerge 121 122 None
+                              Branch 123
+             123:             Label
+             124:     13(int) Load 118(i)
+             126:    26(bool) SLessThan 124 125
+                              BranchConditional 126 120 121
+             120:               Label
+             127:    6(float)   Load 105(f)
+             128:    7(fvec4)   Load 37(gl_FragColor)
+             129:    7(fvec4)   VectorTimesScalar 128 127
+                                Store 37(gl_FragColor) 129
+                                Branch 122
+             122:               Label
+             130:     13(int)   Load 118(i)
+             131:     13(int)   IAdd 130 49
+                                Store 118(i) 131
+                                Branch 119
+             121:             Label
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/spv.localAggregates.frag.out b/Test/baseResults/spv.localAggregates.frag.out
index e419231..1b5ef92 100755
--- a/Test/baseResults/spv.localAggregates.frag.out
+++ b/Test/baseResults/spv.localAggregates.frag.out
@@ -8,12 +8,12 @@
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 137
+// Id's are bound by 138
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 40 97 107
+                              EntryPoint Fragment 4  "main" 40 98 108
                               ExecutionMode 4 OriginLowerLeft
                               Source GLSL 130
                               Name 4  "main"
@@ -38,14 +38,14 @@
                               Name 68  "x"
                               Name 70  "localArray"
                               Name 75  "i"
-                              Name 83  "a"
-                              Name 89  "condition"
-                              Name 97  "color"
-                              Name 107  "gl_FragColor"
-                              Name 127  "samp2D"
-                              Name 133  "foo"
-                              Name 134  "foo2"
-                              Name 136  "uFloatArray"
+                              Name 84  "a"
+                              Name 90  "condition"
+                              Name 98  "color"
+                              Name 108  "gl_FragColor"
+                              Name 128  "samp2D"
+                              Name 134  "foo"
+                              Name 135  "foo2"
+                              Name 137  "uFloatArray"
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1
@@ -80,26 +80,26 @@
               48:             TypePointer Function 47
               52:             TypePointer Function 6(int)
               69:      6(int) Constant 5
-              81:      6(int) Constant 16
-              85:    7(float) Constant 0
-   89(condition):     20(ptr) Variable UniformConstant
-              95:      6(int) Constant 3
-              96:             TypePointer Input 9(fvec4)
-       97(color):     96(ptr) Variable Input
-              99:             TypePointer Function 9(fvec4)
-             101:     32(int) Constant 1
-             104:     32(int) Constant 2
-             106:             TypePointer Output 9(fvec4)
-107(gl_FragColor):    106(ptr) Variable Output
-             124:             TypeImage 7(float) 2D sampled format:Unknown
-             125:             TypeSampledImage 124
-             126:             TypePointer UniformConstant 125
-     127(samp2D):    126(ptr) Variable UniformConstant
-             132:             TypePointer UniformConstant 8(s1)
-        133(foo):    132(ptr) Variable UniformConstant
-       134(foo2):     17(ptr) Variable UniformConstant
-             135:             TypePointer UniformConstant 34
-136(uFloatArray):    135(ptr) Variable UniformConstant
+              82:      6(int) Constant 16
+              86:    7(float) Constant 0
+   90(condition):     20(ptr) Variable UniformConstant
+              96:      6(int) Constant 3
+              97:             TypePointer Input 9(fvec4)
+       98(color):     97(ptr) Variable Input
+             100:             TypePointer Function 9(fvec4)
+             102:     32(int) Constant 1
+             105:     32(int) Constant 2
+             107:             TypePointer Output 9(fvec4)
+108(gl_FragColor):    107(ptr) Variable Output
+             125:             TypeImage 7(float) 2D sampled format:Unknown
+             126:             TypeSampledImage 125
+             127:             TypePointer UniformConstant 126
+     128(samp2D):    127(ptr) Variable UniformConstant
+             133:             TypePointer UniformConstant 8(s1)
+        134(foo):    133(ptr) Variable UniformConstant
+       135(foo2):     17(ptr) Variable UniformConstant
+             136:             TypePointer UniformConstant 34
+137(uFloatArray):    136(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
      12(locals2):     11(ptr) Variable Function
@@ -108,7 +108,7 @@
            68(x):     52(ptr) Variable Function
   70(localArray):     35(ptr) Variable Function
            75(i):     52(ptr) Variable Function
-           83(a):     35(ptr) Variable Function
+           84(a):     35(ptr) Variable Function
               18:     17(ptr) AccessChain 15(foo3) 16
               19:      10(s2) Load 18
                               Store 12(locals2) 19
@@ -161,57 +161,59 @@
                               Store 75(i) 16
                               Branch 76
               76:             Label
-              80:      6(int) Load 75(i)
-              82:    23(bool) SLessThan 80 81
                               LoopMerge 78 79 None
-                              BranchConditional 82 77 78
+                              Branch 80
+              80:             Label
+              81:      6(int) Load 75(i)
+              83:    23(bool) SLessThan 81 82
+                              BranchConditional 83 77 78
               77:               Label
-              84:      6(int)   Load 75(i)
-              86:     30(ptr)   AccessChain 83(a) 84
-                                Store 86 85
+              85:      6(int)   Load 75(i)
+              87:     30(ptr)   AccessChain 84(a) 85
+                                Store 87 86
                                 Branch 79
               79:               Label
-              87:      6(int)   Load 75(i)
-              88:      6(int)   IAdd 87 28
-                                Store 75(i) 88
+              88:      6(int)   Load 75(i)
+              89:      6(int)   IAdd 88 28
+                                Store 75(i) 89
                                 Branch 76
               78:             Label
-              90:      6(int) Load 89(condition)
-              91:    23(bool) IEqual 90 28
-                              SelectionMerge 93 None
-                              BranchConditional 91 92 93
-              92:               Label
-              94:          34   Load 70(localArray)
-                                Store 83(a) 94
-                                Branch 93
-              93:             Label
-              98:    9(fvec4) Load 97(color)
-             100:     99(ptr) AccessChain 12(locals2) 95
-                              Store 100 98
-             102:     42(ptr) AccessChain 40(coord) 101
-             103:    7(float) Load 102
-             105:     30(ptr) AccessChain 12(locals2) 95 104
-                              Store 105 103
-             108:     99(ptr) AccessChain 12(locals2) 95
-             109:    9(fvec4) Load 108
-             110:     30(ptr) AccessChain 36(localFArray) 37
-             111:    7(float) Load 110
-             112:     30(ptr) AccessChain 12(locals2) 27 28
-             113:    7(float) Load 112
-             114:    7(float) FAdd 111 113
-             115:      6(int) Load 68(x)
-             116:     30(ptr) AccessChain 70(localArray) 115
-             117:    7(float) Load 116
-             118:    7(float) FAdd 114 117
-             119:      6(int) Load 68(x)
-             120:     30(ptr) AccessChain 83(a) 119
-             121:    7(float) Load 120
-             122:    7(float) FAdd 118 121
-             123:    9(fvec4) VectorTimesScalar 109 122
-             128:         125 Load 127(samp2D)
-             129:   38(fvec2) Load 40(coord)
-             130:    9(fvec4) ImageSampleImplicitLod 128 129
-             131:    9(fvec4) FMul 123 130
-                              Store 107(gl_FragColor) 131
+              91:      6(int) Load 90(condition)
+              92:    23(bool) IEqual 91 28
+                              SelectionMerge 94 None
+                              BranchConditional 92 93 94
+              93:               Label
+              95:          34   Load 70(localArray)
+                                Store 84(a) 95
+                                Branch 94
+              94:             Label
+              99:    9(fvec4) Load 98(color)
+             101:    100(ptr) AccessChain 12(locals2) 96
+                              Store 101 99
+             103:     42(ptr) AccessChain 40(coord) 102
+             104:    7(float) Load 103
+             106:     30(ptr) AccessChain 12(locals2) 96 105
+                              Store 106 104
+             109:    100(ptr) AccessChain 12(locals2) 96
+             110:    9(fvec4) Load 109
+             111:     30(ptr) AccessChain 36(localFArray) 37
+             112:    7(float) Load 111
+             113:     30(ptr) AccessChain 12(locals2) 27 28
+             114:    7(float) Load 113
+             115:    7(float) FAdd 112 114
+             116:      6(int) Load 68(x)
+             117:     30(ptr) AccessChain 70(localArray) 116
+             118:    7(float) Load 117
+             119:    7(float) FAdd 115 118
+             120:      6(int) Load 68(x)
+             121:     30(ptr) AccessChain 84(a) 120
+             122:    7(float) Load 121
+             123:    7(float) FAdd 119 122
+             124:    9(fvec4) VectorTimesScalar 110 123
+             129:         126 Load 128(samp2D)
+             130:   38(fvec2) Load 40(coord)
+             131:    9(fvec4) ImageSampleImplicitLod 129 130
+             132:    9(fvec4) FMul 124 131
+                              Store 108(gl_FragColor) 132
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/spv.loops.frag.out b/Test/baseResults/spv.loops.frag.out
index 98d2878..3cf68a0 100755
--- a/Test/baseResults/spv.loops.frag.out
+++ b/Test/baseResults/spv.loops.frag.out
@@ -7,70 +7,70 @@
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 720
+// Id's are bound by 743
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 11 597
+                              EntryPoint Fragment 4  "main" 11 616
                               ExecutionMode 4 OriginLowerLeft
                               Source GLSL 130
                               Name 4  "main"
                               Name 9  "color"
                               Name 11  "BaseColor"
-                              Name 52  "d"
-                              Name 56  "bigColor"
-                              Name 69  "bigColor1_1"
-                              Name 102  "d2"
-                              Name 110  "d3"
-                              Name 114  "bigColor1_2"
-                              Name 126  "bigColor1_3"
-                              Name 132  "d4"
-                              Name 143  "i"
-                              Name 151  "Count"
-                              Name 154  "bigColor2"
-                              Name 165  "bigColor3"
-                              Name 173  "i"
-                              Name 188  "i"
-                              Name 223  "i"
-                              Name 245  "i"
-                              Name 269  "i"
-                              Name 297  "bigColor4"
-                              Name 333  "bigColor5"
-                              Name 339  "d5"
-                              Name 355  "d6"
-                              Name 368  "bigColor6"
-                              Name 404  "d7"
-                              Name 435  "bigColor7"
-                              Name 454  "d8"
-                              Name 496  "d9"
-                              Name 527  "d10"
-                              Name 535  "d11"
-                              Name 545  "d12"
-                              Name 570  "bigColor8"
-                              Name 597  "gl_FragColor"
-                              Name 605  "d14"
-                              Name 610  "d15"
-                              Name 629  "d16"
-                              Name 666  "d18"
-                              Name 677  "d17"
-                              Name 703  "d13"
-                              Name 704  "d19"
-                              Name 705  "d20"
-                              Name 706  "d21"
-                              Name 707  "d22"
-                              Name 708  "d23"
-                              Name 709  "d24"
-                              Name 710  "d25"
-                              Name 711  "d26"
-                              Name 712  "d27"
-                              Name 713  "d28"
-                              Name 714  "d29"
-                              Name 715  "d30"
-                              Name 716  "d31"
-                              Name 717  "d32"
-                              Name 718  "d33"
-                              Name 719  "d34"
+                              Name 54  "d"
+                              Name 58  "bigColor"
+                              Name 72  "bigColor1_1"
+                              Name 107  "d2"
+                              Name 115  "d3"
+                              Name 119  "bigColor1_2"
+                              Name 132  "bigColor1_3"
+                              Name 138  "d4"
+                              Name 149  "i"
+                              Name 158  "Count"
+                              Name 161  "bigColor2"
+                              Name 172  "bigColor3"
+                              Name 180  "i"
+                              Name 196  "i"
+                              Name 232  "i"
+                              Name 255  "i"
+                              Name 280  "i"
+                              Name 309  "bigColor4"
+                              Name 345  "bigColor5"
+                              Name 351  "d5"
+                              Name 367  "d6"
+                              Name 381  "bigColor6"
+                              Name 419  "d7"
+                              Name 451  "bigColor7"
+                              Name 470  "d8"
+                              Name 513  "d9"
+                              Name 545  "d10"
+                              Name 553  "d11"
+                              Name 563  "d12"
+                              Name 589  "bigColor8"
+                              Name 616  "gl_FragColor"
+                              Name 625  "d14"
+                              Name 630  "d15"
+                              Name 650  "d16"
+                              Name 688  "d18"
+                              Name 699  "d17"
+                              Name 726  "d13"
+                              Name 727  "d19"
+                              Name 728  "d20"
+                              Name 729  "d21"
+                              Name 730  "d22"
+                              Name 731  "d23"
+                              Name 732  "d24"
+                              Name 733  "d25"
+                              Name 734  "d26"
+                              Name 735  "d27"
+                              Name 736  "d28"
+                              Name 737  "d29"
+                              Name 738  "d30"
+                              Name 739  "d31"
+                              Name 740  "d32"
+                              Name 741  "d33"
+                              Name 742  "d34"
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -78,1021 +78,1067 @@
                8:             TypePointer Function 7(fvec4)
               10:             TypePointer Input 7(fvec4)
    11(BaseColor):     10(ptr) Variable Input
-              17:             TypeBool
-              18:    17(bool) ConstantTrue
-              19:             TypeInt 32 0
-              20:     19(int) Constant 0
-              21:             TypePointer Function 6(float)
-              24:    6(float) Constant 1051260355
-              28:    7(fvec4) ConstantComposite 24 24 24 24
-              34:    6(float) Constant 1059648963
-              38:    7(fvec4) ConstantComposite 34 34 34 34
-              51:             TypePointer UniformConstant 6(float)
-           52(d):     51(ptr) Variable UniformConstant
-              55:             TypePointer UniformConstant 7(fvec4)
-    56(bigColor):     55(ptr) Variable UniformConstant
-              64:     19(int) Constant 2
- 69(bigColor1_1):     55(ptr) Variable UniformConstant
-              73:     19(int) Constant 3
-              90:    6(float) Constant 1109917696
-              93:    6(float) Constant 1065353216
-         102(d2):     51(ptr) Variable UniformConstant
-             107:     19(int) Constant 1
-         110(d3):     51(ptr) Variable UniformConstant
-114(bigColor1_2):     55(ptr) Variable UniformConstant
-126(bigColor1_3):     55(ptr) Variable UniformConstant
-         132(d4):     51(ptr) Variable UniformConstant
-             141:             TypeInt 32 1
-             142:             TypePointer Function 141(int)
-             144:    141(int) Constant 0
-             150:             TypePointer UniformConstant 141(int)
-      151(Count):    150(ptr) Variable UniformConstant
-  154(bigColor2):     55(ptr) Variable UniformConstant
-             159:    141(int) Constant 1
-  165(bigColor3):     55(ptr) Variable UniformConstant
-             179:    141(int) Constant 42
-             194:    141(int) Constant 100
-             198:    6(float) Constant 1101004800
-             229:    141(int) Constant 120
-  297(bigColor4):     55(ptr) Variable UniformConstant
-  333(bigColor5):     55(ptr) Variable UniformConstant
-         339(d5):     51(ptr) Variable UniformConstant
-         355(d6):     51(ptr) Variable UniformConstant
-  368(bigColor6):     55(ptr) Variable UniformConstant
-         404(d7):     51(ptr) Variable UniformConstant
-             430:    6(float) Constant 0
-  435(bigColor7):     55(ptr) Variable UniformConstant
-         454(d8):     51(ptr) Variable UniformConstant
-             471:    6(float) Constant 1073741824
-         496(d9):     51(ptr) Variable UniformConstant
-             512:    6(float) Constant 1084227584
-        527(d10):     51(ptr) Variable UniformConstant
-        535(d11):     51(ptr) Variable UniformConstant
-        545(d12):     51(ptr) Variable UniformConstant
-             568:    6(float) Constant 1092616192
-  570(bigColor8):     55(ptr) Variable UniformConstant
-             596:             TypePointer Output 7(fvec4)
-597(gl_FragColor):    596(ptr) Variable Output
-        605(d14):     51(ptr) Variable UniformConstant
-        610(d15):     51(ptr) Variable UniformConstant
-        629(d16):     51(ptr) Variable UniformConstant
-        666(d18):     51(ptr) Variable UniformConstant
-        677(d17):     51(ptr) Variable UniformConstant
-        703(d13):     51(ptr) Variable UniformConstant
-        704(d19):     51(ptr) Variable UniformConstant
-        705(d20):     51(ptr) Variable UniformConstant
-        706(d21):     51(ptr) Variable UniformConstant
-        707(d22):     51(ptr) Variable UniformConstant
-        708(d23):     51(ptr) Variable UniformConstant
-        709(d24):     51(ptr) Variable UniformConstant
-        710(d25):     51(ptr) Variable UniformConstant
-        711(d26):     51(ptr) Variable UniformConstant
-        712(d27):     51(ptr) Variable UniformConstant
-        713(d28):     51(ptr) Variable UniformConstant
-        714(d29):     51(ptr) Variable UniformConstant
-        715(d30):     51(ptr) Variable UniformConstant
-        716(d31):     51(ptr) Variable UniformConstant
-        717(d32):     51(ptr) Variable UniformConstant
-        718(d33):     51(ptr) Variable UniformConstant
-        719(d34):     51(ptr) Variable UniformConstant
+              18:             TypeBool
+              19:    18(bool) ConstantTrue
+              20:             TypeInt 32 0
+              21:     20(int) Constant 0
+              22:             TypePointer Function 6(float)
+              25:    6(float) Constant 1051260355
+              29:    7(fvec4) ConstantComposite 25 25 25 25
+              35:    6(float) Constant 1059648963
+              39:    7(fvec4) ConstantComposite 35 35 35 35
+              53:             TypePointer UniformConstant 6(float)
+           54(d):     53(ptr) Variable UniformConstant
+              57:             TypePointer UniformConstant 7(fvec4)
+    58(bigColor):     57(ptr) Variable UniformConstant
+              67:     20(int) Constant 2
+ 72(bigColor1_1):     57(ptr) Variable UniformConstant
+              76:     20(int) Constant 3
+              94:    6(float) Constant 1109917696
+              97:    6(float) Constant 1065353216
+         107(d2):     53(ptr) Variable UniformConstant
+             112:     20(int) Constant 1
+         115(d3):     53(ptr) Variable UniformConstant
+119(bigColor1_2):     57(ptr) Variable UniformConstant
+132(bigColor1_3):     57(ptr) Variable UniformConstant
+         138(d4):     53(ptr) Variable UniformConstant
+             147:             TypeInt 32 1
+             148:             TypePointer Function 147(int)
+             150:    147(int) Constant 0
+             157:             TypePointer UniformConstant 147(int)
+      158(Count):    157(ptr) Variable UniformConstant
+  161(bigColor2):     57(ptr) Variable UniformConstant
+             166:    147(int) Constant 1
+  172(bigColor3):     57(ptr) Variable UniformConstant
+             187:    147(int) Constant 42
+             203:    147(int) Constant 100
+             207:    6(float) Constant 1101004800
+             239:    147(int) Constant 120
+  309(bigColor4):     57(ptr) Variable UniformConstant
+  345(bigColor5):     57(ptr) Variable UniformConstant
+         351(d5):     53(ptr) Variable UniformConstant
+         367(d6):     53(ptr) Variable UniformConstant
+  381(bigColor6):     57(ptr) Variable UniformConstant
+         419(d7):     53(ptr) Variable UniformConstant
+             446:    6(float) Constant 0
+  451(bigColor7):     57(ptr) Variable UniformConstant
+         470(d8):     53(ptr) Variable UniformConstant
+             487:    6(float) Constant 1073741824
+         513(d9):     53(ptr) Variable UniformConstant
+             529:    6(float) Constant 1084227584
+        545(d10):     53(ptr) Variable UniformConstant
+        553(d11):     53(ptr) Variable UniformConstant
+        563(d12):     53(ptr) Variable UniformConstant
+             587:    6(float) Constant 1092616192
+  589(bigColor8):     57(ptr) Variable UniformConstant
+             615:             TypePointer Output 7(fvec4)
+616(gl_FragColor):    615(ptr) Variable Output
+        625(d14):     53(ptr) Variable UniformConstant
+        630(d15):     53(ptr) Variable UniformConstant
+        650(d16):     53(ptr) Variable UniformConstant
+        688(d18):     53(ptr) Variable UniformConstant
+        699(d17):     53(ptr) Variable UniformConstant
+        726(d13):     53(ptr) Variable UniformConstant
+        727(d19):     53(ptr) Variable UniformConstant
+        728(d20):     53(ptr) Variable UniformConstant
+        729(d21):     53(ptr) Variable UniformConstant
+        730(d22):     53(ptr) Variable UniformConstant
+        731(d23):     53(ptr) Variable UniformConstant
+        732(d24):     53(ptr) Variable UniformConstant
+        733(d25):     53(ptr) Variable UniformConstant
+        734(d26):     53(ptr) Variable UniformConstant
+        735(d27):     53(ptr) Variable UniformConstant
+        736(d28):     53(ptr) Variable UniformConstant
+        737(d29):     53(ptr) Variable UniformConstant
+        738(d30):     53(ptr) Variable UniformConstant
+        739(d31):     53(ptr) Variable UniformConstant
+        740(d32):     53(ptr) Variable UniformConstant
+        741(d33):     53(ptr) Variable UniformConstant
+        742(d34):     53(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
         9(color):      8(ptr) Variable Function
-          143(i):    142(ptr) Variable Function
-          173(i):    142(ptr) Variable Function
-          188(i):    142(ptr) Variable Function
-          223(i):    142(ptr) Variable Function
-          245(i):    142(ptr) Variable Function
-          269(i):    142(ptr) Variable Function
+          149(i):    148(ptr) Variable Function
+          180(i):    148(ptr) Variable Function
+          196(i):    148(ptr) Variable Function
+          232(i):    148(ptr) Variable Function
+          255(i):    148(ptr) Variable Function
+          280(i):    148(ptr) Variable Function
               12:    7(fvec4) Load 11(BaseColor)
                               Store 9(color) 12
                               Branch 13
               13:             Label
                               LoopMerge 15 16 None
-                              BranchConditional 18 14 15
+                              Branch 17
+              17:             Label
+                              BranchConditional 19 14 15
               14:               Label
-              22:     21(ptr)   AccessChain 9(color) 20
-              23:    6(float)   Load 22
-              25:    17(bool)   FOrdLessThan 23 24
-                                SelectionMerge 27 None
-                                BranchConditional 25 26 27
-              26:                 Label
-              29:    7(fvec4)     Load 9(color)
-              30:    7(fvec4)     FAdd 29 28
-                                  Store 9(color) 30
+              23:     22(ptr)   AccessChain 9(color) 21
+              24:    6(float)   Load 23
+              26:    18(bool)   FOrdLessThan 24 25
+                                SelectionMerge 28 None
+                                BranchConditional 26 27 28
+              27:                 Label
+              30:    7(fvec4)     Load 9(color)
+              31:    7(fvec4)     FAdd 30 29
+                                  Store 9(color) 31
                                   Branch 15
-              27:               Label
-              32:     21(ptr)   AccessChain 9(color) 20
-              33:    6(float)   Load 32
-              35:    17(bool)   FOrdLessThan 33 34
-                                SelectionMerge 37 None
-                                BranchConditional 35 36 37
-              36:                 Label
-              39:    7(fvec4)     Load 9(color)
-              40:    7(fvec4)     FAdd 39 38
-                                  Store 9(color) 40
+              28:               Label
+              33:     22(ptr)   AccessChain 9(color) 21
+              34:    6(float)   Load 33
+              36:    18(bool)   FOrdLessThan 34 35
+                                SelectionMerge 38 None
+                                BranchConditional 36 37 38
+              37:                 Label
+              40:    7(fvec4)     Load 9(color)
+              41:    7(fvec4)     FAdd 40 39
+                                  Store 9(color) 41
                                   Branch 15
-              37:               Label
-              42:    7(fvec4)   Load 9(color)
-              43:    7(fvec4)   FAdd 42 28
-                                Store 9(color) 43
+              38:               Label
+              43:    7(fvec4)   Load 9(color)
+              44:    7(fvec4)   FAdd 43 29
+                                Store 9(color) 44
                                 Branch 15
               16:               Label
                                 Branch 13
               15:             Label
-                              Branch 45
-              45:             Label
-              49:     21(ptr) AccessChain 9(color) 20
-              50:    6(float) Load 49
-              53:    6(float) Load 52(d)
-              54:    17(bool) FOrdLessThan 50 53
-                              LoopMerge 47 48 None
-                              BranchConditional 54 46 47
-              46:               Label
-              57:    7(fvec4)   Load 56(bigColor)
-              58:    7(fvec4)   Load 9(color)
-              59:    7(fvec4)   FAdd 58 57
-                                Store 9(color) 59
-                                Branch 48
-              48:               Label
-                                Branch 45
-              47:             Label
-                              Branch 60
-              60:             Label
-              65:     21(ptr) AccessChain 9(color) 64
-              66:    6(float) Load 65
-              67:    6(float) Load 52(d)
-              68:    17(bool) FOrdLessThan 66 67
-                              LoopMerge 62 63 None
-                              BranchConditional 68 61 62
-              61:               Label
-              70:    7(fvec4)   Load 69(bigColor1_1)
-              71:    7(fvec4)   Load 9(color)
-              72:    7(fvec4)   FAdd 71 70
-                                Store 9(color) 72
-              74:     21(ptr)   AccessChain 9(color) 73
-              75:    6(float)   Load 74
-              76:    6(float)   Load 52(d)
-              77:    17(bool)   FOrdLessThan 75 76
-                                SelectionMerge 79 None
-                                BranchConditional 77 78 79
-              78:                 Label
-                                  Branch 63
-              79:               Label
-              81:    7(fvec4)   Load 69(bigColor1_1)
-              82:    7(fvec4)   Load 9(color)
-              83:    7(fvec4)   FAdd 82 81
-                                Store 9(color) 83
-                                Branch 63
-              63:               Label
-                                Branch 60
+                              Branch 46
+              46:             Label
+                              LoopMerge 48 49 None
+                              Branch 50
+              50:             Label
+              51:     22(ptr) AccessChain 9(color) 21
+              52:    6(float) Load 51
+              55:    6(float) Load 54(d)
+              56:    18(bool) FOrdLessThan 52 55
+                              BranchConditional 56 47 48
+              47:               Label
+              59:    7(fvec4)   Load 58(bigColor)
+              60:    7(fvec4)   Load 9(color)
+              61:    7(fvec4)   FAdd 60 59
+                                Store 9(color) 61
+                                Branch 49
+              49:               Label
+                                Branch 46
+              48:             Label
+                              Branch 62
               62:             Label
-                              Branch 84
-              84:             Label
-              88:     21(ptr) AccessChain 9(color) 20
-              89:    6(float) Load 88
-              91:    17(bool) FOrdLessThan 89 90
-                              LoopMerge 86 87 None
-                              BranchConditional 91 85 86
-              85:               Label
-              92:    7(fvec4)   Load 9(color)
-              94:    7(fvec4)   CompositeConstruct 93 93 93 93
-              95:    7(fvec4)   FAdd 92 94
-                                Store 9(color) 95
+                              LoopMerge 64 65 None
+                              Branch 66
+              66:             Label
+              68:     22(ptr) AccessChain 9(color) 67
+              69:    6(float) Load 68
+              70:    6(float) Load 54(d)
+              71:    18(bool) FOrdLessThan 69 70
+                              BranchConditional 71 63 64
+              63:               Label
+              73:    7(fvec4)   Load 72(bigColor1_1)
+              74:    7(fvec4)   Load 9(color)
+              75:    7(fvec4)   FAdd 74 73
+                                Store 9(color) 75
+              77:     22(ptr)   AccessChain 9(color) 76
+              78:    6(float)   Load 77
+              79:    6(float)   Load 54(d)
+              80:    18(bool)   FOrdLessThan 78 79
+                                SelectionMerge 82 None
+                                BranchConditional 80 81 82
+              81:                 Label
+                                  Branch 65
+              82:               Label
+              84:    7(fvec4)   Load 72(bigColor1_1)
+              85:    7(fvec4)   Load 9(color)
+              86:    7(fvec4)   FAdd 85 84
+                                Store 9(color) 86
+                                Branch 65
+              65:               Label
+                                Branch 62
+              64:             Label
+                              Branch 87
+              87:             Label
+                              LoopMerge 89 90 None
+                              Branch 91
+              91:             Label
+              92:     22(ptr) AccessChain 9(color) 21
+              93:    6(float) Load 92
+              95:    18(bool) FOrdLessThan 93 94
+                              BranchConditional 95 88 89
+              88:               Label
+              96:    7(fvec4)   Load 9(color)
+              98:    7(fvec4)   CompositeConstruct 97 97 97 97
+              99:    7(fvec4)   FAdd 96 98
+                                Store 9(color) 99
+                                Branch 90
+              90:               Label
                                 Branch 87
-              87:               Label
-                                Branch 84
-              86:             Label
-                              Branch 96
-              96:             Label
-             100:     21(ptr) AccessChain 9(color) 73
-             101:    6(float) Load 100
-             103:    6(float) Load 102(d2)
-             104:    17(bool) FOrdLessThan 101 103
-                              SelectionMerge 106 None
-                              BranchConditional 104 105 106
-             105:               Label
-             108:     21(ptr)   AccessChain 9(color) 107
-             109:    6(float)   Load 108
-             111:    6(float)   Load 110(d3)
-             112:    17(bool)   FOrdLessThan 109 111
-                                Branch 106
-             106:             Label
-             113:    17(bool) Phi 104 96 112 105
-                              LoopMerge 98 99 None
-                              BranchConditional 113 97 98
-              97:               Label
-             115:    7(fvec4)   Load 114(bigColor1_2)
-             116:    7(fvec4)   Load 9(color)
-             117:    7(fvec4)   FAdd 116 115
-                                Store 9(color) 117
-                                Branch 99
-              99:               Label
-                                Branch 96
-              98:             Label
-                              Branch 118
-             118:             Label
-             122:     21(ptr) AccessChain 9(color) 64
-             123:    6(float) Load 122
-             124:    6(float) Load 110(d3)
-             125:    17(bool) FOrdLessThan 123 124
-                              LoopMerge 120 121 None
-                              BranchConditional 125 119 120
-             119:               Label
-             127:    7(fvec4)   Load 126(bigColor1_3)
-             128:    7(fvec4)   Load 9(color)
-             129:    7(fvec4)   FAdd 128 127
-                                Store 9(color) 129
-             130:     21(ptr)   AccessChain 9(color) 107
-             131:    6(float)   Load 130
-             133:    6(float)   Load 132(d4)
-             134:    17(bool)   FOrdLessThan 131 133
-                                SelectionMerge 136 None
-                                BranchConditional 134 135 136
-             135:                 Label
-                                  Branch 120
-             136:               Label
-             138:    7(fvec4)   Load 126(bigColor1_3)
-             139:    7(fvec4)   Load 9(color)
-             140:    7(fvec4)   FAdd 139 138
-                                Store 9(color) 140
-                                Branch 121
-             121:               Label
-                                Branch 118
-             120:             Label
-                              Store 143(i) 144
-                              Branch 145
-             145:             Label
-             149:    141(int) Load 143(i)
-             152:    141(int) Load 151(Count)
-             153:    17(bool) SLessThan 149 152
-                              LoopMerge 147 148 None
-                              BranchConditional 153 146 147
-             146:               Label
-             155:    7(fvec4)   Load 154(bigColor2)
-             156:    7(fvec4)   Load 9(color)
-             157:    7(fvec4)   FAdd 156 155
-                                Store 9(color) 157
-                                Branch 148
-             148:               Label
-             158:    141(int)   Load 143(i)
-             160:    141(int)   IAdd 158 159
-                                Store 143(i) 160
-                                Branch 145
-             147:             Label
-                              Branch 161
-             161:             Label
-                              LoopMerge 163 164 None
-                              Branch 162
-             162:             Label
-             166:    7(fvec4) Load 165(bigColor3)
-             167:    7(fvec4) Load 9(color)
-             168:    7(fvec4) FAdd 167 166
-                              Store 9(color) 168
-                              Branch 164
-             164:             Label
-             169:     21(ptr) AccessChain 9(color) 20
-             170:    6(float) Load 169
-             171:    6(float) Load 102(d2)
-             172:    17(bool) FOrdLessThan 170 171
-                              BranchConditional 172 161 163
-             163:             Label
-                              Store 173(i) 144
-                              Branch 174
-             174:             Label
-             178:    141(int) Load 173(i)
-             180:    17(bool) SLessThan 178 179
-                              LoopMerge 176 177 None
-                              BranchConditional 180 175 176
-             175:               Label
-             181:    6(float)   Load 110(d3)
-             182:     21(ptr)   AccessChain 9(color) 64
-             183:    6(float)   Load 182
-             184:    6(float)   FAdd 183 181
-             185:     21(ptr)   AccessChain 9(color) 64
-                                Store 185 184
-                                Branch 177
-             177:               Label
-             186:    141(int)   Load 173(i)
-             187:    141(int)   IAdd 186 159
-                                Store 173(i) 187
-                                Branch 174
-             176:             Label
-                              Store 188(i) 144
-                              Branch 189
-             189:             Label
-             193:    141(int) Load 188(i)
-             195:    17(bool) SLessThan 193 194
-                              LoopMerge 191 192 None
-                              BranchConditional 195 190 191
-             190:               Label
-             196:     21(ptr)   AccessChain 9(color) 64
-             197:    6(float)   Load 196
-             199:    17(bool)   FOrdLessThan 197 198
-                                SelectionMerge 201 None
-                                BranchConditional 199 200 205
-             200:                 Label
-             202:     21(ptr)     AccessChain 9(color) 20
-             203:    6(float)     Load 202
-             204:    6(float)     FAdd 203 93
-                                  Store 202 204
-                                  Branch 201
-             205:                 Label
-             206:     21(ptr)     AccessChain 9(color) 107
-             207:    6(float)     Load 206
-             208:    6(float)     FAdd 207 93
-                                  Store 206 208
-                                  Branch 201
-             201:               Label
-             209:     21(ptr)   AccessChain 9(color) 73
-             210:    6(float)   Load 209
-             211:    17(bool)   FOrdLessThan 210 198
-                                SelectionMerge 213 None
-                                BranchConditional 211 212 213
-             212:                 Label
-             214:     21(ptr)     AccessChain 9(color) 64
-             215:    6(float)     Load 214
-             216:     21(ptr)     AccessChain 9(color) 107
-             217:    6(float)     Load 216
-             218:    17(bool)     FOrdGreaterThan 215 217
-                                  SelectionMerge 220 None
-                                  BranchConditional 218 219 220
-             219:                   Label
-                                    Branch 220
-             220:                 Label
-                                  Branch 213
-             213:               Label
-                                Branch 192
-             192:               Label
-             221:    141(int)   Load 188(i)
-             222:    141(int)   IAdd 221 159
-                                Store 188(i) 222
-                                Branch 189
-             191:             Label
-                              Store 223(i) 144
-                              Branch 224
-             224:             Label
-             228:    141(int) Load 223(i)
-             230:    17(bool) SLessThan 228 229
-                              LoopMerge 226 227 None
-                              BranchConditional 230 225 226
-             225:               Label
-             231:     21(ptr)   AccessChain 9(color) 64
-             232:    6(float)   Load 231
-             233:    17(bool)   FOrdLessThan 232 198
-                                SelectionMerge 235 None
-                                BranchConditional 233 234 239
-             234:                 Label
-             236:     21(ptr)     AccessChain 9(color) 20
-             237:    6(float)     Load 236
-             238:    6(float)     FAdd 237 93
-                                  Store 236 238
-                                  Branch 235
-             239:                 Label
-             240:     21(ptr)     AccessChain 9(color) 107
-             241:    6(float)     Load 240
-             242:    6(float)     FAdd 241 93
-                                  Store 240 242
-                                  Branch 235
-             235:               Label
-                                Branch 227
-             227:               Label
-             243:    141(int)   Load 223(i)
-             244:    141(int)   IAdd 243 159
-                                Store 223(i) 244
-                                Branch 224
-             226:             Label
-                              Store 245(i) 144
-                              Branch 246
-             246:             Label
-             250:    141(int) Load 245(i)
-             251:    17(bool) SLessThan 250 179
-                              LoopMerge 248 249 None
-                              BranchConditional 251 247 248
-             247:               Label
-             252:    6(float)   Load 110(d3)
-             253:     21(ptr)   AccessChain 9(color) 64
-             254:    6(float)   Load 253
-             255:    6(float)   FAdd 254 252
-             256:     21(ptr)   AccessChain 9(color) 64
-                                Store 256 255
-             257:     21(ptr)   AccessChain 9(color) 20
-             258:    6(float)   Load 257
-             259:    6(float)   Load 132(d4)
-             260:    17(bool)   FOrdLessThan 258 259
-                                SelectionMerge 262 None
-                                BranchConditional 260 261 262
-             261:                 Label
-                                  Branch 249
-             262:               Label
-             264:     21(ptr)   AccessChain 9(color) 73
+              89:             Label
+                              Branch 100
+             100:             Label
+                              LoopMerge 102 103 None
+                              Branch 104
+             104:             Label
+             105:     22(ptr) AccessChain 9(color) 76
+             106:    6(float) Load 105
+             108:    6(float) Load 107(d2)
+             109:    18(bool) FOrdLessThan 106 108
+                              SelectionMerge 111 None
+                              BranchConditional 109 110 111
+             110:               Label
+             113:     22(ptr)   AccessChain 9(color) 112
+             114:    6(float)   Load 113
+             116:    6(float)   Load 115(d3)
+             117:    18(bool)   FOrdLessThan 114 116
+                                Branch 111
+             111:             Label
+             118:    18(bool) Phi 109 104 117 110
+                              BranchConditional 118 101 102
+             101:             Label
+             120:    7(fvec4) Load 119(bigColor1_2)
+             121:    7(fvec4) Load 9(color)
+             122:    7(fvec4) FAdd 121 120
+                              Store 9(color) 122
+                              Branch 103
+             103:             Label
+                              Branch 100
+             102:             Label
+                              Branch 123
+             123:             Label
+                              LoopMerge 125 126 None
+                              Branch 127
+             127:             Label
+             128:     22(ptr) AccessChain 9(color) 67
+             129:    6(float) Load 128
+             130:    6(float) Load 115(d3)
+             131:    18(bool) FOrdLessThan 129 130
+                              BranchConditional 131 124 125
+             124:               Label
+             133:    7(fvec4)   Load 132(bigColor1_3)
+             134:    7(fvec4)   Load 9(color)
+             135:    7(fvec4)   FAdd 134 133
+                                Store 9(color) 135
+             136:     22(ptr)   AccessChain 9(color) 112
+             137:    6(float)   Load 136
+             139:    6(float)   Load 138(d4)
+             140:    18(bool)   FOrdLessThan 137 139
+                                SelectionMerge 142 None
+                                BranchConditional 140 141 142
+             141:                 Label
+                                  Branch 125
+             142:               Label
+             144:    7(fvec4)   Load 132(bigColor1_3)
+             145:    7(fvec4)   Load 9(color)
+             146:    7(fvec4)   FAdd 145 144
+                                Store 9(color) 146
+                                Branch 126
+             126:               Label
+                                Branch 123
+             125:             Label
+                              Store 149(i) 150
+                              Branch 151
+             151:             Label
+                              LoopMerge 153 154 None
+                              Branch 155
+             155:             Label
+             156:    147(int) Load 149(i)
+             159:    147(int) Load 158(Count)
+             160:    18(bool) SLessThan 156 159
+                              BranchConditional 160 152 153
+             152:               Label
+             162:    7(fvec4)   Load 161(bigColor2)
+             163:    7(fvec4)   Load 9(color)
+             164:    7(fvec4)   FAdd 163 162
+                                Store 9(color) 164
+                                Branch 154
+             154:               Label
+             165:    147(int)   Load 149(i)
+             167:    147(int)   IAdd 165 166
+                                Store 149(i) 167
+                                Branch 151
+             153:             Label
+                              Branch 168
+             168:             Label
+                              LoopMerge 170 171 None
+                              Branch 169
+             169:             Label
+             173:    7(fvec4) Load 172(bigColor3)
+             174:    7(fvec4) Load 9(color)
+             175:    7(fvec4) FAdd 174 173
+                              Store 9(color) 175
+                              Branch 171
+             171:             Label
+             176:     22(ptr) AccessChain 9(color) 21
+             177:    6(float) Load 176
+             178:    6(float) Load 107(d2)
+             179:    18(bool) FOrdLessThan 177 178
+                              BranchConditional 179 168 170
+             170:             Label
+                              Store 180(i) 150
+                              Branch 181
+             181:             Label
+                              LoopMerge 183 184 None
+                              Branch 185
+             185:             Label
+             186:    147(int) Load 180(i)
+             188:    18(bool) SLessThan 186 187
+                              BranchConditional 188 182 183
+             182:               Label
+             189:    6(float)   Load 115(d3)
+             190:     22(ptr)   AccessChain 9(color) 67
+             191:    6(float)   Load 190
+             192:    6(float)   FAdd 191 189
+             193:     22(ptr)   AccessChain 9(color) 67
+                                Store 193 192
+                                Branch 184
+             184:               Label
+             194:    147(int)   Load 180(i)
+             195:    147(int)   IAdd 194 166
+                                Store 180(i) 195
+                                Branch 181
+             183:             Label
+                              Store 196(i) 150
+                              Branch 197
+             197:             Label
+                              LoopMerge 199 200 None
+                              Branch 201
+             201:             Label
+             202:    147(int) Load 196(i)
+             204:    18(bool) SLessThan 202 203
+                              BranchConditional 204 198 199
+             198:               Label
+             205:     22(ptr)   AccessChain 9(color) 67
+             206:    6(float)   Load 205
+             208:    18(bool)   FOrdLessThan 206 207
+                                SelectionMerge 210 None
+                                BranchConditional 208 209 214
+             209:                 Label
+             211:     22(ptr)     AccessChain 9(color) 21
+             212:    6(float)     Load 211
+             213:    6(float)     FAdd 212 97
+                                  Store 211 213
+                                  Branch 210
+             214:                 Label
+             215:     22(ptr)     AccessChain 9(color) 112
+             216:    6(float)     Load 215
+             217:    6(float)     FAdd 216 97
+                                  Store 215 217
+                                  Branch 210
+             210:               Label
+             218:     22(ptr)   AccessChain 9(color) 76
+             219:    6(float)   Load 218
+             220:    18(bool)   FOrdLessThan 219 207
+                                SelectionMerge 222 None
+                                BranchConditional 220 221 222
+             221:                 Label
+             223:     22(ptr)     AccessChain 9(color) 67
+             224:    6(float)     Load 223
+             225:     22(ptr)     AccessChain 9(color) 112
+             226:    6(float)     Load 225
+             227:    18(bool)     FOrdGreaterThan 224 226
+                                  SelectionMerge 229 None
+                                  BranchConditional 227 228 229
+             228:                   Label
+                                    Branch 229
+             229:                 Label
+                                  Branch 222
+             222:               Label
+                                Branch 200
+             200:               Label
+             230:    147(int)   Load 196(i)
+             231:    147(int)   IAdd 230 166
+                                Store 196(i) 231
+                                Branch 197
+             199:             Label
+                              Store 232(i) 150
+                              Branch 233
+             233:             Label
+                              LoopMerge 235 236 None
+                              Branch 237
+             237:             Label
+             238:    147(int) Load 232(i)
+             240:    18(bool) SLessThan 238 239
+                              BranchConditional 240 234 235
+             234:               Label
+             241:     22(ptr)   AccessChain 9(color) 67
+             242:    6(float)   Load 241
+             243:    18(bool)   FOrdLessThan 242 207
+                                SelectionMerge 245 None
+                                BranchConditional 243 244 249
+             244:                 Label
+             246:     22(ptr)     AccessChain 9(color) 21
+             247:    6(float)     Load 246
+             248:    6(float)     FAdd 247 97
+                                  Store 246 248
+                                  Branch 245
+             249:                 Label
+             250:     22(ptr)     AccessChain 9(color) 112
+             251:    6(float)     Load 250
+             252:    6(float)     FAdd 251 97
+                                  Store 250 252
+                                  Branch 245
+             245:               Label
+                                Branch 236
+             236:               Label
+             253:    147(int)   Load 232(i)
+             254:    147(int)   IAdd 253 166
+                                Store 232(i) 254
+                                Branch 233
+             235:             Label
+                              Store 255(i) 150
+                              Branch 256
+             256:             Label
+                              LoopMerge 258 259 None
+                              Branch 260
+             260:             Label
+             261:    147(int) Load 255(i)
+             262:    18(bool) SLessThan 261 187
+                              BranchConditional 262 257 258
+             257:               Label
+             263:    6(float)   Load 115(d3)
+             264:     22(ptr)   AccessChain 9(color) 67
              265:    6(float)   Load 264
-             266:    6(float)   FAdd 265 93
-                                Store 264 266
-                                Branch 249
-             249:               Label
-             267:    141(int)   Load 245(i)
-             268:    141(int)   IAdd 267 159
-                                Store 245(i) 268
-                                Branch 246
-             248:             Label
-                              Store 269(i) 144
-                              Branch 270
-             270:             Label
-             274:    141(int) Load 269(i)
-             275:    17(bool) SLessThan 274 179
-                              LoopMerge 272 273 None
-                              BranchConditional 275 271 272
-             271:               Label
-             276:    6(float)   Load 110(d3)
-             277:     21(ptr)   AccessChain 9(color) 64
-             278:    6(float)   Load 277
-             279:    6(float)   FAdd 278 276
-             280:     21(ptr)   AccessChain 9(color) 64
-                                Store 280 279
-             281:     21(ptr)   AccessChain 9(color) 20
-             282:    6(float)   Load 281
-             283:    6(float)   Load 132(d4)
-             284:    17(bool)   FOrdLessThan 282 283
-                                SelectionMerge 286 None
-                                BranchConditional 284 285 286
-             285:                 Label
-                                  Branch 272
-             286:               Label
-             288:     21(ptr)   AccessChain 9(color) 73
-             289:    6(float)   Load 288
-             290:    6(float)   FAdd 289 93
-                                Store 288 290
-                                Branch 273
+             266:    6(float)   FAdd 265 263
+             267:     22(ptr)   AccessChain 9(color) 67
+                                Store 267 266
+             268:     22(ptr)   AccessChain 9(color) 21
+             269:    6(float)   Load 268
+             270:    6(float)   Load 138(d4)
+             271:    18(bool)   FOrdLessThan 269 270
+                                SelectionMerge 273 None
+                                BranchConditional 271 272 273
+             272:                 Label
+                                  Branch 259
              273:               Label
-             291:    141(int)   Load 269(i)
-             292:    141(int)   IAdd 291 159
-                                Store 269(i) 292
-                                Branch 270
-             272:             Label
-                              Branch 293
-             293:             Label
-                              LoopMerge 295 296 None
-                              Branch 294
-             294:             Label
-             298:    7(fvec4) Load 297(bigColor4)
-             299:    7(fvec4) Load 9(color)
-             300:    7(fvec4) FAdd 299 298
-                              Store 9(color) 300
-             301:     21(ptr) AccessChain 9(color) 20
-             302:    6(float) Load 301
-             303:    6(float) Load 132(d4)
-             304:    17(bool) FOrdLessThan 302 303
-                              SelectionMerge 306 None
-                              BranchConditional 304 305 306
-             305:               Label
-                                Branch 296
+             275:     22(ptr)   AccessChain 9(color) 76
+             276:    6(float)   Load 275
+             277:    6(float)   FAdd 276 97
+                                Store 275 277
+                                Branch 259
+             259:               Label
+             278:    147(int)   Load 255(i)
+             279:    147(int)   IAdd 278 166
+                                Store 255(i) 279
+                                Branch 256
+             258:             Label
+                              Store 280(i) 150
+                              Branch 281
+             281:             Label
+                              LoopMerge 283 284 None
+                              Branch 285
+             285:             Label
+             286:    147(int) Load 280(i)
+             287:    18(bool) SLessThan 286 187
+                              BranchConditional 287 282 283
+             282:               Label
+             288:    6(float)   Load 115(d3)
+             289:     22(ptr)   AccessChain 9(color) 67
+             290:    6(float)   Load 289
+             291:    6(float)   FAdd 290 288
+             292:     22(ptr)   AccessChain 9(color) 67
+                                Store 292 291
+             293:     22(ptr)   AccessChain 9(color) 21
+             294:    6(float)   Load 293
+             295:    6(float)   Load 138(d4)
+             296:    18(bool)   FOrdLessThan 294 295
+                                SelectionMerge 298 None
+                                BranchConditional 296 297 298
+             297:                 Label
+                                  Branch 283
+             298:               Label
+             300:     22(ptr)   AccessChain 9(color) 76
+             301:    6(float)   Load 300
+             302:    6(float)   FAdd 301 97
+                                Store 300 302
+                                Branch 284
+             284:               Label
+             303:    147(int)   Load 280(i)
+             304:    147(int)   IAdd 303 166
+                                Store 280(i) 304
+                                Branch 281
+             283:             Label
+                              Branch 305
+             305:             Label
+                              LoopMerge 307 308 None
+                              Branch 306
              306:             Label
-             308:     21(ptr) AccessChain 9(color) 107
-             309:    6(float) Load 308
-             310:    6(float) Load 132(d4)
-             311:    17(bool) FOrdLessThan 309 310
-                              SelectionMerge 313 None
-                              BranchConditional 311 312 319
-             312:               Label
-             314:    6(float)   Load 132(d4)
-             315:     21(ptr)   AccessChain 9(color) 107
-             316:    6(float)   Load 315
-             317:    6(float)   FAdd 316 314
-             318:     21(ptr)   AccessChain 9(color) 107
-                                Store 318 317
-                                Branch 313
-             319:               Label
-             320:    6(float)   Load 132(d4)
-             321:     21(ptr)   AccessChain 9(color) 20
-             322:    6(float)   Load 321
-             323:    6(float)   FAdd 322 320
-             324:     21(ptr)   AccessChain 9(color) 20
-                                Store 324 323
-                                Branch 313
-             313:             Label
-                              Branch 296
-             296:             Label
-             325:     21(ptr) AccessChain 9(color) 64
-             326:    6(float) Load 325
-             327:    6(float) Load 132(d4)
-             328:    17(bool) FOrdLessThan 326 327
-                              BranchConditional 328 293 295
-             295:             Label
-                              Branch 329
-             329:             Label
-                              LoopMerge 331 332 None
-                              Branch 330
-             330:             Label
-             334:    7(fvec4) Load 333(bigColor5)
-             335:    7(fvec4) Load 9(color)
-             336:    7(fvec4) FAdd 335 334
-                              Store 9(color) 336
-             337:     21(ptr) AccessChain 9(color) 107
+             310:    7(fvec4) Load 309(bigColor4)
+             311:    7(fvec4) Load 9(color)
+             312:    7(fvec4) FAdd 311 310
+                              Store 9(color) 312
+             313:     22(ptr) AccessChain 9(color) 21
+             314:    6(float) Load 313
+             315:    6(float) Load 138(d4)
+             316:    18(bool) FOrdLessThan 314 315
+                              SelectionMerge 318 None
+                              BranchConditional 316 317 318
+             317:               Label
+                                Branch 308
+             318:             Label
+             320:     22(ptr) AccessChain 9(color) 112
+             321:    6(float) Load 320
+             322:    6(float) Load 138(d4)
+             323:    18(bool) FOrdLessThan 321 322
+                              SelectionMerge 325 None
+                              BranchConditional 323 324 331
+             324:               Label
+             326:    6(float)   Load 138(d4)
+             327:     22(ptr)   AccessChain 9(color) 112
+             328:    6(float)   Load 327
+             329:    6(float)   FAdd 328 326
+             330:     22(ptr)   AccessChain 9(color) 112
+                                Store 330 329
+                                Branch 325
+             331:               Label
+             332:    6(float)   Load 138(d4)
+             333:     22(ptr)   AccessChain 9(color) 21
+             334:    6(float)   Load 333
+             335:    6(float)   FAdd 334 332
+             336:     22(ptr)   AccessChain 9(color) 21
+                                Store 336 335
+                                Branch 325
+             325:             Label
+                              Branch 308
+             308:             Label
+             337:     22(ptr) AccessChain 9(color) 67
              338:    6(float) Load 337
-             340:    6(float) Load 339(d5)
-             341:    17(bool) FOrdLessThan 338 340
-                              SelectionMerge 343 None
-                              BranchConditional 341 342 343
-             342:               Label
-             344:    6(float)   Load 339(d5)
-             345:     21(ptr)   AccessChain 9(color) 107
-             346:    6(float)   Load 345
-             347:    6(float)   FAdd 346 344
-             348:     21(ptr)   AccessChain 9(color) 107
-                                Store 348 347
-                                Branch 343
-             343:             Label
-                              Branch 332
-             332:             Label
-             349:     21(ptr) AccessChain 9(color) 20
+             339:    6(float) Load 138(d4)
+             340:    18(bool) FOrdLessThan 338 339
+                              BranchConditional 340 305 307
+             307:             Label
+                              Branch 341
+             341:             Label
+                              LoopMerge 343 344 None
+                              Branch 342
+             342:             Label
+             346:    7(fvec4) Load 345(bigColor5)
+             347:    7(fvec4) Load 9(color)
+             348:    7(fvec4) FAdd 347 346
+                              Store 9(color) 348
+             349:     22(ptr) AccessChain 9(color) 112
              350:    6(float) Load 349
-             351:    6(float) Load 339(d5)
-             352:    17(bool) FOrdLessThan 350 351
-                              BranchConditional 352 329 331
-             331:             Label
-             353:     21(ptr) AccessChain 9(color) 20
-             354:    6(float) Load 353
-             356:    6(float) Load 355(d6)
-             357:    17(bool) FOrdLessThan 354 356
-                              SelectionMerge 359 None
-                              BranchConditional 357 358 372
-             358:               Label
-                                Branch 360
-             360:               Label
-             364:     21(ptr)   AccessChain 9(color) 107
-             365:    6(float)   Load 364
-             366:    6(float)   Load 355(d6)
-             367:    17(bool)   FOrdLessThan 365 366
-                                LoopMerge 362 363 None
-                                BranchConditional 367 361 362
-             361:                 Label
-             369:    7(fvec4)     Load 368(bigColor6)
-             370:    7(fvec4)     Load 9(color)
-             371:    7(fvec4)     FAdd 370 369
-                                  Store 9(color) 371
-                                  Branch 363
-             363:                 Label
-                                  Branch 360
-             362:               Label
-                                Branch 359
+             352:    6(float) Load 351(d5)
+             353:    18(bool) FOrdLessThan 350 352
+                              SelectionMerge 355 None
+                              BranchConditional 353 354 355
+             354:               Label
+             356:    6(float)   Load 351(d5)
+             357:     22(ptr)   AccessChain 9(color) 112
+             358:    6(float)   Load 357
+             359:    6(float)   FAdd 358 356
+             360:     22(ptr)   AccessChain 9(color) 112
+                                Store 360 359
+                                Branch 355
+             355:             Label
+                              Branch 344
+             344:             Label
+             361:     22(ptr) AccessChain 9(color) 21
+             362:    6(float) Load 361
+             363:    6(float) Load 351(d5)
+             364:    18(bool) FOrdLessThan 362 363
+                              BranchConditional 364 341 343
+             343:             Label
+             365:     22(ptr) AccessChain 9(color) 21
+             366:    6(float) Load 365
+             368:    6(float) Load 367(d6)
+             369:    18(bool) FOrdLessThan 366 368
+                              SelectionMerge 371 None
+                              BranchConditional 369 370 385
+             370:               Label
+                                Branch 372
              372:               Label
-                                Branch 373
-             373:               Label
-             377:     21(ptr)   AccessChain 9(color) 64
+                                LoopMerge 374 375 None
+                                Branch 376
+             376:               Label
+             377:     22(ptr)   AccessChain 9(color) 112
              378:    6(float)   Load 377
-             379:    6(float)   Load 355(d6)
-             380:    17(bool)   FOrdLessThan 378 379
-                                LoopMerge 375 376 None
-                                BranchConditional 380 374 375
-             374:                 Label
-             381:     51(ptr)     AccessChain 368(bigColor6) 64
-             382:    6(float)     Load 381
-             383:     21(ptr)     AccessChain 9(color) 64
-             384:    6(float)     Load 383
-             385:    6(float)     FAdd 384 382
-             386:     21(ptr)     AccessChain 9(color) 64
-                                  Store 386 385
-                                  Branch 376
-             376:                 Label
-                                  Branch 373
-             375:               Label
-                                Branch 359
-             359:             Label
-             387:     21(ptr) AccessChain 9(color) 20
-             388:    6(float) Load 387
-             389:    6(float) Load 355(d6)
-             390:    17(bool) FOrdLessThan 388 389
-                              SelectionMerge 392 None
-                              BranchConditional 390 391 410
-             391:               Label
-                                Branch 393
-             393:               Label
-             397:     21(ptr)   AccessChain 9(color) 107
-             398:    6(float)   Load 397
-             399:    6(float)   Load 355(d6)
-             400:    17(bool)   FOrdLessThan 398 399
-                                LoopMerge 395 396 None
-                                BranchConditional 400 394 395
-             394:                 Label
-             401:    7(fvec4)     Load 368(bigColor6)
-             402:    7(fvec4)     Load 9(color)
-             403:    7(fvec4)     FAdd 402 401
-                                  Store 9(color) 403
-             405:    6(float)     Load 404(d7)
-             406:    17(bool)     FOrdLessThan 405 93
-                                  SelectionMerge 408 None
-                                  BranchConditional 406 407 408
-             407:                   Label
-                                    Branch 395
-             408:                 Label
-                                  Branch 396
-             396:                 Label
-                                  Branch 393
-             395:               Label
-                                Branch 392
-             410:               Label
+             379:    6(float)   Load 367(d6)
+             380:    18(bool)   FOrdLessThan 378 379
+                                BranchConditional 380 373 374
+             373:                 Label
+             382:    7(fvec4)     Load 381(bigColor6)
+             383:    7(fvec4)     Load 9(color)
+             384:    7(fvec4)     FAdd 383 382
+                                  Store 9(color) 384
+                                  Branch 375
+             375:                 Label
+                                  Branch 372
+             374:               Label
+                                Branch 371
+             385:               Label
+                                Branch 386
+             386:               Label
+                                LoopMerge 388 389 None
+                                Branch 390
+             390:               Label
+             391:     22(ptr)   AccessChain 9(color) 67
+             392:    6(float)   Load 391
+             393:    6(float)   Load 367(d6)
+             394:    18(bool)   FOrdLessThan 392 393
+                                BranchConditional 394 387 388
+             387:                 Label
+             395:     53(ptr)     AccessChain 381(bigColor6) 67
+             396:    6(float)     Load 395
+             397:     22(ptr)     AccessChain 9(color) 67
+             398:    6(float)     Load 397
+             399:    6(float)     FAdd 398 396
+             400:     22(ptr)     AccessChain 9(color) 67
+                                  Store 400 399
+                                  Branch 389
+             389:                 Label
+                                  Branch 386
+             388:               Label
+                                Branch 371
+             371:             Label
+             401:     22(ptr) AccessChain 9(color) 21
+             402:    6(float) Load 401
+             403:    6(float) Load 367(d6)
+             404:    18(bool) FOrdLessThan 402 403
+                              SelectionMerge 406 None
+                              BranchConditional 404 405 425
+             405:               Label
+                                Branch 407
+             407:               Label
+                                LoopMerge 409 410 None
                                 Branch 411
              411:               Label
-             415:     21(ptr)   AccessChain 9(color) 64
-             416:    6(float)   Load 415
-             417:    6(float)   Load 355(d6)
-             418:    17(bool)   FOrdLessThan 416 417
-                                LoopMerge 413 414 None
-                                BranchConditional 418 412 413
-             412:                 Label
-             419:     51(ptr)     AccessChain 368(bigColor6) 64
-             420:    6(float)     Load 419
-             421:     21(ptr)     AccessChain 9(color) 64
-             422:    6(float)     Load 421
-             423:    6(float)     FAdd 422 420
-             424:     21(ptr)     AccessChain 9(color) 64
-                                  Store 424 423
-                                  Branch 414
-             414:                 Label
-                                  Branch 411
-             413:               Label
-                                Branch 392
-             392:             Label
-                              Branch 425
-             425:             Label
-                              LoopMerge 427 428 None
-                              Branch 426
-             426:             Label
-             429:    6(float) Load 404(d7)
-             431:    17(bool) FOrdLessThan 429 430
-                              SelectionMerge 433 None
-                              BranchConditional 431 432 433
-             432:               Label
-                                Branch 427
-             433:             Label
-             436:    7(fvec4) Load 435(bigColor7)
-             437:    7(fvec4) Load 9(color)
-             438:    7(fvec4) FAdd 437 436
-                              Store 9(color) 438
-             439:    6(float) Load 404(d7)
-             440:    17(bool) FOrdLessThan 439 93
-                              SelectionMerge 442 None
-                              BranchConditional 440 441 442
-             441:               Label
-             443:     21(ptr)   AccessChain 9(color) 64
-             444:    6(float)   Load 443
-             445:    6(float)   FAdd 444 93
-                                Store 443 445
-                                Branch 427
+             412:     22(ptr)   AccessChain 9(color) 112
+             413:    6(float)   Load 412
+             414:    6(float)   Load 367(d6)
+             415:    18(bool)   FOrdLessThan 413 414
+                                BranchConditional 415 408 409
+             408:                 Label
+             416:    7(fvec4)     Load 381(bigColor6)
+             417:    7(fvec4)     Load 9(color)
+             418:    7(fvec4)     FAdd 417 416
+                                  Store 9(color) 418
+             420:    6(float)     Load 419(d7)
+             421:    18(bool)     FOrdLessThan 420 97
+                                  SelectionMerge 423 None
+                                  BranchConditional 421 422 423
+             422:                   Label
+                                    Branch 409
+             423:                 Label
+                                  Branch 410
+             410:                 Label
+                                  Branch 407
+             409:               Label
+                                Branch 406
+             425:               Label
+                                Branch 426
+             426:               Label
+                                LoopMerge 428 429 None
+                                Branch 430
+             430:               Label
+             431:     22(ptr)   AccessChain 9(color) 67
+             432:    6(float)   Load 431
+             433:    6(float)   Load 367(d6)
+             434:    18(bool)   FOrdLessThan 432 433
+                                BranchConditional 434 427 428
+             427:                 Label
+             435:     53(ptr)     AccessChain 381(bigColor6) 67
+             436:    6(float)     Load 435
+             437:     22(ptr)     AccessChain 9(color) 67
+             438:    6(float)     Load 437
+             439:    6(float)     FAdd 438 436
+             440:     22(ptr)     AccessChain 9(color) 67
+                                  Store 440 439
+                                  Branch 429
+             429:                 Label
+                                  Branch 426
+             428:               Label
+                                Branch 406
+             406:             Label
+                              Branch 441
+             441:             Label
+                              LoopMerge 443 444 None
+                              Branch 442
              442:             Label
-             447:    7(fvec4) Load 11(BaseColor)
-             448:    7(fvec4) Load 9(color)
-             449:    7(fvec4) FAdd 448 447
-                              Store 9(color) 449
-                              Branch 428
-             428:             Label
-                              BranchConditional 18 425 427
-             427:             Label
-                              Branch 450
-             450:             Label
-                              LoopMerge 452 453 None
-                              Branch 451
-             451:             Label
-             455:    6(float) Load 454(d8)
-             456:    17(bool) FOrdLessThan 455 430
+             445:    6(float) Load 419(d7)
+             447:    18(bool) FOrdLessThan 445 446
+                              SelectionMerge 449 None
+                              BranchConditional 447 448 449
+             448:               Label
+                                Branch 443
+             449:             Label
+             452:    7(fvec4) Load 451(bigColor7)
+             453:    7(fvec4) Load 9(color)
+             454:    7(fvec4) FAdd 453 452
+                              Store 9(color) 454
+             455:    6(float) Load 419(d7)
+             456:    18(bool) FOrdLessThan 455 97
                               SelectionMerge 458 None
                               BranchConditional 456 457 458
              457:               Label
-                                Branch 452
+             459:     22(ptr)   AccessChain 9(color) 67
+             460:    6(float)   Load 459
+             461:    6(float)   FAdd 460 97
+                                Store 459 461
+                                Branch 443
              458:             Label
-             460:    7(fvec4) Load 435(bigColor7)
-             461:    7(fvec4) Load 9(color)
-             462:    7(fvec4) FAdd 461 460
-                              Store 9(color) 462
-             463:    6(float) Load 454(d8)
-             464:    17(bool) FOrdLessThan 463 93
-                              SelectionMerge 466 None
-                              BranchConditional 464 465 466
-             465:               Label
-             467:     21(ptr)   AccessChain 9(color) 64
-             468:    6(float)   Load 467
-             469:    6(float)   FAdd 468 93
-                                Store 467 469
-             470:    6(float)   Load 454(d8)
-             472:    17(bool)   FOrdLessThan 470 471
-                                SelectionMerge 474 None
-                                BranchConditional 472 473 478
-             473:                 Label
-             475:     21(ptr)     AccessChain 9(color) 107
-             476:    6(float)     Load 475
-             477:    6(float)     FAdd 476 93
-                                  Store 475 477
-                                  Branch 474
-             478:                 Label
-             479:     21(ptr)     AccessChain 9(color) 20
-             480:    6(float)     Load 479
-             481:    6(float)     FAdd 480 93
-                                  Store 479 481
-                                  Branch 474
-             474:               Label
-                                Branch 452
+             463:    7(fvec4) Load 11(BaseColor)
+             464:    7(fvec4) Load 9(color)
+             465:    7(fvec4) FAdd 464 463
+                              Store 9(color) 465
+                              Branch 444
+             444:             Label
+                              BranchConditional 19 441 443
+             443:             Label
+                              Branch 466
              466:             Label
-             483:    7(fvec4) Load 11(BaseColor)
-             484:    7(fvec4) Load 9(color)
-             485:    7(fvec4) FAdd 484 483
-                              Store 9(color) 485
-                              Branch 453
-             453:             Label
-             486:     21(ptr) AccessChain 9(color) 64
-             487:    6(float) Load 486
-             488:    6(float) Load 454(d8)
-             489:    17(bool) FOrdLessThan 487 488
-                              BranchConditional 489 450 452
-             452:             Label
-                              Branch 490
-             490:             Label
-             494:     21(ptr) AccessChain 9(color) 73
-             495:    6(float) Load 494
-             497:    6(float) Load 496(d9)
-             498:    17(bool) FOrdLessThan 495 497
-                              LoopMerge 492 493 None
-                              BranchConditional 498 491 492
-             491:               Label
-             499:    6(float)   Load 496(d9)
-             500:    6(float)   Load 454(d8)
-             501:    17(bool)   FOrdGreaterThan 499 500
-                                SelectionMerge 503 None
-                                BranchConditional 501 502 503
-             502:                 Label
-             504:     21(ptr)     AccessChain 9(color) 20
-             505:    6(float)     Load 504
-             506:    6(float)     Load 404(d7)
-             507:    17(bool)     FOrdLessThanEqual 505 506
-                                  SelectionMerge 509 None
-                                  BranchConditional 507 508 509
-             508:                   Label
-             510:     21(ptr)       AccessChain 9(color) 64
-             511:    6(float)       Load 510
-             513:    17(bool)       FOrdEqual 511 512
-                                    SelectionMerge 515 None
-                                    BranchConditional 513 514 519
-             514:                     Label
-             516:     21(ptr)         AccessChain 9(color) 73
-             517:    6(float)         Load 516
-             518:    6(float)         FAdd 517 93
-                                      Store 516 518
-                                      Branch 515
-             519:                     Label
-                                      Branch 492
-             515:                   Label
-                                    Branch 509
-             509:                 Label
-                                  Branch 503
-             503:               Label
-                                Branch 493
-             493:               Label
-                                Branch 490
-             492:             Label
-                              Branch 521
-             521:             Label
-             525:     21(ptr) AccessChain 9(color) 64
-             526:    6(float) Load 525
-             528:    6(float) Load 527(d10)
-             529:    17(bool) FOrdLessThan 526 528
-                              LoopMerge 523 524 None
-                              BranchConditional 529 522 523
-             522:               Label
-             530:     21(ptr)   AccessChain 9(color) 107
-             531:    6(float)   Load 530
-             532:    6(float)   FAdd 531 93
-                                Store 530 532
-             533:     21(ptr)   AccessChain 9(color) 107
-             534:    6(float)   Load 533
-             536:    6(float)   Load 535(d11)
-             537:    17(bool)   FOrdLessThan 534 536
-                                SelectionMerge 539 None
-                                BranchConditional 537 538 539
-             538:                 Label
-             540:     21(ptr)     AccessChain 9(color) 64
-             541:    6(float)     Load 540
-             542:    6(float)     FAdd 541 93
-                                  Store 540 542
-             543:     21(ptr)     AccessChain 9(color) 73
-             544:    6(float)     Load 543
-             546:    6(float)     Load 545(d12)
-             547:    17(bool)     FOrdLessThan 544 546
-                                  SelectionMerge 549 None
-                                  BranchConditional 547 548 553
-             548:                   Label
-             550:     21(ptr)       AccessChain 9(color) 73
-             551:    6(float)       Load 550
-             552:    6(float)       FAdd 551 93
-                                    Store 550 552
-                                    Branch 549
-             553:                   Label
-             554:     21(ptr)       AccessChain 9(color) 20
-             555:    6(float)       Load 554
-             556:    6(float)       FAdd 555 93
-                                    Store 554 556
-                                    Branch 549
-             549:                 Label
-                                  Branch 524
+                              LoopMerge 468 469 None
+                              Branch 467
+             467:             Label
+             471:    6(float) Load 470(d8)
+             472:    18(bool) FOrdLessThan 471 446
+                              SelectionMerge 474 None
+                              BranchConditional 472 473 474
+             473:               Label
+                                Branch 468
+             474:             Label
+             476:    7(fvec4) Load 451(bigColor7)
+             477:    7(fvec4) Load 9(color)
+             478:    7(fvec4) FAdd 477 476
+                              Store 9(color) 478
+             479:    6(float) Load 470(d8)
+             480:    18(bool) FOrdLessThan 479 97
+                              SelectionMerge 482 None
+                              BranchConditional 480 481 482
+             481:               Label
+             483:     22(ptr)   AccessChain 9(color) 67
+             484:    6(float)   Load 483
+             485:    6(float)   FAdd 484 97
+                                Store 483 485
+             486:    6(float)   Load 470(d8)
+             488:    18(bool)   FOrdLessThan 486 487
+                                SelectionMerge 490 None
+                                BranchConditional 488 489 494
+             489:                 Label
+             491:     22(ptr)     AccessChain 9(color) 112
+             492:    6(float)     Load 491
+             493:    6(float)     FAdd 492 97
+                                  Store 491 493
+                                  Branch 490
+             494:                 Label
+             495:     22(ptr)     AccessChain 9(color) 21
+             496:    6(float)     Load 495
+             497:    6(float)     FAdd 496 97
+                                  Store 495 497
+                                  Branch 490
+             490:               Label
+                                Branch 468
+             482:             Label
+             499:    7(fvec4) Load 11(BaseColor)
+             500:    7(fvec4) Load 9(color)
+             501:    7(fvec4) FAdd 500 499
+                              Store 9(color) 501
+                              Branch 469
+             469:             Label
+             502:     22(ptr) AccessChain 9(color) 67
+             503:    6(float) Load 502
+             504:    6(float) Load 470(d8)
+             505:    18(bool) FOrdLessThan 503 504
+                              BranchConditional 505 466 468
+             468:             Label
+                              Branch 506
+             506:             Label
+                              LoopMerge 508 509 None
+                              Branch 510
+             510:             Label
+             511:     22(ptr) AccessChain 9(color) 76
+             512:    6(float) Load 511
+             514:    6(float) Load 513(d9)
+             515:    18(bool) FOrdLessThan 512 514
+                              BranchConditional 515 507 508
+             507:               Label
+             516:    6(float)   Load 513(d9)
+             517:    6(float)   Load 470(d8)
+             518:    18(bool)   FOrdGreaterThan 516 517
+                                SelectionMerge 520 None
+                                BranchConditional 518 519 520
+             519:                 Label
+             521:     22(ptr)     AccessChain 9(color) 21
+             522:    6(float)     Load 521
+             523:    6(float)     Load 419(d7)
+             524:    18(bool)     FOrdLessThanEqual 522 523
+                                  SelectionMerge 526 None
+                                  BranchConditional 524 525 526
+             525:                   Label
+             527:     22(ptr)       AccessChain 9(color) 67
+             528:    6(float)       Load 527
+             530:    18(bool)       FOrdEqual 528 529
+                                    SelectionMerge 532 None
+                                    BranchConditional 530 531 536
+             531:                     Label
+             533:     22(ptr)         AccessChain 9(color) 76
+             534:    6(float)         Load 533
+             535:    6(float)         FAdd 534 97
+                                      Store 533 535
+                                      Branch 532
+             536:                     Label
+                                      Branch 508
+             532:                   Label
+                                    Branch 526
+             526:                 Label
+                                  Branch 520
+             520:               Label
+                                Branch 509
+             509:               Label
+                                Branch 506
+             508:             Label
+                              Branch 538
+             538:             Label
+                              LoopMerge 540 541 None
+                              Branch 542
+             542:             Label
+             543:     22(ptr) AccessChain 9(color) 67
+             544:    6(float) Load 543
+             546:    6(float) Load 545(d10)
+             547:    18(bool) FOrdLessThan 544 546
+                              BranchConditional 547 539 540
              539:               Label
-             558:    7(fvec4)   Load 9(color)
-             559:    7(fvec4)   CompositeConstruct 93 93 93 93
-             560:    7(fvec4)   FAdd 558 559
-                                Store 9(color) 560
-                                Branch 523
-             524:               Label
-                                Branch 521
-             523:             Label
-                              Branch 562
-             562:             Label
-             566:     21(ptr) AccessChain 9(color) 20
-             567:    6(float) Load 566
-             569:    17(bool) FOrdLessThan 567 568
-                              LoopMerge 564 565 None
-                              BranchConditional 569 563 564
-             563:               Label
-             571:    7(fvec4)   Load 570(bigColor8)
-             572:    7(fvec4)   Load 9(color)
-             573:    7(fvec4)   FAdd 572 571
-                                Store 9(color) 573
-             574:     21(ptr)   AccessChain 9(color) 64
-             575:    6(float)   Load 574
-             576:    6(float)   Load 454(d8)
-             577:    17(bool)   FOrdLessThan 575 576
-                                SelectionMerge 579 None
-                                BranchConditional 577 578 579
-             578:                 Label
-             580:     21(ptr)     AccessChain 9(color) 73
-             581:    6(float)     Load 580
-             582:    6(float)     Load 355(d6)
-             583:    17(bool)     FOrdLessThan 581 582
-                                  SelectionMerge 585 None
-                                  BranchConditional 583 584 585
-             584:                   Label
-                                    Branch 565
-             585:                 Label
-                                  Branch 579
-             579:               Label
-             587:     51(ptr)   AccessChain 570(bigColor8) 20
-             588:    6(float)   Load 587
-             589:     21(ptr)   AccessChain 9(color) 107
-             590:    6(float)   Load 589
-             591:    6(float)   FAdd 590 588
-             592:     21(ptr)   AccessChain 9(color) 107
-                                Store 592 591
-                                Branch 565
-             565:               Label
-                                Branch 562
-             564:             Label
-             593:    7(fvec4) Load 9(color)
-             594:    7(fvec4) CompositeConstruct 93 93 93 93
-             595:    7(fvec4) FAdd 593 594
-                              Store 9(color) 595
-             598:    7(fvec4) Load 9(color)
-                              Store 597(gl_FragColor) 598
-                              Branch 599
-             599:             Label
-             603:     21(ptr) AccessChain 9(color) 20
-             604:    6(float) Load 603
-             606:    6(float) Load 605(d14)
-             607:    17(bool) FOrdLessThan 604 606
-                              LoopMerge 601 602 None
-                              BranchConditional 607 600 601
-             600:               Label
-             608:     21(ptr)   AccessChain 9(color) 107
+             548:     22(ptr)   AccessChain 9(color) 112
+             549:    6(float)   Load 548
+             550:    6(float)   FAdd 549 97
+                                Store 548 550
+             551:     22(ptr)   AccessChain 9(color) 112
+             552:    6(float)   Load 551
+             554:    6(float)   Load 553(d11)
+             555:    18(bool)   FOrdLessThan 552 554
+                                SelectionMerge 557 None
+                                BranchConditional 555 556 557
+             556:                 Label
+             558:     22(ptr)     AccessChain 9(color) 67
+             559:    6(float)     Load 558
+             560:    6(float)     FAdd 559 97
+                                  Store 558 560
+             561:     22(ptr)     AccessChain 9(color) 76
+             562:    6(float)     Load 561
+             564:    6(float)     Load 563(d12)
+             565:    18(bool)     FOrdLessThan 562 564
+                                  SelectionMerge 567 None
+                                  BranchConditional 565 566 571
+             566:                   Label
+             568:     22(ptr)       AccessChain 9(color) 76
+             569:    6(float)       Load 568
+             570:    6(float)       FAdd 569 97
+                                    Store 568 570
+                                    Branch 567
+             571:                   Label
+             572:     22(ptr)       AccessChain 9(color) 21
+             573:    6(float)       Load 572
+             574:    6(float)       FAdd 573 97
+                                    Store 572 574
+                                    Branch 567
+             567:                 Label
+                                  Branch 541
+             557:               Label
+             576:    7(fvec4)   Load 9(color)
+             577:    7(fvec4)   CompositeConstruct 97 97 97 97
+             578:    7(fvec4)   FAdd 576 577
+                                Store 9(color) 578
+                                Branch 540
+             541:               Label
+                                Branch 538
+             540:             Label
+                              Branch 580
+             580:             Label
+                              LoopMerge 582 583 None
+                              Branch 584
+             584:             Label
+             585:     22(ptr) AccessChain 9(color) 21
+             586:    6(float) Load 585
+             588:    18(bool) FOrdLessThan 586 587
+                              BranchConditional 588 581 582
+             581:               Label
+             590:    7(fvec4)   Load 589(bigColor8)
+             591:    7(fvec4)   Load 9(color)
+             592:    7(fvec4)   FAdd 591 590
+                                Store 9(color) 592
+             593:     22(ptr)   AccessChain 9(color) 67
+             594:    6(float)   Load 593
+             595:    6(float)   Load 470(d8)
+             596:    18(bool)   FOrdLessThan 594 595
+                                SelectionMerge 598 None
+                                BranchConditional 596 597 598
+             597:                 Label
+             599:     22(ptr)     AccessChain 9(color) 76
+             600:    6(float)     Load 599
+             601:    6(float)     Load 367(d6)
+             602:    18(bool)     FOrdLessThan 600 601
+                                  SelectionMerge 604 None
+                                  BranchConditional 602 603 604
+             603:                   Label
+                                    Branch 583
+             604:                 Label
+                                  Branch 598
+             598:               Label
+             606:     53(ptr)   AccessChain 589(bigColor8) 21
+             607:    6(float)   Load 606
+             608:     22(ptr)   AccessChain 9(color) 112
              609:    6(float)   Load 608
-             611:    6(float)   Load 610(d15)
-             612:    17(bool)   FOrdLessThan 609 611
-                                SelectionMerge 614 None
-                                BranchConditional 612 613 616
-             613:                 Label
+             610:    6(float)   FAdd 609 607
+             611:     22(ptr)   AccessChain 9(color) 112
+                                Store 611 610
+                                Branch 583
+             583:               Label
+                                Branch 580
+             582:             Label
+             612:    7(fvec4) Load 9(color)
+             613:    7(fvec4) CompositeConstruct 97 97 97 97
+             614:    7(fvec4) FAdd 612 613
+                              Store 9(color) 614
+             617:    7(fvec4) Load 9(color)
+                              Store 616(gl_FragColor) 617
+                              Branch 618
+             618:             Label
+                              LoopMerge 620 621 None
+                              Branch 622
+             622:             Label
+             623:     22(ptr) AccessChain 9(color) 21
+             624:    6(float) Load 623
+             626:    6(float) Load 625(d14)
+             627:    18(bool) FOrdLessThan 624 626
+                              BranchConditional 627 619 620
+             619:               Label
+             628:     22(ptr)   AccessChain 9(color) 112
+             629:    6(float)   Load 628
+             631:    6(float)   Load 630(d15)
+             632:    18(bool)   FOrdLessThan 629 631
+                                SelectionMerge 634 None
+                                BranchConditional 632 633 636
+             633:                 Label
                                   Return
-             616:                 Label
-             617:    7(fvec4)     Load 9(color)
-             618:    7(fvec4)     CompositeConstruct 93 93 93 93
-             619:    7(fvec4)     FAdd 617 618
-                                  Store 9(color) 619
-                                  Branch 614
-             614:               Label
-                                Branch 602
-             602:               Label
-                                Branch 599
-             601:             Label
-             620:    7(fvec4) Load 9(color)
-             621:    7(fvec4) CompositeConstruct 93 93 93 93
-             622:    7(fvec4) FAdd 620 621
-                              Store 9(color) 622
-                              Branch 623
-             623:             Label
-             627:     21(ptr) AccessChain 9(color) 73
-             628:    6(float) Load 627
-             630:    6(float) Load 629(d16)
-             631:    17(bool) FOrdLessThan 628 630
-                              LoopMerge 625 626 None
-                              BranchConditional 631 624 625
-             624:               Label
-             632:     21(ptr)   AccessChain 9(color) 73
-             633:    6(float)   Load 632
-             634:    6(float)   FAdd 633 93
-                                Store 632 634
-                                Branch 626
-             626:               Label
-                                Branch 623
-             625:             Label
-                              Branch 635
-             635:             Label
-             639:     21(ptr) AccessChain 9(color) 73
-             640:    6(float) Load 639
-             641:    6(float) Load 102(d2)
-             642:    17(bool) FOrdLessThan 640 641
-                              SelectionMerge 644 None
-                              BranchConditional 642 643 644
-             643:               Label
-             645:     21(ptr)   AccessChain 9(color) 107
-             646:    6(float)   Load 645
-             647:    6(float)   Load 110(d3)
-             648:    17(bool)   FOrdLessThan 646 647
-                                Branch 644
-             644:             Label
-             649:    17(bool) Phi 642 635 648 643
-                              LoopMerge 637 638 None
-                              BranchConditional 649 636 637
-             636:               Label
-             650:    7(fvec4)   Load 114(bigColor1_2)
-             651:    7(fvec4)   Load 9(color)
-             652:    7(fvec4)   FAdd 651 650
-                                Store 9(color) 652
-             653:     21(ptr)   AccessChain 9(color) 64
+             636:                 Label
+             637:    7(fvec4)     Load 9(color)
+             638:    7(fvec4)     CompositeConstruct 97 97 97 97
+             639:    7(fvec4)     FAdd 637 638
+                                  Store 9(color) 639
+                                  Branch 634
+             634:               Label
+                                Branch 621
+             621:               Label
+                                Branch 618
+             620:             Label
+             640:    7(fvec4) Load 9(color)
+             641:    7(fvec4) CompositeConstruct 97 97 97 97
+             642:    7(fvec4) FAdd 640 641
+                              Store 9(color) 642
+                              Branch 643
+             643:             Label
+                              LoopMerge 645 646 None
+                              Branch 647
+             647:             Label
+             648:     22(ptr) AccessChain 9(color) 76
+             649:    6(float) Load 648
+             651:    6(float) Load 650(d16)
+             652:    18(bool) FOrdLessThan 649 651
+                              BranchConditional 652 644 645
+             644:               Label
+             653:     22(ptr)   AccessChain 9(color) 76
              654:    6(float)   Load 653
-             655:    6(float)   Load 110(d3)
-             656:    17(bool)   FOrdLessThan 654 655
-                                SelectionMerge 658 None
-                                BranchConditional 656 657 658
-             657:                 Label
-                                  Return
-             658:               Label
-                                Branch 638
-             638:               Label
-                                Branch 635
-             637:             Label
+             655:    6(float)   FAdd 654 97
+                                Store 653 655
+                                Branch 646
+             646:               Label
+                                Branch 643
+             645:             Label
+                              Branch 656
+             656:             Label
+                              LoopMerge 658 659 None
                               Branch 660
              660:             Label
-                              LoopMerge 662 663 None
-                              Branch 661
-             661:             Label
-             664:     21(ptr) AccessChain 9(color) 107
-             665:    6(float) Load 664
-             667:    6(float) Load 666(d18)
-             668:    17(bool) FOrdLessThan 665 667
-                              SelectionMerge 670 None
-                              BranchConditional 668 669 670
-             669:               Label
-                                Return
-             670:             Label
-             672:    7(fvec4) Load 9(color)
-             673:    7(fvec4) CompositeConstruct 93 93 93 93
-             674:    7(fvec4) FAdd 672 673
+             661:     22(ptr) AccessChain 9(color) 76
+             662:    6(float) Load 661
+             663:    6(float) Load 107(d2)
+             664:    18(bool) FOrdLessThan 662 663
+                              SelectionMerge 666 None
+                              BranchConditional 664 665 666
+             665:               Label
+             667:     22(ptr)   AccessChain 9(color) 112
+             668:    6(float)   Load 667
+             669:    6(float)   Load 115(d3)
+             670:    18(bool)   FOrdLessThan 668 669
+                                Branch 666
+             666:             Label
+             671:    18(bool) Phi 664 660 670 665
+                              BranchConditional 671 657 658
+             657:             Label
+             672:    7(fvec4) Load 119(bigColor1_2)
+             673:    7(fvec4) Load 9(color)
+             674:    7(fvec4) FAdd 673 672
                               Store 9(color) 674
-                              Branch 663
-             663:             Label
-             675:     21(ptr) AccessChain 9(color) 20
+             675:     22(ptr) AccessChain 9(color) 67
              676:    6(float) Load 675
-             678:    6(float) Load 677(d17)
-             679:    17(bool) FOrdLessThan 676 678
-                              BranchConditional 679 660 662
-             662:             Label
-                              Branch 680
+             677:    6(float) Load 115(d3)
+             678:    18(bool) FOrdLessThan 676 677
+                              SelectionMerge 680 None
+                              BranchConditional 678 679 680
+             679:               Label
+                                Return
              680:             Label
-             684:     21(ptr) AccessChain 9(color) 107
-             685:    6(float) Load 684
-             686:    6(float) Load 629(d16)
-             687:    17(bool) FOrdLessThan 685 686
-                              LoopMerge 682 683 None
-                              BranchConditional 687 681 682
-             681:               Label
-             688:     21(ptr)   AccessChain 9(color) 73
-             689:    6(float)   Load 688
-             690:    6(float)   Load 629(d16)
-             691:    17(bool)   FOrdLessThan 689 690
-                                SelectionMerge 693 None
-                                BranchConditional 691 692 695
-             692:                 Label
-                                  Kill
-             695:                 Label
-             696:    7(fvec4)     Load 9(color)
-             697:    7(fvec4)     CompositeConstruct 93 93 93 93
-             698:    7(fvec4)     FAdd 696 697
-                                  Store 9(color) 698
-                                  Branch 693
-             693:               Label
-                                Branch 683
-             683:               Label
-                                Branch 680
+                              Branch 659
+             659:             Label
+                              Branch 656
+             658:             Label
+                              Branch 682
              682:             Label
-             699:    7(fvec4) Load 9(color)
-             700:    7(fvec4) CompositeConstruct 93 93 93 93
-             701:    7(fvec4) FAdd 699 700
-                              Store 9(color) 701
-             702:    7(fvec4) Load 9(color)
-                              Store 597(gl_FragColor) 702
+                              LoopMerge 684 685 None
+                              Branch 683
+             683:             Label
+             686:     22(ptr) AccessChain 9(color) 112
+             687:    6(float) Load 686
+             689:    6(float) Load 688(d18)
+             690:    18(bool) FOrdLessThan 687 689
+                              SelectionMerge 692 None
+                              BranchConditional 690 691 692
+             691:               Label
+                                Return
+             692:             Label
+             694:    7(fvec4) Load 9(color)
+             695:    7(fvec4) CompositeConstruct 97 97 97 97
+             696:    7(fvec4) FAdd 694 695
+                              Store 9(color) 696
+                              Branch 685
+             685:             Label
+             697:     22(ptr) AccessChain 9(color) 21
+             698:    6(float) Load 697
+             700:    6(float) Load 699(d17)
+             701:    18(bool) FOrdLessThan 698 700
+                              BranchConditional 701 682 684
+             684:             Label
+                              Branch 702
+             702:             Label
+                              LoopMerge 704 705 None
+                              Branch 706
+             706:             Label
+             707:     22(ptr) AccessChain 9(color) 112
+             708:    6(float) Load 707
+             709:    6(float) Load 650(d16)
+             710:    18(bool) FOrdLessThan 708 709
+                              BranchConditional 710 703 704
+             703:               Label
+             711:     22(ptr)   AccessChain 9(color) 76
+             712:    6(float)   Load 711
+             713:    6(float)   Load 650(d16)
+             714:    18(bool)   FOrdLessThan 712 713
+                                SelectionMerge 716 None
+                                BranchConditional 714 715 718
+             715:                 Label
+                                  Kill
+             718:                 Label
+             719:    7(fvec4)     Load 9(color)
+             720:    7(fvec4)     CompositeConstruct 97 97 97 97
+             721:    7(fvec4)     FAdd 719 720
+                                  Store 9(color) 721
+                                  Branch 716
+             716:               Label
+                                Branch 705
+             705:               Label
+                                Branch 702
+             704:             Label
+             722:    7(fvec4) Load 9(color)
+             723:    7(fvec4) CompositeConstruct 97 97 97 97
+             724:    7(fvec4) FAdd 722 723
+                              Store 9(color) 724
+             725:    7(fvec4) Load 9(color)
+                              Store 616(gl_FragColor) 725
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/spv.loopsArtificial.frag.out b/Test/baseResults/spv.loopsArtificial.frag.out
index e1bf085..7de618f 100755
--- a/Test/baseResults/spv.loopsArtificial.frag.out
+++ b/Test/baseResults/spv.loopsArtificial.frag.out
@@ -7,12 +7,12 @@
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 187
+// Id's are bound by 188
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 11 140
+                              EntryPoint Fragment 4  "main" 11 141
                               ExecutionMode 4 OriginLowerLeft
                               Source GLSL 130
                               Name 4  "main"
@@ -20,51 +20,51 @@
                               Name 11  "BaseColor"
                               Name 18  "bigColor4"
                               Name 28  "d4"
-                              Name 80  "d13"
-                              Name 140  "gl_FragColor"
-                              Name 142  "bigColor"
-                              Name 143  "bigColor1_1"
-                              Name 144  "bigColor1_2"
-                              Name 145  "bigColor1_3"
-                              Name 146  "bigColor2"
-                              Name 147  "bigColor3"
-                              Name 148  "bigColor5"
-                              Name 149  "bigColor6"
-                              Name 150  "bigColor7"
-                              Name 151  "bigColor8"
-                              Name 152  "d"
-                              Name 153  "d2"
-                              Name 154  "d3"
-                              Name 155  "d5"
-                              Name 156  "d6"
-                              Name 157  "d7"
-                              Name 158  "d8"
-                              Name 159  "d9"
-                              Name 160  "d10"
-                              Name 161  "d11"
-                              Name 162  "d12"
-                              Name 163  "d14"
-                              Name 164  "d15"
-                              Name 165  "d16"
-                              Name 166  "d17"
-                              Name 167  "d18"
-                              Name 168  "d19"
-                              Name 169  "d20"
-                              Name 170  "d21"
-                              Name 171  "d22"
-                              Name 172  "d23"
-                              Name 173  "d24"
-                              Name 174  "d25"
-                              Name 175  "d26"
-                              Name 176  "d27"
-                              Name 177  "d28"
-                              Name 178  "d29"
-                              Name 179  "d30"
-                              Name 180  "d31"
-                              Name 181  "d32"
-                              Name 182  "d33"
-                              Name 183  "d34"
-                              Name 186  "Count"
+                              Name 81  "d13"
+                              Name 141  "gl_FragColor"
+                              Name 143  "bigColor"
+                              Name 144  "bigColor1_1"
+                              Name 145  "bigColor1_2"
+                              Name 146  "bigColor1_3"
+                              Name 147  "bigColor2"
+                              Name 148  "bigColor3"
+                              Name 149  "bigColor5"
+                              Name 150  "bigColor6"
+                              Name 151  "bigColor7"
+                              Name 152  "bigColor8"
+                              Name 153  "d"
+                              Name 154  "d2"
+                              Name 155  "d3"
+                              Name 156  "d5"
+                              Name 157  "d6"
+                              Name 158  "d7"
+                              Name 159  "d8"
+                              Name 160  "d9"
+                              Name 161  "d10"
+                              Name 162  "d11"
+                              Name 163  "d12"
+                              Name 164  "d14"
+                              Name 165  "d15"
+                              Name 166  "d16"
+                              Name 167  "d17"
+                              Name 168  "d18"
+                              Name 169  "d19"
+                              Name 170  "d20"
+                              Name 171  "d21"
+                              Name 172  "d22"
+                              Name 173  "d23"
+                              Name 174  "d24"
+                              Name 175  "d25"
+                              Name 176  "d26"
+                              Name 177  "d27"
+                              Name 178  "d28"
+                              Name 179  "d29"
+                              Name 180  "d30"
+                              Name 181  "d31"
+                              Name 182  "d32"
+                              Name 183  "d33"
+                              Name 184  "d34"
+                              Name 187  "Count"
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -84,55 +84,55 @@
               35:     22(int) Constant 2
               48:    6(float) Constant 1065353216
               51:     22(int) Constant 1
-              77:     22(int) Constant 3
-         80(d13):     27(ptr) Variable UniformConstant
-             139:             TypePointer Output 7(fvec4)
-140(gl_FragColor):    139(ptr) Variable Output
-   142(bigColor):     17(ptr) Variable UniformConstant
-143(bigColor1_1):     17(ptr) Variable UniformConstant
-144(bigColor1_2):     17(ptr) Variable UniformConstant
-145(bigColor1_3):     17(ptr) Variable UniformConstant
-  146(bigColor2):     17(ptr) Variable UniformConstant
-  147(bigColor3):     17(ptr) Variable UniformConstant
-  148(bigColor5):     17(ptr) Variable UniformConstant
-  149(bigColor6):     17(ptr) Variable UniformConstant
-  150(bigColor7):     17(ptr) Variable UniformConstant
-  151(bigColor8):     17(ptr) Variable UniformConstant
-          152(d):     27(ptr) Variable UniformConstant
-         153(d2):     27(ptr) Variable UniformConstant
-         154(d3):     27(ptr) Variable UniformConstant
-         155(d5):     27(ptr) Variable UniformConstant
-         156(d6):     27(ptr) Variable UniformConstant
-         157(d7):     27(ptr) Variable UniformConstant
-         158(d8):     27(ptr) Variable UniformConstant
-         159(d9):     27(ptr) Variable UniformConstant
-        160(d10):     27(ptr) Variable UniformConstant
-        161(d11):     27(ptr) Variable UniformConstant
-        162(d12):     27(ptr) Variable UniformConstant
-        163(d14):     27(ptr) Variable UniformConstant
-        164(d15):     27(ptr) Variable UniformConstant
-        165(d16):     27(ptr) Variable UniformConstant
-        166(d17):     27(ptr) Variable UniformConstant
-        167(d18):     27(ptr) Variable UniformConstant
-        168(d19):     27(ptr) Variable UniformConstant
-        169(d20):     27(ptr) Variable UniformConstant
-        170(d21):     27(ptr) Variable UniformConstant
-        171(d22):     27(ptr) Variable UniformConstant
-        172(d23):     27(ptr) Variable UniformConstant
-        173(d24):     27(ptr) Variable UniformConstant
-        174(d25):     27(ptr) Variable UniformConstant
-        175(d26):     27(ptr) Variable UniformConstant
-        176(d27):     27(ptr) Variable UniformConstant
-        177(d28):     27(ptr) Variable UniformConstant
-        178(d29):     27(ptr) Variable UniformConstant
-        179(d30):     27(ptr) Variable UniformConstant
-        180(d31):     27(ptr) Variable UniformConstant
-        181(d32):     27(ptr) Variable UniformConstant
-        182(d33):     27(ptr) Variable UniformConstant
-        183(d34):     27(ptr) Variable UniformConstant
-             184:             TypeInt 32 1
-             185:             TypePointer UniformConstant 184(int)
-      186(Count):    185(ptr) Variable UniformConstant
+              78:     22(int) Constant 3
+         81(d13):     27(ptr) Variable UniformConstant
+             140:             TypePointer Output 7(fvec4)
+141(gl_FragColor):    140(ptr) Variable Output
+   143(bigColor):     17(ptr) Variable UniformConstant
+144(bigColor1_1):     17(ptr) Variable UniformConstant
+145(bigColor1_2):     17(ptr) Variable UniformConstant
+146(bigColor1_3):     17(ptr) Variable UniformConstant
+  147(bigColor2):     17(ptr) Variable UniformConstant
+  148(bigColor3):     17(ptr) Variable UniformConstant
+  149(bigColor5):     17(ptr) Variable UniformConstant
+  150(bigColor6):     17(ptr) Variable UniformConstant
+  151(bigColor7):     17(ptr) Variable UniformConstant
+  152(bigColor8):     17(ptr) Variable UniformConstant
+          153(d):     27(ptr) Variable UniformConstant
+         154(d2):     27(ptr) Variable UniformConstant
+         155(d3):     27(ptr) Variable UniformConstant
+         156(d5):     27(ptr) Variable UniformConstant
+         157(d6):     27(ptr) Variable UniformConstant
+         158(d7):     27(ptr) Variable UniformConstant
+         159(d8):     27(ptr) Variable UniformConstant
+         160(d9):     27(ptr) Variable UniformConstant
+        161(d10):     27(ptr) Variable UniformConstant
+        162(d11):     27(ptr) Variable UniformConstant
+        163(d12):     27(ptr) Variable UniformConstant
+        164(d14):     27(ptr) Variable UniformConstant
+        165(d15):     27(ptr) Variable UniformConstant
+        166(d16):     27(ptr) Variable UniformConstant
+        167(d17):     27(ptr) Variable UniformConstant
+        168(d18):     27(ptr) Variable UniformConstant
+        169(d19):     27(ptr) Variable UniformConstant
+        170(d20):     27(ptr) Variable UniformConstant
+        171(d21):     27(ptr) Variable UniformConstant
+        172(d22):     27(ptr) Variable UniformConstant
+        173(d23):     27(ptr) Variable UniformConstant
+        174(d24):     27(ptr) Variable UniformConstant
+        175(d25):     27(ptr) Variable UniformConstant
+        176(d26):     27(ptr) Variable UniformConstant
+        177(d27):     27(ptr) Variable UniformConstant
+        178(d28):     27(ptr) Variable UniformConstant
+        179(d29):     27(ptr) Variable UniformConstant
+        180(d30):     27(ptr) Variable UniformConstant
+        181(d31):     27(ptr) Variable UniformConstant
+        182(d32):     27(ptr) Variable UniformConstant
+        183(d33):     27(ptr) Variable UniformConstant
+        184(d34):     27(ptr) Variable UniformConstant
+             185:             TypeInt 32 1
+             186:             TypePointer UniformConstant 185(int)
+      187(Count):    186(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
         9(color):      8(ptr) Variable Function
@@ -207,95 +207,97 @@
               15:             Label
                               Branch 73
               73:             Label
-              78:     24(ptr) AccessChain 9(color) 77
-              79:    6(float) Load 78
-              81:    6(float) Load 80(d13)
-              82:    30(bool) FOrdLessThan 79 81
                               LoopMerge 75 76 None
-                              BranchConditional 82 74 75
+                              Branch 77
+              77:             Label
+              79:     24(ptr) AccessChain 9(color) 78
+              80:    6(float) Load 79
+              82:    6(float) Load 81(d13)
+              83:    30(bool) FOrdLessThan 80 82
+                              BranchConditional 83 74 75
               74:               Label
-              83:     24(ptr)   AccessChain 9(color) 35
-              84:    6(float)   Load 83
-              85:    6(float)   Load 80(d13)
-              86:    30(bool)   FOrdLessThan 84 85
-                                SelectionMerge 88 None
-                                BranchConditional 86 87 92
-              87:                 Label
-              89:    7(fvec4)     Load 9(color)
-              90:    7(fvec4)     CompositeConstruct 48 48 48 48
-              91:    7(fvec4)     FAdd 89 90
-                                  Store 9(color) 91
-                                  Branch 88
-              92:                 Label
-              93:    7(fvec4)     Load 9(color)
-              94:    7(fvec4)     CompositeConstruct 48 48 48 48
-              95:    7(fvec4)     FSub 93 94
-                                  Store 9(color) 95
-                                  Branch 88
-              88:               Label
-              96:    7(fvec4)   Load 18(bigColor4)
-              97:    7(fvec4)   Load 9(color)
-              98:    7(fvec4)   FAdd 97 96
-                                Store 9(color) 98
-              99:     24(ptr)   AccessChain 9(color) 23
-             100:    6(float)   Load 99
-             101:    6(float)   Load 28(d4)
-             102:    30(bool)   FOrdLessThan 100 101
-                                SelectionMerge 104 None
-                                BranchConditional 102 103 104
-             103:                 Label
-             105:     24(ptr)     AccessChain 9(color) 35
-             106:    6(float)     Load 105
-             107:    6(float)     FAdd 106 34
-             108:     24(ptr)     AccessChain 9(color) 35
-                                  Store 108 107
+              84:     24(ptr)   AccessChain 9(color) 35
+              85:    6(float)   Load 84
+              86:    6(float)   Load 81(d13)
+              87:    30(bool)   FOrdLessThan 85 86
+                                SelectionMerge 89 None
+                                BranchConditional 87 88 93
+              88:                 Label
+              90:    7(fvec4)     Load 9(color)
+              91:    7(fvec4)     CompositeConstruct 48 48 48 48
+              92:    7(fvec4)     FAdd 90 91
+                                  Store 9(color) 92
+                                  Branch 89
+              93:                 Label
+              94:    7(fvec4)     Load 9(color)
+              95:    7(fvec4)     CompositeConstruct 48 48 48 48
+              96:    7(fvec4)     FSub 94 95
+                                  Store 9(color) 96
+                                  Branch 89
+              89:               Label
+              97:    7(fvec4)   Load 18(bigColor4)
+              98:    7(fvec4)   Load 9(color)
+              99:    7(fvec4)   FAdd 98 97
+                                Store 9(color) 99
+             100:     24(ptr)   AccessChain 9(color) 23
+             101:    6(float)   Load 100
+             102:    6(float)   Load 28(d4)
+             103:    30(bool)   FOrdLessThan 101 102
+                                SelectionMerge 105 None
+                                BranchConditional 103 104 105
+             104:                 Label
+             106:     24(ptr)     AccessChain 9(color) 35
+             107:    6(float)     Load 106
+             108:    6(float)     FAdd 107 34
              109:     24(ptr)     AccessChain 9(color) 35
-             110:    6(float)     Load 109
-             111:    6(float)     Load 28(d4)
-             112:    30(bool)     FOrdLessThan 110 111
-                                  SelectionMerge 114 None
-                                  BranchConditional 112 113 114
-             113:                   Label
-             115:     24(ptr)       AccessChain 9(color) 23
-             116:    6(float)       Load 115
-             117:    6(float)       FAdd 116 48
-                                    Store 115 117
+                                  Store 109 108
+             110:     24(ptr)     AccessChain 9(color) 35
+             111:    6(float)     Load 110
+             112:    6(float)     Load 28(d4)
+             113:    30(bool)     FOrdLessThan 111 112
+                                  SelectionMerge 115 None
+                                  BranchConditional 113 114 115
+             114:                   Label
+             116:     24(ptr)       AccessChain 9(color) 23
+             117:    6(float)       Load 116
+             118:    6(float)       FAdd 117 48
+                                    Store 116 118
                                     Branch 76
-             114:                 Label
-                                  Branch 104
-             104:               Label
-             119:     24(ptr)   AccessChain 9(color) 51
-             120:    6(float)   Load 119
-             121:    6(float)   Load 28(d4)
-             122:    30(bool)   FOrdLessThan 120 121
-                                SelectionMerge 124 None
-                                BranchConditional 122 123 130
-             123:                 Label
-             125:    6(float)     Load 28(d4)
-             126:     24(ptr)     AccessChain 9(color) 51
-             127:    6(float)     Load 126
-             128:    6(float)     FAdd 127 125
-             129:     24(ptr)     AccessChain 9(color) 51
-                                  Store 129 128
-                                  Branch 124
-             130:                 Label
-             131:    6(float)     Load 28(d4)
-             132:     24(ptr)     AccessChain 9(color) 23
-             133:    6(float)     Load 132
-             134:    6(float)     FAdd 133 131
-             135:     24(ptr)     AccessChain 9(color) 23
-                                  Store 135 134
-                                  Branch 124
-             124:               Label
+             115:                 Label
+                                  Branch 105
+             105:               Label
+             120:     24(ptr)   AccessChain 9(color) 51
+             121:    6(float)   Load 120
+             122:    6(float)   Load 28(d4)
+             123:    30(bool)   FOrdLessThan 121 122
+                                SelectionMerge 125 None
+                                BranchConditional 123 124 131
+             124:                 Label
+             126:    6(float)     Load 28(d4)
+             127:     24(ptr)     AccessChain 9(color) 51
+             128:    6(float)     Load 127
+             129:    6(float)     FAdd 128 126
+             130:     24(ptr)     AccessChain 9(color) 51
+                                  Store 130 129
+                                  Branch 125
+             131:                 Label
+             132:    6(float)     Load 28(d4)
+             133:     24(ptr)     AccessChain 9(color) 23
+             134:    6(float)     Load 133
+             135:    6(float)     FAdd 134 132
+             136:     24(ptr)     AccessChain 9(color) 23
+                                  Store 136 135
+                                  Branch 125
+             125:               Label
                                 Branch 76
               76:               Label
                                 Branch 73
               75:             Label
-             136:    7(fvec4) Load 9(color)
-             137:    7(fvec4) CompositeConstruct 48 48 48 48
-             138:    7(fvec4) FAdd 136 137
-                              Store 9(color) 138
-             141:    7(fvec4) Load 9(color)
-                              Store 140(gl_FragColor) 141
+             137:    7(fvec4) Load 9(color)
+             138:    7(fvec4) CompositeConstruct 48 48 48 48
+             139:    7(fvec4) FAdd 137 138
+                              Store 9(color) 139
+             142:    7(fvec4) Load 9(color)
+                              Store 141(gl_FragColor) 142
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/spv.switch.frag.out b/Test/baseResults/spv.switch.frag.out
index efd2df0..74f4463 100755
--- a/Test/baseResults/spv.switch.frag.out
+++ b/Test/baseResults/spv.switch.frag.out
@@ -10,12 +10,12 @@
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 267
+// Id's are bound by 269
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 75 225
+                              EntryPoint Fragment 4  "main" 75 227
                               ExecutionMode 4 OriginLowerLeft
                               Source ESSL 310
                               Name 4  "main"
@@ -33,24 +33,24 @@
                               Name 75  "x"
                               Name 129  "d"
                               Name 155  "i"
-                              Name 174  "j"
-                              Name 225  "color"
-                              Name 231  "v"
-                              Name 232  "param"
+                              Name 175  "j"
+                              Name 227  "color"
+                              Name 233  "v"
                               Name 234  "param"
                               Name 236  "param"
-                              Name 244  "param"
+                              Name 238  "param"
                               Name 246  "param"
                               Name 248  "param"
+                              Name 250  "param"
                               Decorate 60(local) RelaxedPrecision
                               Decorate 62(c) RelaxedPrecision
                               Decorate 73(f) RelaxedPrecision
                               Decorate 75(x) RelaxedPrecision
                               Decorate 129(d) RelaxedPrecision
                               Decorate 155(i) RelaxedPrecision
-                              Decorate 174(j) RelaxedPrecision
-                              Decorate 225(color) RelaxedPrecision
-                              Decorate 231(v) RelaxedPrecision
+                              Decorate 175(j) RelaxedPrecision
+                              Decorate 227(color) RelaxedPrecision
+                              Decorate 233(v) RelaxedPrecision
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -71,31 +71,31 @@
            75(x):     74(ptr) Variable Input
           129(d):     61(ptr) Variable UniformConstant
              156:      9(int) Constant 0
-             162:      9(int) Constant 10
-             163:             TypeBool
-             175:      9(int) Constant 20
-             181:      9(int) Constant 30
-             186:    6(float) Constant 1120429670
-             206:    6(float) Constant 1079739679
-             224:             TypePointer Output 6(float)
-      225(color):    224(ptr) Variable Output
-             230:             TypePointer UniformConstant 7(fvec4)
-          231(v):    230(ptr) Variable UniformConstant
-             239:             TypeInt 32 0
-             240:    239(int) Constant 1
-             251:    239(int) Constant 2
+             163:      9(int) Constant 10
+             164:             TypeBool
+             176:      9(int) Constant 20
+             183:      9(int) Constant 30
+             188:    6(float) Constant 1120429670
+             208:    6(float) Constant 1079739679
+             226:             TypePointer Output 6(float)
+      227(color):    226(ptr) Variable Output
+             232:             TypePointer UniformConstant 7(fvec4)
+          233(v):    232(ptr) Variable UniformConstant
+             241:             TypeInt 32 0
+             242:    241(int) Constant 1
+             253:    241(int) Constant 2
          4(main):           2 Function None 3
                5:             Label
        60(local):     10(ptr) Variable Function
            73(f):     72(ptr) Variable Function
           155(i):     10(ptr) Variable Function
-          174(j):     10(ptr) Variable Function
-      232(param):      8(ptr) Variable Function
+          175(j):     10(ptr) Variable Function
       234(param):      8(ptr) Variable Function
-      236(param):     10(ptr) Variable Function
-      244(param):      8(ptr) Variable Function
+      236(param):      8(ptr) Variable Function
+      238(param):     10(ptr) Variable Function
       246(param):      8(ptr) Variable Function
-      248(param):     10(ptr) Variable Function
+      248(param):      8(ptr) Variable Function
+      250(param):     10(ptr) Variable Function
               63:      9(int) Load 62(c)
                               Store 60(local) 63
               64:      9(int) Load 60(local)
@@ -218,134 +218,138 @@
                               Store 155(i) 156
                               Branch 157
              157:             Label
-             161:      9(int) Load 155(i)
-             164:   163(bool) SLessThan 161 162
                               LoopMerge 159 160 None
-                              BranchConditional 164 158 159
+                              Branch 161
+             161:             Label
+             162:      9(int) Load 155(i)
+             165:   164(bool) SLessThan 162 163
+                              BranchConditional 165 158 159
              158:               Label
-             165:      9(int)   Load 62(c)
-                                SelectionMerge 169 None
-                                Switch 165 168 
-                                       case 1: 166
-                                       case 2: 167
-             168:                 Label
-             200:    6(float)     Load 75(x)
-             201:    6(float)     ExtInst 1(GLSL.std.450) 15(Tan) 200
-             202:    6(float)     Load 73(f)
-             203:    6(float)     FAdd 202 201
-                                  Store 73(f) 203
-                                  Branch 169
-             166:                 Label
-             170:    6(float)     Load 75(x)
-             171:    6(float)     ExtInst 1(GLSL.std.450) 13(Sin) 170
-             172:    6(float)     Load 73(f)
-             173:    6(float)     FAdd 172 171
-                                  Store 73(f) 173
-                                  Store 174(j) 175
-                                  Branch 176
-             176:                 Label
-             180:      9(int)     Load 174(j)
-             182:   163(bool)     SLessThan 180 181
-                                  LoopMerge 178 179 None
-                                  BranchConditional 182 177 178
-             177:                   Label
-             183:    6(float)       Load 73(f)
-             184:    6(float)       FAdd 183 48
-                                    Store 73(f) 184
-             185:    6(float)       Load 73(f)
-             187:   163(bool)       FOrdLessThan 185 186
-                                    SelectionMerge 189 None
-                                    BranchConditional 187 188 189
-             188:                     Label
-                                      Branch 178
-             189:                   Label
-                                    Branch 179
-             179:                   Label
-             191:      9(int)       Load 174(j)
-             192:      9(int)       IAdd 191 65
-                                    Store 174(j) 192
-                                    Branch 176
-             178:                 Label
-                                  Branch 169
+             166:      9(int)   Load 62(c)
+                                SelectionMerge 170 None
+                                Switch 166 169 
+                                       case 1: 167
+                                       case 2: 168
+             169:                 Label
+             202:    6(float)     Load 75(x)
+             203:    6(float)     ExtInst 1(GLSL.std.450) 15(Tan) 202
+             204:    6(float)     Load 73(f)
+             205:    6(float)     FAdd 204 203
+                                  Store 73(f) 205
+                                  Branch 170
              167:                 Label
-             194:    6(float)     Load 75(x)
-             195:    6(float)     ExtInst 1(GLSL.std.450) 14(Cos) 194
-             196:    6(float)     Load 73(f)
-             197:    6(float)     FAdd 196 195
-                                  Store 73(f) 197
-                                  Branch 169
-             169:               Label
-             205:    6(float)   Load 73(f)
-             207:   163(bool)   FOrdLessThan 205 206
-                                SelectionMerge 209 None
-                                BranchConditional 207 208 209
-             208:                 Label
+             171:    6(float)     Load 75(x)
+             172:    6(float)     ExtInst 1(GLSL.std.450) 13(Sin) 171
+             173:    6(float)     Load 73(f)
+             174:    6(float)     FAdd 173 172
+                                  Store 73(f) 174
+                                  Store 175(j) 176
+                                  Branch 177
+             177:                 Label
+                                  LoopMerge 179 180 None
+                                  Branch 181
+             181:                 Label
+             182:      9(int)     Load 175(j)
+             184:   164(bool)     SLessThan 182 183
+                                  BranchConditional 184 178 179
+             178:                   Label
+             185:    6(float)       Load 73(f)
+             186:    6(float)       FAdd 185 48
+                                    Store 73(f) 186
+             187:    6(float)       Load 73(f)
+             189:   164(bool)       FOrdLessThan 187 188
+                                    SelectionMerge 191 None
+                                    BranchConditional 189 190 191
+             190:                     Label
+                                      Branch 179
+             191:                   Label
+                                    Branch 180
+             180:                   Label
+             193:      9(int)       Load 175(j)
+             194:      9(int)       IAdd 193 65
+                                    Store 175(j) 194
+                                    Branch 177
+             179:                 Label
+                                  Branch 170
+             168:                 Label
+             196:    6(float)     Load 75(x)
+             197:    6(float)     ExtInst 1(GLSL.std.450) 14(Cos) 196
+             198:    6(float)     Load 73(f)
+             199:    6(float)     FAdd 198 197
+                                  Store 73(f) 199
+                                  Branch 170
+             170:               Label
+             207:    6(float)   Load 73(f)
+             209:   164(bool)   FOrdLessThan 207 208
+                                SelectionMerge 211 None
+                                BranchConditional 209 210 211
+             210:                 Label
                                   Branch 159
-             209:               Label
+             211:               Label
                                 Branch 160
              160:               Label
-             211:      9(int)   Load 155(i)
-             212:      9(int)   IAdd 211 65
-                                Store 155(i) 212
+             213:      9(int)   Load 155(i)
+             214:      9(int)   IAdd 213 65
+                                Store 155(i) 214
                                 Branch 157
              159:             Label
-             213:      9(int) Load 62(c)
-                              SelectionMerge 216 None
-                              Switch 213 216 
-                                     case 1: 214
-                                     case 2: 215
-             214:               Label
-             217:    6(float)   Load 75(x)
-             218:    6(float)   ExtInst 1(GLSL.std.450) 13(Sin) 217
-             219:    6(float)   Load 73(f)
-             220:    6(float)   FAdd 219 218
-                                Store 73(f) 220
-                                Branch 216
-             215:               Label
-                                Branch 216
-             216:             Label
-             226:    6(float) Load 73(f)
-             227:      9(int) Load 60(local)
-             228:    6(float) ConvertSToF 227
-             229:    6(float) FAdd 226 228
-                              Store 225(color) 229
-             233:    7(fvec4) Load 231(v)
-                              Store 232(param) 233
-             235:    7(fvec4) Load 231(v)
+             215:      9(int) Load 62(c)
+                              SelectionMerge 218 None
+                              Switch 215 218 
+                                     case 1: 216
+                                     case 2: 217
+             216:               Label
+             219:    6(float)   Load 75(x)
+             220:    6(float)   ExtInst 1(GLSL.std.450) 13(Sin) 219
+             221:    6(float)   Load 73(f)
+             222:    6(float)   FAdd 221 220
+                                Store 73(f) 222
+                                Branch 218
+             217:               Label
+                                Branch 218
+             218:             Label
+             228:    6(float) Load 73(f)
+             229:      9(int) Load 60(local)
+             230:    6(float) ConvertSToF 229
+             231:    6(float) FAdd 228 230
+                              Store 227(color) 231
+             235:    7(fvec4) Load 233(v)
                               Store 234(param) 235
-             237:      9(int) Load 62(c)
+             237:    7(fvec4) Load 233(v)
                               Store 236(param) 237
-             238:    7(fvec4) FunctionCall 15(foo1(vf4;vf4;i1;) 232(param) 234(param) 236(param)
-             241:    6(float) CompositeExtract 238 1
-             242:    6(float) Load 225(color)
-             243:    6(float) FAdd 242 241
-                              Store 225(color) 243
-             245:    7(fvec4) Load 231(v)
-                              Store 244(param) 245
-             247:    7(fvec4) Load 231(v)
+             239:      9(int) Load 62(c)
+                              Store 238(param) 239
+             240:    7(fvec4) FunctionCall 15(foo1(vf4;vf4;i1;) 234(param) 236(param) 238(param)
+             243:    6(float) CompositeExtract 240 1
+             244:    6(float) Load 227(color)
+             245:    6(float) FAdd 244 243
+                              Store 227(color) 245
+             247:    7(fvec4) Load 233(v)
                               Store 246(param) 247
-             249:      9(int) Load 62(c)
+             249:    7(fvec4) Load 233(v)
                               Store 248(param) 249
-             250:    7(fvec4) FunctionCall 20(foo2(vf4;vf4;i1;) 244(param) 246(param) 248(param)
-             252:    6(float) CompositeExtract 250 2
-             253:    6(float) Load 225(color)
-             254:    6(float) FAdd 253 252
-                              Store 225(color) 254
-             255:      9(int) Load 62(c)
-                              SelectionMerge 258 None
-                              Switch 255 257 
-                                     case 0: 256
-             257:               Label
-                                Branch 258
-             256:               Label
-                                Branch 258
-             258:             Label
-             262:      9(int) Load 62(c)
-                              SelectionMerge 264 None
-                              Switch 262 263
-             263:               Label
-                                Branch 264
-             264:             Label
+             251:      9(int) Load 62(c)
+                              Store 250(param) 251
+             252:    7(fvec4) FunctionCall 20(foo2(vf4;vf4;i1;) 246(param) 248(param) 250(param)
+             254:    6(float) CompositeExtract 252 2
+             255:    6(float) Load 227(color)
+             256:    6(float) FAdd 255 254
+                              Store 227(color) 256
+             257:      9(int) Load 62(c)
+                              SelectionMerge 260 None
+                              Switch 257 259 
+                                     case 0: 258
+             259:               Label
+                                Branch 260
+             258:               Label
+                                Branch 260
+             260:             Label
+             264:      9(int) Load 62(c)
+                              SelectionMerge 266 None
+                              Switch 264 265
+             265:               Label
+                                Branch 266
+             266:             Label
                               Return
                               FunctionEnd
 15(foo1(vf4;vf4;i1;):    7(fvec4) Function None 11
diff --git a/Test/baseResults/spv.while-continue-break.vert.out b/Test/baseResults/spv.while-continue-break.vert.out
index aedd437..f933dce 100644
--- a/Test/baseResults/spv.while-continue-break.vert.out
+++ b/Test/baseResults/spv.while-continue-break.vert.out
@@ -5,78 +5,80 @@
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 43
+// Id's are bound by 44
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 41 42
+                              EntryPoint Vertex 4  "main" 42 43
                               Source ESSL 300
                               Name 4  "main"
                               Name 8  "i"
-                              Name 18  "A"
-                              Name 26  "B"
-                              Name 28  "C"
-                              Name 38  "D"
-                              Name 41  "gl_VertexID"
-                              Name 42  "gl_InstanceID"
-                              Decorate 41(gl_VertexID) BuiltIn VertexId
-                              Decorate 42(gl_InstanceID) BuiltIn InstanceId
+                              Name 19  "A"
+                              Name 27  "B"
+                              Name 29  "C"
+                              Name 39  "D"
+                              Name 42  "gl_VertexID"
+                              Name 43  "gl_InstanceID"
+                              Decorate 42(gl_VertexID) BuiltIn VertexId
+                              Decorate 43(gl_InstanceID) BuiltIn InstanceId
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1
                7:             TypePointer Function 6(int)
                9:      6(int) Constant 0
-              15:      6(int) Constant 10
-              16:             TypeBool
-              19:      6(int) Constant 1
-              21:      6(int) Constant 2
-              30:      6(int) Constant 5
-              39:      6(int) Constant 3
-              40:             TypePointer Input 6(int)
- 41(gl_VertexID):     40(ptr) Variable Input
-42(gl_InstanceID):     40(ptr) Variable Input
+              16:      6(int) Constant 10
+              17:             TypeBool
+              20:      6(int) Constant 1
+              22:      6(int) Constant 2
+              31:      6(int) Constant 5
+              40:      6(int) Constant 3
+              41:             TypePointer Input 6(int)
+ 42(gl_VertexID):     41(ptr) Variable Input
+43(gl_InstanceID):     41(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
             8(i):      7(ptr) Variable Function
-           18(A):      7(ptr) Variable Function
-           26(B):      7(ptr) Variable Function
-           28(C):      7(ptr) Variable Function
-           38(D):      7(ptr) Variable Function
+           19(A):      7(ptr) Variable Function
+           27(B):      7(ptr) Variable Function
+           29(C):      7(ptr) Variable Function
+           39(D):      7(ptr) Variable Function
                               Store 8(i) 9
                               Branch 10
               10:             Label
-              14:      6(int) Load 8(i)
-              17:    16(bool) SLessThan 14 15
                               LoopMerge 12 13 None
-                              BranchConditional 17 11 12
+                              Branch 14
+              14:             Label
+              15:      6(int) Load 8(i)
+              18:    17(bool) SLessThan 15 16
+                              BranchConditional 18 11 12
               11:               Label
-                                Store 18(A) 19
-              20:      6(int)   Load 8(i)
-              22:      6(int)   SMod 20 21
-              23:    16(bool)   IEqual 22 9
-                                SelectionMerge 25 None
-                                BranchConditional 23 24 25
-              24:                 Label
-                                  Store 26(B) 21
+                                Store 19(A) 20
+              21:      6(int)   Load 8(i)
+              23:      6(int)   SMod 21 22
+              24:    17(bool)   IEqual 23 9
+                                SelectionMerge 26 None
+                                BranchConditional 24 25 26
+              25:                 Label
+                                  Store 27(B) 22
                                   Branch 13
-              25:               Label
-              29:      6(int)   Load 8(i)
-              31:      6(int)   SMod 29 30
-              32:    16(bool)   IEqual 31 9
-                                SelectionMerge 34 None
-                                BranchConditional 32 33 34
-              33:                 Label
-                                  Store 26(B) 21
+              26:               Label
+              30:      6(int)   Load 8(i)
+              32:      6(int)   SMod 30 31
+              33:    17(bool)   IEqual 32 9
+                                SelectionMerge 35 None
+                                BranchConditional 33 34 35
+              34:                 Label
+                                  Store 27(B) 22
                                   Branch 12
-              34:               Label
-              36:      6(int)   Load 8(i)
-              37:      6(int)   IAdd 36 19
-                                Store 8(i) 37
+              35:               Label
+              37:      6(int)   Load 8(i)
+              38:      6(int)   IAdd 37 20
+                                Store 8(i) 38
                                 Branch 13
               13:               Label
                                 Branch 10
               12:             Label
-                              Store 38(D) 39
+                              Store 39(D) 40
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/spv.while-simple.vert.out b/Test/baseResults/spv.while-simple.vert.out
index 1d6d9da..f5d13a3 100755
--- a/Test/baseResults/spv.while-simple.vert.out
+++ b/Test/baseResults/spv.while-simple.vert.out
@@ -5,44 +5,46 @@
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 24
+// Id's are bound by 25
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Vertex 4  "main" 22 23
+                              EntryPoint Vertex 4  "main" 23 24
                               Source ESSL 300
                               Name 4  "main"
                               Name 8  "i"
-                              Name 22  "gl_VertexID"
-                              Name 23  "gl_InstanceID"
-                              Decorate 22(gl_VertexID) BuiltIn VertexId
-                              Decorate 23(gl_InstanceID) BuiltIn InstanceId
+                              Name 23  "gl_VertexID"
+                              Name 24  "gl_InstanceID"
+                              Decorate 23(gl_VertexID) BuiltIn VertexId
+                              Decorate 24(gl_InstanceID) BuiltIn InstanceId
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1
                7:             TypePointer Function 6(int)
                9:      6(int) Constant 0
-              15:      6(int) Constant 10
-              16:             TypeBool
-              19:      6(int) Constant 1
-              21:             TypePointer Input 6(int)
- 22(gl_VertexID):     21(ptr) Variable Input
-23(gl_InstanceID):     21(ptr) Variable Input
+              16:      6(int) Constant 10
+              17:             TypeBool
+              20:      6(int) Constant 1
+              22:             TypePointer Input 6(int)
+ 23(gl_VertexID):     22(ptr) Variable Input
+24(gl_InstanceID):     22(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
             8(i):      7(ptr) Variable Function
                               Store 8(i) 9
                               Branch 10
               10:             Label
-              14:      6(int) Load 8(i)
-              17:    16(bool) SLessThan 14 15
                               LoopMerge 12 13 None
-                              BranchConditional 17 11 12
+                              Branch 14
+              14:             Label
+              15:      6(int) Load 8(i)
+              18:    17(bool) SLessThan 15 16
+                              BranchConditional 18 11 12
               11:               Label
-              18:      6(int)   Load 8(i)
-              20:      6(int)   IAdd 18 19
-                                Store 8(i) 20
+              19:      6(int)   Load 8(i)
+              21:      6(int)   IAdd 19 20
+                                Store 8(i) 21
                                 Branch 13
               13:               Label
                                 Branch 10
diff --git a/Test/baseResults/spv.whileLoop.frag.out b/Test/baseResults/spv.whileLoop.frag.out
index 3975f08..c29ebd3 100755
--- a/Test/baseResults/spv.whileLoop.frag.out
+++ b/Test/baseResults/spv.whileLoop.frag.out
@@ -5,20 +5,20 @@
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 35
+// Id's are bound by 36
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 11 33
+                              EntryPoint Fragment 4  "main" 11 34
                               ExecutionMode 4 OriginLowerLeft
                               Source GLSL 110
                               Name 4  "main"
                               Name 9  "color"
                               Name 11  "BaseColor"
-                              Name 23  "d"
-                              Name 28  "bigColor"
-                              Name 33  "gl_FragColor"
+                              Name 24  "d"
+                              Name 29  "bigColor"
+                              Name 34  "gl_FragColor"
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -26,16 +26,16 @@
                8:             TypePointer Function 7(fvec4)
               10:             TypePointer Input 7(fvec4)
    11(BaseColor):     10(ptr) Variable Input
-              17:             TypeInt 32 0
-              18:     17(int) Constant 0
-              19:             TypePointer Function 6(float)
-              22:             TypePointer UniformConstant 6(float)
-           23(d):     22(ptr) Variable UniformConstant
-              25:             TypeBool
-              27:             TypePointer UniformConstant 7(fvec4)
-    28(bigColor):     27(ptr) Variable UniformConstant
-              32:             TypePointer Output 7(fvec4)
-33(gl_FragColor):     32(ptr) Variable Output
+              18:             TypeInt 32 0
+              19:     18(int) Constant 0
+              20:             TypePointer Function 6(float)
+              23:             TypePointer UniformConstant 6(float)
+           24(d):     23(ptr) Variable UniformConstant
+              26:             TypeBool
+              28:             TypePointer UniformConstant 7(fvec4)
+    29(bigColor):     28(ptr) Variable UniformConstant
+              33:             TypePointer Output 7(fvec4)
+34(gl_FragColor):     33(ptr) Variable Output
          4(main):           2 Function None 3
                5:             Label
         9(color):      8(ptr) Variable Function
@@ -43,22 +43,24 @@
                               Store 9(color) 12
                               Branch 13
               13:             Label
-              20:     19(ptr) AccessChain 9(color) 18
-              21:    6(float) Load 20
-              24:    6(float) Load 23(d)
-              26:    25(bool) FOrdLessThan 21 24
                               LoopMerge 15 16 None
-                              BranchConditional 26 14 15
+                              Branch 17
+              17:             Label
+              21:     20(ptr) AccessChain 9(color) 19
+              22:    6(float) Load 21
+              25:    6(float) Load 24(d)
+              27:    26(bool) FOrdLessThan 22 25
+                              BranchConditional 27 14 15
               14:               Label
-              29:    7(fvec4)   Load 28(bigColor)
-              30:    7(fvec4)   Load 9(color)
-              31:    7(fvec4)   FAdd 30 29
-                                Store 9(color) 31
+              30:    7(fvec4)   Load 29(bigColor)
+              31:    7(fvec4)   Load 9(color)
+              32:    7(fvec4)   FAdd 31 30
+                                Store 9(color) 32
                                 Branch 16
               16:               Label
                                 Branch 13
               15:             Label
-              34:    7(fvec4) Load 9(color)
-                              Store 33(gl_FragColor) 34
+              35:    7(fvec4) Load 9(color)
+                              Store 34(gl_FragColor) 35
                               Return
                               FunctionEnd
diff --git a/Test/spv.for-notest.vert b/Test/spv.for-notest.vert
index 7aff3b3..f40e666 100644
--- a/Test/spv.for-notest.vert
+++ b/Test/spv.for-notest.vert
@@ -2,8 +2,5 @@
 layout(location=0) out highp int r;
 void main() {
   int i;
-  // This infinite loop results in bad SPIR-V generated, since the merge block
-  // is dropped as unreachable.  It is still useful for testing the rest of the
-  // code generation.
   for (i=0; ; i++) { r = i; }
 }