diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp
index 508ebed219a9dbf6d153bc3a6b113dd46f4f987c..c005197fe3f35e724fc43d46ab110a4b001a9c37 100755
--- a/SPIRV/GlslangToSpv.cpp
+++ b/SPIRV/GlslangToSpv.cpp
@@ -115,6 +115,9 @@ protected:
     void addDecoration(spv::Id id, spv::Decoration dec);
     void addMemberDecoration(spv::Id id, int member, spv::Decoration dec);
     spv::Id createSpvConstant(const glslang::TType& type, const glslang::TConstUnionArray&, int& nextConst);
+    bool isTrivialLeaf(const glslang::TIntermTyped* node);
+    bool isTrivial(const glslang::TIntermTyped* node);
+    spv::Id createShortCircuit(glslang::TOperator, glslang::TIntermTyped& left, glslang::TIntermTyped& right);
 
     spv::Function* shaderEntry;
     int sequenceDepth;
@@ -725,6 +728,21 @@ bool TGlslangToSpvTraverser::visitBinary(glslang::TVisit /* visit */, glslang::T
             builder.accessChainPushSwizzle(swizzle, convertGlslangToSpvType(node->getLeft()->getType()));
         }
         return false;
+    case glslang::EOpLogicalOr:
+    case glslang::EOpLogicalAnd:
+        {
+
+            // These may require short circuiting, but can sometimes be done as straight
+            // binary operations.  The right operand must be short circuited if it has
+            // side effects, and should probably be if it is complex.
+            if (isTrivial(node->getRight()->getAsTyped()))
+                break; // handle below as a normal binary operation
+            // otherwise, we need to do dynamic short circuiting on the right operand
+            spv::Id result = createShortCircuit(node->getOp(), *node->getLeft()->getAsTyped(), *node->getRight()->getAsTyped());
+            builder.clearAccessChain();
+            builder.setAccessChainRValue(result);
+        }
+        return false;
     default:
         break;
     }
@@ -2177,7 +2195,9 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv
         break;
     }
 
+    // handle mapped binary operations (should be non-comparison)
     if (binOp != spv::OpNop) {
+        assert(comparison == false);
         if (builder.isMatrix(left) || builder.isMatrix(right)) {
             switch (binOp) {
             case spv::OpMatrixTimesScalar:
@@ -2215,7 +2235,7 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv
     if (! comparison)
         return 0;
 
-    // Comparison instructions
+    // Handle comparison instructions
 
     if (reduceComparison && (builder.isVector(left) || builder.isMatrix(left) || builder.isAggregate(left))) {
         assert(op == glslang::EOpEqual || op == glslang::EOpNotEqual);
@@ -3025,6 +3045,133 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TType& glslangT
     return builder.makeCompositeConstant(typeId, spvConsts);
 }
 
+// Return true if the node is a constant or symbol whose reading has no
+// non-trivial observable cost or effect.
+bool TGlslangToSpvTraverser::isTrivialLeaf(const glslang::TIntermTyped* node)
+{
+    // don't know what this is
+    if (node == nullptr)
+        return false;
+
+    // a constant is safe
+    if (node->getAsConstantUnion() != nullptr)
+        return true;
+
+    // not a symbol means non-trivial
+    if (node->getAsSymbolNode() == nullptr)
+        return false;
+
+    // a symbol, depends on what's being read
+    switch (node->getType().getQualifier().storage) {
+    case glslang::EvqTemporary:
+    case glslang::EvqGlobal:
+    case glslang::EvqIn:
+    case glslang::EvqInOut:
+    case glslang::EvqConst:
+    case glslang::EvqConstReadOnly:
+    case glslang::EvqUniform:
+        return true;
+    default:
+        return false;
+    }
+} 
+
+// A node is trivial if it is a single operation with no side effects.
+// Error on the side of saying non-trivial.
+// Return true if trivial.
+bool TGlslangToSpvTraverser::isTrivial(const glslang::TIntermTyped* node)
+{
+    if (node == nullptr)
+        return false;
+
+    // symbols and constants are trivial
+    if (isTrivialLeaf(node))
+        return true;
+
+    // otherwise, it needs to be a simple operation or one or two leaf nodes
+
+    // not a simple operation
+    const glslang::TIntermBinary* binaryNode = node->getAsBinaryNode();
+    const glslang::TIntermUnary* unaryNode = node->getAsUnaryNode();
+    if (binaryNode == nullptr && unaryNode == nullptr)
+        return false;
+
+    // not on leaf nodes
+    if (binaryNode && (! isTrivialLeaf(binaryNode->getLeft()) || ! isTrivialLeaf(binaryNode->getRight())))
+        return false;
+
+    if (unaryNode && ! isTrivialLeaf(unaryNode->getOperand())) {
+        return false;
+    }
+
+    switch (node->getAsOperator()->getOp()) {
+    case glslang::EOpLogicalNot:
+    case glslang::EOpConvIntToBool:
+    case glslang::EOpConvUintToBool:
+    case glslang::EOpConvFloatToBool:
+    case glslang::EOpConvDoubleToBool:
+    case glslang::EOpEqual:
+    case glslang::EOpNotEqual:
+    case glslang::EOpLessThan:
+    case glslang::EOpGreaterThan:
+    case glslang::EOpLessThanEqual:
+    case glslang::EOpGreaterThanEqual:
+    case glslang::EOpIndexDirect:
+    case glslang::EOpIndexDirectStruct:
+    case glslang::EOpLogicalXor:
+    case glslang::EOpAny:
+    case glslang::EOpAll:
+        return true;
+    default:
+        return false;
+    }
+}
+
+// Emit short-circuiting code, where 'right' is never evaluated unless
+// the left side is true (for &&) or false (for ||).
+spv::Id TGlslangToSpvTraverser::createShortCircuit(glslang::TOperator op, glslang::TIntermTyped& left, glslang::TIntermTyped& right)
+{
+    spv::Id boolTypeId = builder.makeBoolType();
+
+    // emit left operand
+    builder.clearAccessChain();
+    left.traverse(this);
+    spv::Id leftId = builder.accessChainLoad(boolTypeId);
+
+    // Operands to accumulate OpPhi operands
+    std::vector<spv::Id> phiOperands;
+    // accumulate left operand's phi information
+    phiOperands.push_back(leftId);
+    phiOperands.push_back(builder.getBuildPoint()->getId());
+
+    // Make the two kinds of operation symmetric with a "!"
+    //   || => emit "if (! left) result = right"
+    //   && => emit "if (  left) result = right"
+    //
+    // TODO: this runtime "not" for || could be avoided by adding functionality
+    // to 'builder' to have an "else" without an "then"
+    if (op == glslang::EOpLogicalOr)
+        leftId = builder.createUnaryOp(spv::OpLogicalNot, boolTypeId, leftId);
+
+    // make an "if" based on the left value
+    spv::Builder::If ifBuilder(leftId, builder);
+
+    // emit right operand as the "then" part of the "if"
+    builder.clearAccessChain();
+    right.traverse(this);
+    spv::Id rightId = builder.accessChainLoad(boolTypeId);
+
+    // accumulate left operand's phi information
+    phiOperands.push_back(rightId);
+    phiOperands.push_back(builder.getBuildPoint()->getId());
+
+    // finish the "if"
+    ifBuilder.makeEndIf();
+
+    // phi together the two results
+    return builder.createOp(spv::OpPhi, boolTypeId, phiOperands);
+}
+
 };  // end anonymous namespace
 
 namespace glslang {
diff --git a/Test/baseResults/spv.300layoutp.vert.out b/Test/baseResults/spv.300layoutp.vert.out
index 3a8d03f004f3be0bb85c709ee58f5ec56e2e84a1..50d37a69514c4b23ceb225d51f93b1964e8a6c28 100755
--- a/Test/baseResults/spv.300layoutp.vert.out
+++ b/Test/baseResults/spv.300layoutp.vert.out
@@ -5,7 +5,7 @@ Linked vertex stage:
 
 // Module Version 99
 // Generated by (magic number): 51a00bb
-// Id's are bound by 111
+// Id's are bound by 114
 
                               Source ESSL 300
                               Capability Shader
@@ -40,8 +40,8 @@ Linked vertex stage:
                               MemberName 77(S) 0  "c"
                               MemberName 77(S) 1  "f"
                               Name 79  "s"
-                              Name 109  "gl_VertexID"
-                              Name 110  "gl_InstanceID"
+                              Name 112  "gl_VertexID"
+                              Name 113  "gl_InstanceID"
                               Decorate 9(pos) Smooth
                               Decorate 11(p) Location 3
                               MemberDecorate 17(Transform) 0 RowMajor
@@ -67,10 +67,10 @@ Linked vertex stage:
                               Decorate 53(c) Location 7
                               Decorate 61(iout) Flat
                               Decorate 73(aiv2) Location 9
-                              Decorate 109(gl_VertexID) BuiltIn VertexId
-                              Decorate 109(gl_VertexID) NoStaticUse
-                              Decorate 110(gl_InstanceID) BuiltIn InstanceId
-                              Decorate 110(gl_InstanceID) NoStaticUse
+                              Decorate 112(gl_VertexID) BuiltIn VertexId
+                              Decorate 112(gl_VertexID) NoStaticUse
+                              Decorate 113(gl_InstanceID) BuiltIn InstanceId
+                              Decorate 113(gl_InstanceID) NoStaticUse
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -124,12 +124,12 @@ Linked vertex stage:
               89:    6(float) Constant 1065353216
               90:   14(fvec3) ConstantComposite 89 89 89
               91:             TypeVector 42(bool) 3
-              94:             TypePointer Uniform 30(ivec3)
-              97:     29(int) Constant 5
-              98:   30(ivec3) ConstantComposite 97 97 97
-             108:             TypePointer Input 16(int)
-109(gl_VertexID):    108(ptr) Variable Input
-110(gl_InstanceID):    108(ptr) Variable Input
+              97:             TypePointer Uniform 30(ivec3)
+             100:     29(int) Constant 5
+             101:   30(ivec3) ConstantComposite 100 100 100
+             111:             TypePointer Input 16(int)
+112(gl_VertexID):    111(ptr) Variable Input
+113(gl_InstanceID):    111(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
               12:    7(fvec4) Load 11(p)
@@ -174,20 +174,26 @@ Linked vertex stage:
               88:   14(fvec3) Load 87
               92:   91(bvec3) FOrdNotEqual 88 90
               93:    42(bool) Any 92
-              95:     94(ptr) AccessChain 35 62 55
-              96:   30(ivec3) Load 95
-              99:   91(bvec3) INotEqual 96 98
-             100:    42(bool) Any 99
-             101:    42(bool) LogicalOr 93 100
-                              SelectionMerge 103 None
-                              BranchConditional 101 102 103
-             102:               Label
-             104:     50(ptr)   AccessChain 79(s) 20
-             105:   14(fvec3)   Load 104
-             106:   14(fvec3)   CompositeConstruct 89 89 89
-             107:   14(fvec3)   FAdd 105 106
-                                Store 104 107
-                                Branch 103
-             103:             Label
+              94:    42(bool) LogicalNot 93
+                              SelectionMerge 96 None
+                              BranchConditional 94 95 96
+              95:               Label
+              98:     97(ptr)   AccessChain 35 62 55
+              99:   30(ivec3)   Load 98
+             102:   91(bvec3)   INotEqual 99 101
+             103:    42(bool)   Any 102
+                                Branch 96
+              96:             Label
+             104:    42(bool) Phi 93 5 103 95
+                              SelectionMerge 106 None
+                              BranchConditional 104 105 106
+             105:               Label
+             107:     50(ptr)   AccessChain 79(s) 20
+             108:   14(fvec3)   Load 107
+             109:   14(fvec3)   CompositeConstruct 89 89 89
+             110:   14(fvec3)   FAdd 108 109
+                                Store 107 110
+                                Branch 106
+             106:             Label
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/spv.Operations.frag.out b/Test/baseResults/spv.Operations.frag.out
index 26960ce06fc4115ce051113b7a7b8ef5219e64e7..e9ea4cf46373fb7b16d196a0bc9305623969b394 100755
--- a/Test/baseResults/spv.Operations.frag.out
+++ b/Test/baseResults/spv.Operations.frag.out
@@ -5,7 +5,7 @@ Linked fragment stage:
 
 // Module Version 99
 // Generated by (magic number): 51a00bb
-// Id's are bound by 398
+// Id's are bound by 416
 
                               Source GLSL 130
                               Capability Shader
@@ -20,15 +20,15 @@ Linked fragment stage:
                               Name 22  "ui"
                               Name 169  "uf"
                               Name 216  "b"
-                              Name 242  "ub41"
-                              Name 244  "ub42"
-                              Name 301  "f"
-                              Name 377  "gl_FragColor"
-                              Name 395  "uiv4"
-                              Name 397  "ub"
-                              Decorate 377(gl_FragColor) BuiltIn FragColor
-                              Decorate 395(uiv4) NoStaticUse
-                              Decorate 397(ub) NoStaticUse
+                              Name 250  "ub41"
+                              Name 252  "ub42"
+                              Name 316  "f"
+                              Name 395  "gl_FragColor"
+                              Name 413  "uiv4"
+                              Name 415  "ub"
+                              Decorate 395(gl_FragColor) BuiltIn FragColor
+                              Decorate 413(uiv4) NoStaticUse
+                              Decorate 415(ub) NoStaticUse
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -45,31 +45,31 @@ Linked fragment stage:
              214:             TypeBool
              215:             TypePointer Function 214(bool)
              219:             TypeVector 214(bool) 4
-             241:             TypePointer UniformConstant 219(bvec4)
-       242(ub41):    241(ptr) Variable UniformConstant
-       244(ub42):    241(ptr) Variable UniformConstant
-             291:     18(int) Constant 2
-             298:     18(int) Constant 1
-             300:             TypePointer Function 6(float)
-             330:             TypeVector 6(float) 3
-             346:    6(float) Constant 1073741824
-             353:    6(float) Constant 1065353216
-             358:     18(int) Constant 66
-             364:     18(int) Constant 17
-             376:             TypePointer Output 7(fvec4)
-377(gl_FragColor):    376(ptr) Variable Output
-             393:             TypeVector 18(int) 4
-             394:             TypePointer UniformConstant 393(ivec4)
-       395(uiv4):    394(ptr) Variable UniformConstant
-             396:             TypePointer UniformConstant 214(bool)
-         397(ub):    396(ptr) Variable UniformConstant
+             249:             TypePointer UniformConstant 219(bvec4)
+       250(ub41):    249(ptr) Variable UniformConstant
+       252(ub42):    249(ptr) Variable UniformConstant
+             306:     18(int) Constant 2
+             313:     18(int) Constant 1
+             315:             TypePointer Function 6(float)
+             345:             TypeVector 6(float) 3
+             364:    6(float) Constant 1073741824
+             371:    6(float) Constant 1065353216
+             376:     18(int) Constant 66
+             382:     18(int) Constant 17
+             394:             TypePointer Output 7(fvec4)
+395(gl_FragColor):    394(ptr) Variable Output
+             411:             TypeVector 18(int) 4
+             412:             TypePointer UniformConstant 411(ivec4)
+       413(uiv4):    412(ptr) Variable UniformConstant
+             414:             TypePointer UniformConstant 214(bool)
+         415(ub):    414(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
             9(v):      8(ptr) Variable Function
            20(i):     19(ptr) Variable Function
           216(b):    215(ptr) Variable Function
-          301(f):    300(ptr) Variable Function
-             378:      8(ptr) Variable Function
+          316(f):    315(ptr) Variable Function
+             396:      8(ptr) Variable Function
               12:    7(fvec4) Load 11(uv4)
               13:    7(fvec4) ExtInst 1(GLSL.std.450) 11(Radians) 12
                               Store 9(v) 13
@@ -315,199 +315,241 @@ Linked fragment stage:
              221:   214(bool) Any 220
                               Store 216(b) 221
              222:   214(bool) Load 216(b)
-             223:    7(fvec4) Load 9(v)
-             224:    7(fvec4) Load 11(uv4)
-             225:  219(bvec4) FOrdLessThanEqual 223 224
-             226:   214(bool) Any 225
-             227:   214(bool) LogicalAnd 222 226
-                              Store 216(b) 227
-             228:   214(bool) Load 216(b)
-             229:    7(fvec4) Load 9(v)
-             230:    7(fvec4) Load 11(uv4)
-             231:  219(bvec4) FOrdGreaterThan 229 230
-             232:   214(bool) Any 231
-             233:   214(bool) LogicalAnd 228 232
-                              Store 216(b) 233
-             234:   214(bool) Load 216(b)
-             235:    7(fvec4) Load 9(v)
-             236:    7(fvec4) Load 11(uv4)
-             237:  219(bvec4) FOrdGreaterThanEqual 235 236
-             238:   214(bool) Any 237
-             239:   214(bool) LogicalAnd 234 238
-                              Store 216(b) 239
-             240:   214(bool) Load 216(b)
-             243:  219(bvec4) Load 242(ub41)
-             245:  219(bvec4) Load 244(ub42)
-             246:  219(bvec4) IEqual 243 245
-             247:   214(bool) Any 246
-             248:   214(bool) LogicalAnd 240 247
-                              Store 216(b) 248
-             249:   214(bool) Load 216(b)
-             250:  219(bvec4) Load 242(ub41)
-             251:  219(bvec4) Load 244(ub42)
-             252:  219(bvec4) INotEqual 250 251
-             253:   214(bool) Any 252
-             254:   214(bool) LogicalAnd 249 253
-                              Store 216(b) 254
-             255:   214(bool) Load 216(b)
-             256:  219(bvec4) Load 242(ub41)
-             257:   214(bool) Any 256
-             258:   214(bool) LogicalAnd 255 257
-                              Store 216(b) 258
-             259:   214(bool) Load 216(b)
-             260:  219(bvec4) Load 242(ub41)
-             261:   214(bool) All 260
-             262:   214(bool) LogicalAnd 259 261
-                              Store 216(b) 262
-             263:   214(bool) Load 216(b)
-             264:  219(bvec4) Load 242(ub41)
-             265:  219(bvec4) LogicalNot 264
-             266:   214(bool) Any 265
-             267:   214(bool) LogicalAnd 263 266
-                              Store 216(b) 267
-             268:     18(int) Load 20(i)
-             269:     18(int) Load 22(ui)
-             270:     18(int) IAdd 268 269
-             271:     18(int) Load 20(i)
-             272:     18(int) IMul 270 271
-             273:     18(int) Load 22(ui)
-             274:     18(int) ISub 272 273
-             275:     18(int) Load 20(i)
-             276:     18(int) SDiv 274 275
-                              Store 20(i) 276
-             277:     18(int) Load 20(i)
-             278:     18(int) Load 22(ui)
-             279:     18(int) SMod 277 278
-                              Store 20(i) 279
+                              SelectionMerge 224 None
+                              BranchConditional 222 223 224
+             223:               Label
+             225:    7(fvec4)   Load 9(v)
+             226:    7(fvec4)   Load 11(uv4)
+             227:  219(bvec4)   FOrdLessThanEqual 225 226
+             228:   214(bool)   Any 227
+                                Branch 224
+             224:             Label
+             229:   214(bool) Phi 222 5 228 223
+                              Store 216(b) 229
+             230:   214(bool) Load 216(b)
+                              SelectionMerge 232 None
+                              BranchConditional 230 231 232
+             231:               Label
+             233:    7(fvec4)   Load 9(v)
+             234:    7(fvec4)   Load 11(uv4)
+             235:  219(bvec4)   FOrdGreaterThan 233 234
+             236:   214(bool)   Any 235
+                                Branch 232
+             232:             Label
+             237:   214(bool) Phi 230 224 236 231
+                              Store 216(b) 237
+             238:   214(bool) Load 216(b)
+                              SelectionMerge 240 None
+                              BranchConditional 238 239 240
+             239:               Label
+             241:    7(fvec4)   Load 9(v)
+             242:    7(fvec4)   Load 11(uv4)
+             243:  219(bvec4)   FOrdGreaterThanEqual 241 242
+             244:   214(bool)   Any 243
+                                Branch 240
+             240:             Label
+             245:   214(bool) Phi 238 232 244 239
+                              Store 216(b) 245
+             246:   214(bool) Load 216(b)
+                              SelectionMerge 248 None
+                              BranchConditional 246 247 248
+             247:               Label
+             251:  219(bvec4)   Load 250(ub41)
+             253:  219(bvec4)   Load 252(ub42)
+             254:  219(bvec4)   IEqual 251 253
+             255:   214(bool)   Any 254
+                                Branch 248
+             248:             Label
+             256:   214(bool) Phi 246 240 255 247
+                              Store 216(b) 256
+             257:   214(bool) Load 216(b)
+                              SelectionMerge 259 None
+                              BranchConditional 257 258 259
+             258:               Label
+             260:  219(bvec4)   Load 250(ub41)
+             261:  219(bvec4)   Load 252(ub42)
+             262:  219(bvec4)   INotEqual 260 261
+             263:   214(bool)   Any 262
+                                Branch 259
+             259:             Label
+             264:   214(bool) Phi 257 248 263 258
+                              Store 216(b) 264
+             265:   214(bool) Load 216(b)
+             266:  219(bvec4) Load 250(ub41)
+             267:   214(bool) Any 266
+             268:   214(bool) LogicalAnd 265 267
+                              Store 216(b) 268
+             269:   214(bool) Load 216(b)
+             270:  219(bvec4) Load 250(ub41)
+             271:   214(bool) All 270
+             272:   214(bool) LogicalAnd 269 271
+                              Store 216(b) 272
+             273:   214(bool) Load 216(b)
+                              SelectionMerge 275 None
+                              BranchConditional 273 274 275
+             274:               Label
+             276:  219(bvec4)   Load 250(ub41)
+             277:  219(bvec4)   LogicalNot 276
+             278:   214(bool)   Any 277
+                                Branch 275
+             275:             Label
+             279:   214(bool) Phi 273 259 278 274
+                              Store 216(b) 279
              280:     18(int) Load 20(i)
              281:     18(int) Load 22(ui)
-             282:   214(bool) IEqual 280 281
+             282:     18(int) IAdd 280 281
              283:     18(int) Load 20(i)
-             284:     18(int) Load 22(ui)
-             285:   214(bool) INotEqual 283 284
-             286:     18(int) Load 20(i)
-             287:     18(int) Load 22(ui)
-             288:   214(bool) IEqual 286 287
-             289:   214(bool) LogicalAnd 285 288
-             290:     18(int) Load 20(i)
-             292:   214(bool) INotEqual 290 291
-             293:   214(bool) LogicalNotEqual 289 292
-             294:   214(bool) LogicalOr 282 293
-                              SelectionMerge 296 None
-                              BranchConditional 294 295 296
-             295:               Label
-             297:     18(int)   Load 20(i)
-             299:     18(int)   IAdd 297 298
-                                Store 20(i) 299
-                                Branch 296
-             296:             Label
-             302:    6(float) Load 169(uf)
-             303:    6(float) Load 169(uf)
-             304:    6(float) FAdd 302 303
-             305:    6(float) Load 169(uf)
-             306:    6(float) FMul 304 305
-             307:    6(float) Load 169(uf)
-             308:    6(float) FSub 306 307
-             309:    6(float) Load 169(uf)
-             310:    6(float) FDiv 308 309
-                              Store 301(f) 310
-             311:    7(fvec4) Load 9(v)
-             312:    6(float) ExtInst 1(GLSL.std.450) 65(Length) 311
-             313:    6(float) Load 301(f)
-             314:    6(float) FAdd 313 312
-                              Store 301(f) 314
-             315:    7(fvec4) Load 9(v)
-             316:    7(fvec4) Load 9(v)
-             317:    6(float) ExtInst 1(GLSL.std.450) 66(Distance) 315 316
-             318:    6(float) Load 301(f)
-             319:    6(float) FAdd 318 317
-                              Store 301(f) 319
-             320:    7(fvec4) Load 9(v)
-             321:    7(fvec4) Load 9(v)
-             322:    6(float) Dot 320 321
-             323:    6(float) Load 301(f)
-             324:    6(float) FAdd 323 322
-                              Store 301(f) 324
-             325:    6(float) Load 301(f)
-             326:    6(float) Load 169(uf)
-             327:    6(float) FMul 325 326
-             328:    6(float) Load 301(f)
+             284:     18(int) IMul 282 283
+             285:     18(int) Load 22(ui)
+             286:     18(int) ISub 284 285
+             287:     18(int) Load 20(i)
+             288:     18(int) SDiv 286 287
+                              Store 20(i) 288
+             289:     18(int) Load 20(i)
+             290:     18(int) Load 22(ui)
+             291:     18(int) SMod 289 290
+                              Store 20(i) 291
+             292:     18(int) Load 20(i)
+             293:     18(int) Load 22(ui)
+             294:   214(bool) IEqual 292 293
+             295:   214(bool) LogicalNot 294
+                              SelectionMerge 297 None
+                              BranchConditional 295 296 297
+             296:               Label
+             298:     18(int)   Load 20(i)
+             299:     18(int)   Load 22(ui)
+             300:   214(bool)   INotEqual 298 299
+             301:     18(int)   Load 20(i)
+             302:     18(int)   Load 22(ui)
+             303:   214(bool)   IEqual 301 302
+             304:   214(bool)   LogicalAnd 300 303
+             305:     18(int)   Load 20(i)
+             307:   214(bool)   INotEqual 305 306
+             308:   214(bool)   LogicalNotEqual 304 307
+                                Branch 297
+             297:             Label
+             309:   214(bool) Phi 294 275 308 296
+                              SelectionMerge 311 None
+                              BranchConditional 309 310 311
+             310:               Label
+             312:     18(int)   Load 20(i)
+             314:     18(int)   IAdd 312 313
+                                Store 20(i) 314
+                                Branch 311
+             311:             Label
+             317:    6(float) Load 169(uf)
+             318:    6(float) Load 169(uf)
+             319:    6(float) FAdd 317 318
+             320:    6(float) Load 169(uf)
+             321:    6(float) FMul 319 320
+             322:    6(float) Load 169(uf)
+             323:    6(float) FSub 321 322
+             324:    6(float) Load 169(uf)
+             325:    6(float) FDiv 323 324
+                              Store 316(f) 325
+             326:    7(fvec4) Load 9(v)
+             327:    6(float) ExtInst 1(GLSL.std.450) 65(Length) 326
+             328:    6(float) Load 316(f)
              329:    6(float) FAdd 328 327
-                              Store 301(f) 329
+                              Store 316(f) 329
+             330:    7(fvec4) Load 9(v)
              331:    7(fvec4) Load 9(v)
-             332:  330(fvec3) VectorShuffle 331 331 0 1 2
-             333:    7(fvec4) Load 9(v)
-             334:  330(fvec3) VectorShuffle 333 333 0 1 2
-             335:  330(fvec3) ExtInst 1(GLSL.std.450) 67(Cross) 332 334
-             336:    6(float) CompositeExtract 335 0
-             337:    6(float) Load 301(f)
-             338:    6(float) FAdd 337 336
-                              Store 301(f) 338
-             339:    6(float) Load 301(f)
-             340:    6(float) Load 169(uf)
-             341:   214(bool) FOrdEqual 339 340
-             342:    6(float) Load 301(f)
-             343:    6(float) Load 169(uf)
-             344:   214(bool) FOrdNotEqual 342 343
-             345:    6(float) Load 301(f)
-             347:   214(bool) FOrdNotEqual 345 346
-             348:   214(bool) LogicalAnd 344 347
-             349:   214(bool) LogicalOr 341 348
-                              SelectionMerge 351 None
-                              BranchConditional 349 350 351
-             350:               Label
-             352:    6(float)   Load 301(f)
-             354:    6(float)   FAdd 352 353
-                                Store 301(f) 354
-                                Branch 351
-             351:             Label
-             355:     18(int) Load 22(ui)
-             356:     18(int) Load 20(i)
-             357:     18(int) BitwiseAnd 356 355
-                              Store 20(i) 357
-             359:     18(int) Load 20(i)
-             360:     18(int) BitwiseOr 359 358
-                              Store 20(i) 360
-             361:     18(int) Load 22(ui)
-             362:     18(int) Load 20(i)
-             363:     18(int) BitwiseXor 362 361
-                              Store 20(i) 363
-             365:     18(int) Load 20(i)
-             366:     18(int) SMod 365 364
-                              Store 20(i) 366
-             367:     18(int) Load 20(i)
-             368:     18(int) ShiftRightArithmetic 367 291
-                              Store 20(i) 368
-             369:     18(int) Load 22(ui)
-             370:     18(int) Load 20(i)
-             371:     18(int) ShiftLeftLogical 370 369
-                              Store 20(i) 371
-             372:     18(int) Load 20(i)
-             373:     18(int) Not 372
-                              Store 20(i) 373
-             374:   214(bool) Load 216(b)
-             375:   214(bool) LogicalNot 374
-                              Store 216(b) 375
-             379:   214(bool) Load 216(b)
-                              SelectionMerge 381 None
-                              BranchConditional 379 380 390
-             380:               Label
-             382:     18(int)   Load 20(i)
-             383:    6(float)   ConvertSToF 382
-             384:    7(fvec4)   CompositeConstruct 383 383 383 383
-             385:    6(float)   Load 301(f)
-             386:    7(fvec4)   CompositeConstruct 385 385 385 385
-             387:    7(fvec4)   FAdd 384 386
-             388:    7(fvec4)   Load 9(v)
-             389:    7(fvec4)   FAdd 387 388
-                                Store 378 389
-                                Branch 381
-             390:               Label
-             391:    7(fvec4)   Load 9(v)
-                                Store 378 391
-                                Branch 381
-             381:             Label
-             392:    7(fvec4) Load 378
-                              Store 377(gl_FragColor) 392
+             332:    6(float) ExtInst 1(GLSL.std.450) 66(Distance) 330 331
+             333:    6(float) Load 316(f)
+             334:    6(float) FAdd 333 332
+                              Store 316(f) 334
+             335:    7(fvec4) Load 9(v)
+             336:    7(fvec4) Load 9(v)
+             337:    6(float) Dot 335 336
+             338:    6(float) Load 316(f)
+             339:    6(float) FAdd 338 337
+                              Store 316(f) 339
+             340:    6(float) Load 316(f)
+             341:    6(float) Load 169(uf)
+             342:    6(float) FMul 340 341
+             343:    6(float) Load 316(f)
+             344:    6(float) FAdd 343 342
+                              Store 316(f) 344
+             346:    7(fvec4) Load 9(v)
+             347:  345(fvec3) VectorShuffle 346 346 0 1 2
+             348:    7(fvec4) Load 9(v)
+             349:  345(fvec3) VectorShuffle 348 348 0 1 2
+             350:  345(fvec3) ExtInst 1(GLSL.std.450) 67(Cross) 347 349
+             351:    6(float) CompositeExtract 350 0
+             352:    6(float) Load 316(f)
+             353:    6(float) FAdd 352 351
+                              Store 316(f) 353
+             354:    6(float) Load 316(f)
+             355:    6(float) Load 169(uf)
+             356:   214(bool) FOrdEqual 354 355
+             357:   214(bool) LogicalNot 356
+                              SelectionMerge 359 None
+                              BranchConditional 357 358 359
+             358:               Label
+             360:    6(float)   Load 316(f)
+             361:    6(float)   Load 169(uf)
+             362:   214(bool)   FOrdNotEqual 360 361
+             363:    6(float)   Load 316(f)
+             365:   214(bool)   FOrdNotEqual 363 364
+             366:   214(bool)   LogicalAnd 362 365
+                                Branch 359
+             359:             Label
+             367:   214(bool) Phi 356 311 366 358
+                              SelectionMerge 369 None
+                              BranchConditional 367 368 369
+             368:               Label
+             370:    6(float)   Load 316(f)
+             372:    6(float)   FAdd 370 371
+                                Store 316(f) 372
+                                Branch 369
+             369:             Label
+             373:     18(int) Load 22(ui)
+             374:     18(int) Load 20(i)
+             375:     18(int) BitwiseAnd 374 373
+                              Store 20(i) 375
+             377:     18(int) Load 20(i)
+             378:     18(int) BitwiseOr 377 376
+                              Store 20(i) 378
+             379:     18(int) Load 22(ui)
+             380:     18(int) Load 20(i)
+             381:     18(int) BitwiseXor 380 379
+                              Store 20(i) 381
+             383:     18(int) Load 20(i)
+             384:     18(int) SMod 383 382
+                              Store 20(i) 384
+             385:     18(int) Load 20(i)
+             386:     18(int) ShiftRightArithmetic 385 306
+                              Store 20(i) 386
+             387:     18(int) Load 22(ui)
+             388:     18(int) Load 20(i)
+             389:     18(int) ShiftLeftLogical 388 387
+                              Store 20(i) 389
+             390:     18(int) Load 20(i)
+             391:     18(int) Not 390
+                              Store 20(i) 391
+             392:   214(bool) Load 216(b)
+             393:   214(bool) LogicalNot 392
+                              Store 216(b) 393
+             397:   214(bool) Load 216(b)
+                              SelectionMerge 399 None
+                              BranchConditional 397 398 408
+             398:               Label
+             400:     18(int)   Load 20(i)
+             401:    6(float)   ConvertSToF 400
+             402:    7(fvec4)   CompositeConstruct 401 401 401 401
+             403:    6(float)   Load 316(f)
+             404:    7(fvec4)   CompositeConstruct 403 403 403 403
+             405:    7(fvec4)   FAdd 402 404
+             406:    7(fvec4)   Load 9(v)
+             407:    7(fvec4)   FAdd 405 406
+                                Store 396 407
+                                Branch 399
+             408:               Label
+             409:    7(fvec4)   Load 9(v)
+                                Store 396 409
+                                Branch 399
+             399:             Label
+             410:    7(fvec4) Load 396
+                              Store 395(gl_FragColor) 410
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/spv.conversion.frag.out b/Test/baseResults/spv.conversion.frag.out
index 6de712156219b6be59ec12c96a810bd2dda14cd5..31d49801e2af28e5de5441535ab946acfac40689 100755
--- a/Test/baseResults/spv.conversion.frag.out
+++ b/Test/baseResults/spv.conversion.frag.out
@@ -5,7 +5,7 @@ Linked fragment stage:
 
 // Module Version 99
 // Generated by (magic number): 51a00bb
-// Id's are bound by 443
+// Id's are bound by 452
 
                               Source GLSL 130
                               Capability Shader
@@ -34,50 +34,50 @@ Linked fragment stage:
                               Name 114  "f3"
                               Name 118  "f4"
                               Name 157  "i_i4"
-                              Name 312  "gl_FragColor"
-                              Name 405  "cv2"
-                              Name 406  "cv5"
-                              Name 416  "u_b"
-                              Name 418  "u_b2"
-                              Name 420  "u_b3"
-                              Name 422  "u_b4"
-                              Name 424  "u_i2"
-                              Name 426  "u_i3"
-                              Name 428  "u_i4"
-                              Name 429  "i_b"
-                              Name 430  "i_b2"
-                              Name 431  "i_b3"
-                              Name 432  "i_b4"
-                              Name 434  "i_i2"
-                              Name 436  "i_i3"
-                              Name 438  "i_f2"
-                              Name 440  "i_f3"
-                              Name 442  "i_f4"
+                              Name 321  "gl_FragColor"
+                              Name 414  "cv2"
+                              Name 415  "cv5"
+                              Name 425  "u_b"
+                              Name 427  "u_b2"
+                              Name 429  "u_b3"
+                              Name 431  "u_b4"
+                              Name 433  "u_i2"
+                              Name 435  "u_i3"
+                              Name 437  "u_i4"
+                              Name 438  "i_b"
+                              Name 439  "i_b2"
+                              Name 440  "i_b3"
+                              Name 441  "i_b4"
+                              Name 443  "i_i2"
+                              Name 445  "i_i3"
+                              Name 447  "i_f2"
+                              Name 449  "i_f3"
+                              Name 451  "i_f4"
                               Decorate 39(i_i) Flat
                               Decorate 53(i_f) Smooth
                               Decorate 157(i_i4) Flat
-                              Decorate 312(gl_FragColor) BuiltIn FragColor
-                              Decorate 416(u_b) NoStaticUse
-                              Decorate 418(u_b2) NoStaticUse
-                              Decorate 420(u_b3) NoStaticUse
-                              Decorate 422(u_b4) NoStaticUse
-                              Decorate 424(u_i2) NoStaticUse
-                              Decorate 426(u_i3) NoStaticUse
-                              Decorate 428(u_i4) NoStaticUse
-                              Decorate 429(i_b) NoStaticUse
-                              Decorate 430(i_b2) NoStaticUse
-                              Decorate 431(i_b3) NoStaticUse
-                              Decorate 432(i_b4) NoStaticUse
-                              Decorate 434(i_i2) Flat
-                              Decorate 434(i_i2) NoStaticUse
-                              Decorate 436(i_i3) Flat
-                              Decorate 436(i_i3) NoStaticUse
-                              Decorate 438(i_f2) Smooth
-                              Decorate 438(i_f2) NoStaticUse
-                              Decorate 440(i_f3) Smooth
-                              Decorate 440(i_f3) NoStaticUse
-                              Decorate 442(i_f4) Smooth
-                              Decorate 442(i_f4) NoStaticUse
+                              Decorate 321(gl_FragColor) BuiltIn FragColor
+                              Decorate 425(u_b) NoStaticUse
+                              Decorate 427(u_b2) NoStaticUse
+                              Decorate 429(u_b3) NoStaticUse
+                              Decorate 431(u_b4) NoStaticUse
+                              Decorate 433(u_i2) NoStaticUse
+                              Decorate 435(u_i3) NoStaticUse
+                              Decorate 437(u_i4) NoStaticUse
+                              Decorate 438(i_b) NoStaticUse
+                              Decorate 439(i_b2) NoStaticUse
+                              Decorate 440(i_b3) NoStaticUse
+                              Decorate 441(i_b4) NoStaticUse
+                              Decorate 443(i_i2) Flat
+                              Decorate 443(i_i2) NoStaticUse
+                              Decorate 445(i_i3) Flat
+                              Decorate 445(i_i3) NoStaticUse
+                              Decorate 447(i_f2) Smooth
+                              Decorate 447(i_f2) NoStaticUse
+                              Decorate 449(i_f3) Smooth
+                              Decorate 449(i_f3) NoStaticUse
+                              Decorate 451(i_f4) Smooth
+                              Decorate 451(i_f4) NoStaticUse
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeBool
@@ -140,36 +140,36 @@ Linked fragment stage:
        157(i_i4):    156(ptr) Variable Input
              159:             TypeVector 13(int) 4
              160:  159(ivec4) ConstantComposite 14 14 14 14
-             311:             TypePointer Output 95(fvec4)
-312(gl_FragColor):    311(ptr) Variable Output
-             415:             TypePointer UniformConstant 6(bool)
-        416(u_b):    415(ptr) Variable UniformConstant
-             417:             TypePointer UniformConstant 23(bvec2)
-       418(u_b2):    417(ptr) Variable UniformConstant
-             419:             TypePointer UniformConstant 31(bvec3)
-       420(u_b3):    419(ptr) Variable UniformConstant
-             421:             TypePointer UniformConstant 43(bvec4)
-       422(u_b4):    421(ptr) Variable UniformConstant
-             423:             TypePointer UniformConstant 66(ivec2)
-       424(u_i2):    423(ptr) Variable UniformConstant
-             425:             TypePointer UniformConstant 79(ivec3)
-       426(u_i3):    425(ptr) Variable UniformConstant
-             427:             TypePointer UniformConstant 92(ivec4)
-       428(u_i4):    427(ptr) Variable UniformConstant
-        429(i_b):    415(ptr) Variable UniformConstant
-       430(i_b2):    417(ptr) Variable UniformConstant
-       431(i_b3):    419(ptr) Variable UniformConstant
-       432(i_b4):    421(ptr) Variable UniformConstant
-             433:             TypePointer Input 66(ivec2)
-       434(i_i2):    433(ptr) Variable Input
-             435:             TypePointer Input 79(ivec3)
-       436(i_i3):    435(ptr) Variable Input
-             437:             TypePointer Input 69(fvec2)
-       438(i_f2):    437(ptr) Variable Input
-             439:             TypePointer Input 82(fvec3)
-       440(i_f3):    439(ptr) Variable Input
-             441:             TypePointer Input 95(fvec4)
-       442(i_f4):    441(ptr) Variable Input
+             320:             TypePointer Output 95(fvec4)
+321(gl_FragColor):    320(ptr) Variable Output
+             424:             TypePointer UniformConstant 6(bool)
+        425(u_b):    424(ptr) Variable UniformConstant
+             426:             TypePointer UniformConstant 23(bvec2)
+       427(u_b2):    426(ptr) Variable UniformConstant
+             428:             TypePointer UniformConstant 31(bvec3)
+       429(u_b3):    428(ptr) Variable UniformConstant
+             430:             TypePointer UniformConstant 43(bvec4)
+       431(u_b4):    430(ptr) Variable UniformConstant
+             432:             TypePointer UniformConstant 66(ivec2)
+       433(u_i2):    432(ptr) Variable UniformConstant
+             434:             TypePointer UniformConstant 79(ivec3)
+       435(u_i3):    434(ptr) Variable UniformConstant
+             436:             TypePointer UniformConstant 92(ivec4)
+       437(u_i4):    436(ptr) Variable UniformConstant
+        438(i_b):    424(ptr) Variable UniformConstant
+       439(i_b2):    426(ptr) Variable UniformConstant
+       440(i_b3):    428(ptr) Variable UniformConstant
+       441(i_b4):    430(ptr) Variable UniformConstant
+             442:             TypePointer Input 66(ivec2)
+       443(i_i2):    442(ptr) Variable Input
+             444:             TypePointer Input 79(ivec3)
+       445(i_i3):    444(ptr) Variable Input
+             446:             TypePointer Input 69(fvec2)
+       447(i_f2):    446(ptr) Variable Input
+             448:             TypePointer Input 82(fvec3)
+       449(i_f3):    448(ptr) Variable Input
+             450:             TypePointer Input 95(fvec4)
+       451(i_f4):    450(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
             8(b):      7(ptr) Variable Function
@@ -184,11 +184,11 @@ Linked fragment stage:
          110(f2):    109(ptr) Variable Function
          114(f3):    113(ptr) Variable Function
          118(f4):    117(ptr) Variable Function
-             288:    105(ptr) Variable Function
-             298:    105(ptr) Variable Function
-             313:    117(ptr) Variable Function
-        405(cv2):     93(ptr) Variable Function
-        406(cv5):     44(ptr) Variable Function
+             297:    105(ptr) Variable Function
+             307:    105(ptr) Variable Function
+             322:    117(ptr) Variable Function
+        414(cv2):     93(ptr) Variable Function
+        415(cv5):     44(ptr) Variable Function
               12:      9(int) Load 11(u_i)
               15:     6(bool) INotEqual 12 14
               19:   16(float) Load 18(u_f)
@@ -408,170 +408,188 @@ Linked fragment stage:
              266:      9(int) Load 58(i)
              267:   16(float) ConvertSToF 266
              268:     6(bool) FOrdLessThan 265 267
-             269:      9(int) Load 58(i)
-             270:   16(float) ConvertSToF 269
-             271:   16(float) Load 106(f)
-             272:     6(bool) FOrdLessThan 270 271
-             273:     6(bool) LogicalOr 268 272
-             274:   69(fvec2) Load 110(f2)
-             275:   66(ivec2) Load 68(i2)
-             276:   69(fvec2) ConvertSToF 275
-             277:   23(bvec2) FOrdEqual 274 276
-             278:     6(bool) All 277
-             279:     6(bool) LogicalOr 273 278
-             280:   79(ivec3) Load 81(i3)
-             281:   82(fvec3) ConvertSToF 280
-             282:   82(fvec3) Load 114(f3)
-             283:   31(bvec3) FOrdNotEqual 281 282
-             284:     6(bool) Any 283
-             285:     6(bool) LogicalOr 279 284
-                              SelectionMerge 287 None
-                              BranchConditional 285 286 287
-             286:               Label
-             289:     6(bool)   Load 8(b)
-                                SelectionMerge 291 None
-                                BranchConditional 289 290 294
-             290:                 Label
-             292:      9(int)     Load 58(i)
-             293:   16(float)     ConvertSToF 292
-                                  Store 288 293
-                                  Branch 291
-             294:                 Label
-             295:   69(fvec2)     Load 110(f2)
-             296:   16(float)     CompositeExtract 295 0
-                                  Store 288 296
-                                  Branch 291
-             291:               Label
-             297:   16(float)   Load 288
-             299:   23(bvec2)   Load 25(b2)
-             300:     6(bool)   CompositeExtract 299 0
-                                SelectionMerge 302 None
-                                BranchConditional 300 301 305
-             301:                 Label
-             303:   82(fvec3)     Load 114(f3)
-             304:   16(float)     CompositeExtract 303 0
-                                  Store 298 304
-                                  Branch 302
-             305:                 Label
-             306:   66(ivec2)     Load 68(i2)
-             307:      9(int)     CompositeExtract 306 1
-             308:   16(float)     ConvertSToF 307
-                                  Store 298 308
-                                  Branch 302
-             302:               Label
-             309:   16(float)   Load 298
-             310:   16(float)   FAdd 297 309
-                                Store 106(f) 310
-                                Branch 287
-             287:             Label
-             314:     6(bool) Load 8(b)
-             315:   23(bvec2) Load 25(b2)
-             316:     6(bool) CompositeExtract 315 0
-             317:     6(bool) LogicalOr 314 316
-             318:   23(bvec2) Load 25(b2)
-             319:     6(bool) CompositeExtract 318 1
-             320:     6(bool) LogicalOr 317 319
-             321:   31(bvec3) Load 33(b3)
-             322:     6(bool) CompositeExtract 321 0
-             323:     6(bool) LogicalOr 320 322
-             324:   31(bvec3) Load 33(b3)
-             325:     6(bool) CompositeExtract 324 1
+             269:     6(bool) LogicalNot 268
+                              SelectionMerge 271 None
+                              BranchConditional 269 270 271
+             270:               Label
+             272:      9(int)   Load 58(i)
+             273:   16(float)   ConvertSToF 272
+             274:   16(float)   Load 106(f)
+             275:     6(bool)   FOrdLessThan 273 274
+                                Branch 271
+             271:             Label
+             276:     6(bool) Phi 268 5 275 270
+             277:     6(bool) LogicalNot 276
+                              SelectionMerge 279 None
+                              BranchConditional 277 278 279
+             278:               Label
+             280:   69(fvec2)   Load 110(f2)
+             281:   66(ivec2)   Load 68(i2)
+             282:   69(fvec2)   ConvertSToF 281
+             283:   23(bvec2)   FOrdEqual 280 282
+             284:     6(bool)   All 283
+                                Branch 279
+             279:             Label
+             285:     6(bool) Phi 276 271 284 278
+             286:     6(bool) LogicalNot 285
+                              SelectionMerge 288 None
+                              BranchConditional 286 287 288
+             287:               Label
+             289:   79(ivec3)   Load 81(i3)
+             290:   82(fvec3)   ConvertSToF 289
+             291:   82(fvec3)   Load 114(f3)
+             292:   31(bvec3)   FOrdNotEqual 290 291
+             293:     6(bool)   Any 292
+                                Branch 288
+             288:             Label
+             294:     6(bool) Phi 285 279 293 287
+                              SelectionMerge 296 None
+                              BranchConditional 294 295 296
+             295:               Label
+             298:     6(bool)   Load 8(b)
+                                SelectionMerge 300 None
+                                BranchConditional 298 299 303
+             299:                 Label
+             301:      9(int)     Load 58(i)
+             302:   16(float)     ConvertSToF 301
+                                  Store 297 302
+                                  Branch 300
+             303:                 Label
+             304:   69(fvec2)     Load 110(f2)
+             305:   16(float)     CompositeExtract 304 0
+                                  Store 297 305
+                                  Branch 300
+             300:               Label
+             306:   16(float)   Load 297
+             308:   23(bvec2)   Load 25(b2)
+             309:     6(bool)   CompositeExtract 308 0
+                                SelectionMerge 311 None
+                                BranchConditional 309 310 314
+             310:                 Label
+             312:   82(fvec3)     Load 114(f3)
+             313:   16(float)     CompositeExtract 312 0
+                                  Store 307 313
+                                  Branch 311
+             314:                 Label
+             315:   66(ivec2)     Load 68(i2)
+             316:      9(int)     CompositeExtract 315 1
+             317:   16(float)     ConvertSToF 316
+                                  Store 307 317
+                                  Branch 311
+             311:               Label
+             318:   16(float)   Load 307
+             319:   16(float)   FAdd 306 318
+                                Store 106(f) 319
+                                Branch 296
+             296:             Label
+             323:     6(bool) Load 8(b)
+             324:   23(bvec2) Load 25(b2)
+             325:     6(bool) CompositeExtract 324 0
              326:     6(bool) LogicalOr 323 325
-             327:   31(bvec3) Load 33(b3)
-             328:     6(bool) CompositeExtract 327 2
+             327:   23(bvec2) Load 25(b2)
+             328:     6(bool) CompositeExtract 327 1
              329:     6(bool) LogicalOr 326 328
-             330:   43(bvec4) Load 45(b4)
+             330:   31(bvec3) Load 33(b3)
              331:     6(bool) CompositeExtract 330 0
              332:     6(bool) LogicalOr 329 331
-             333:   43(bvec4) Load 45(b4)
+             333:   31(bvec3) Load 33(b3)
              334:     6(bool) CompositeExtract 333 1
              335:     6(bool) LogicalOr 332 334
-             336:   43(bvec4) Load 45(b4)
+             336:   31(bvec3) Load 33(b3)
              337:     6(bool) CompositeExtract 336 2
              338:     6(bool) LogicalOr 335 337
              339:   43(bvec4) Load 45(b4)
-             340:     6(bool) CompositeExtract 339 3
+             340:     6(bool) CompositeExtract 339 0
              341:     6(bool) LogicalOr 338 340
-                              SelectionMerge 343 None
-                              BranchConditional 341 342 403
-             342:               Label
-             344:      9(int)   Load 58(i)
-             345:   66(ivec2)   Load 68(i2)
-             346:      9(int)   CompositeExtract 345 0
-             347:      9(int)   IAdd 344 346
-             348:   66(ivec2)   Load 68(i2)
-             349:      9(int)   CompositeExtract 348 1
-             350:      9(int)   IAdd 347 349
-             351:   79(ivec3)   Load 81(i3)
-             352:      9(int)   CompositeExtract 351 0
-             353:      9(int)   IAdd 350 352
-             354:   79(ivec3)   Load 81(i3)
-             355:      9(int)   CompositeExtract 354 1
+             342:   43(bvec4) Load 45(b4)
+             343:     6(bool) CompositeExtract 342 1
+             344:     6(bool) LogicalOr 341 343
+             345:   43(bvec4) Load 45(b4)
+             346:     6(bool) CompositeExtract 345 2
+             347:     6(bool) LogicalOr 344 346
+             348:   43(bvec4) Load 45(b4)
+             349:     6(bool) CompositeExtract 348 3
+             350:     6(bool) LogicalOr 347 349
+                              SelectionMerge 352 None
+                              BranchConditional 350 351 412
+             351:               Label
+             353:      9(int)   Load 58(i)
+             354:   66(ivec2)   Load 68(i2)
+             355:      9(int)   CompositeExtract 354 0
              356:      9(int)   IAdd 353 355
-             357:   79(ivec3)   Load 81(i3)
-             358:      9(int)   CompositeExtract 357 2
+             357:   66(ivec2)   Load 68(i2)
+             358:      9(int)   CompositeExtract 357 1
              359:      9(int)   IAdd 356 358
-             360:   92(ivec4)   Load 94(i4)
+             360:   79(ivec3)   Load 81(i3)
              361:      9(int)   CompositeExtract 360 0
              362:      9(int)   IAdd 359 361
-             363:   92(ivec4)   Load 94(i4)
+             363:   79(ivec3)   Load 81(i3)
              364:      9(int)   CompositeExtract 363 1
              365:      9(int)   IAdd 362 364
-             366:   92(ivec4)   Load 94(i4)
+             366:   79(ivec3)   Load 81(i3)
              367:      9(int)   CompositeExtract 366 2
              368:      9(int)   IAdd 365 367
              369:   92(ivec4)   Load 94(i4)
-             370:      9(int)   CompositeExtract 369 3
+             370:      9(int)   CompositeExtract 369 0
              371:      9(int)   IAdd 368 370
-             372:   16(float)   ConvertSToF 371
-             373:   16(float)   Load 106(f)
-             374:   16(float)   FAdd 372 373
-             375:   69(fvec2)   Load 110(f2)
-             376:   16(float)   CompositeExtract 375 0
-             377:   16(float)   FAdd 374 376
-             378:   69(fvec2)   Load 110(f2)
-             379:   16(float)   CompositeExtract 378 1
-             380:   16(float)   FAdd 377 379
-             381:   82(fvec3)   Load 114(f3)
-             382:   16(float)   CompositeExtract 381 0
-             383:   16(float)   FAdd 380 382
-             384:   82(fvec3)   Load 114(f3)
-             385:   16(float)   CompositeExtract 384 1
+             372:   92(ivec4)   Load 94(i4)
+             373:      9(int)   CompositeExtract 372 1
+             374:      9(int)   IAdd 371 373
+             375:   92(ivec4)   Load 94(i4)
+             376:      9(int)   CompositeExtract 375 2
+             377:      9(int)   IAdd 374 376
+             378:   92(ivec4)   Load 94(i4)
+             379:      9(int)   CompositeExtract 378 3
+             380:      9(int)   IAdd 377 379
+             381:   16(float)   ConvertSToF 380
+             382:   16(float)   Load 106(f)
+             383:   16(float)   FAdd 381 382
+             384:   69(fvec2)   Load 110(f2)
+             385:   16(float)   CompositeExtract 384 0
              386:   16(float)   FAdd 383 385
-             387:   82(fvec3)   Load 114(f3)
-             388:   16(float)   CompositeExtract 387 2
+             387:   69(fvec2)   Load 110(f2)
+             388:   16(float)   CompositeExtract 387 1
              389:   16(float)   FAdd 386 388
-             390:   95(fvec4)   Load 118(f4)
+             390:   82(fvec3)   Load 114(f3)
              391:   16(float)   CompositeExtract 390 0
              392:   16(float)   FAdd 389 391
-             393:   95(fvec4)   Load 118(f4)
+             393:   82(fvec3)   Load 114(f3)
              394:   16(float)   CompositeExtract 393 1
              395:   16(float)   FAdd 392 394
-             396:   95(fvec4)   Load 118(f4)
+             396:   82(fvec3)   Load 114(f3)
              397:   16(float)   CompositeExtract 396 2
              398:   16(float)   FAdd 395 397
              399:   95(fvec4)   Load 118(f4)
-             400:   16(float)   CompositeExtract 399 3
+             400:   16(float)   CompositeExtract 399 0
              401:   16(float)   FAdd 398 400
-             402:   95(fvec4)   CompositeConstruct 401 401 401 401
-                                Store 313 402
-                                Branch 343
-             403:               Label
-                                Store 313 151
-                                Branch 343
-             343:             Label
-             404:   95(fvec4) Load 313
-                              Store 312(gl_FragColor) 404
-                              Store 405(cv2) 102
-             407:   92(ivec4) Load 405(cv2)
-             408:   43(bvec4) INotEqual 407 160
-                              Store 406(cv5) 408
-             409:   43(bvec4) Load 406(cv5)
-             410:   95(fvec4) Select 409 151 150
-             411:   16(float) CompositeExtract 410 0
-             412:   95(fvec4) Load 312(gl_FragColor)
-             413:   95(fvec4) CompositeConstruct 411 411 411 411
-             414:   95(fvec4) FAdd 412 413
-                              Store 312(gl_FragColor) 414
+             402:   95(fvec4)   Load 118(f4)
+             403:   16(float)   CompositeExtract 402 1
+             404:   16(float)   FAdd 401 403
+             405:   95(fvec4)   Load 118(f4)
+             406:   16(float)   CompositeExtract 405 2
+             407:   16(float)   FAdd 404 406
+             408:   95(fvec4)   Load 118(f4)
+             409:   16(float)   CompositeExtract 408 3
+             410:   16(float)   FAdd 407 409
+             411:   95(fvec4)   CompositeConstruct 410 410 410 410
+                                Store 322 411
+                                Branch 352
+             412:               Label
+                                Store 322 151
+                                Branch 352
+             352:             Label
+             413:   95(fvec4) Load 322
+                              Store 321(gl_FragColor) 413
+                              Store 414(cv2) 102
+             416:   92(ivec4) Load 414(cv2)
+             417:   43(bvec4) INotEqual 416 160
+                              Store 415(cv5) 417
+             418:   43(bvec4) Load 415(cv5)
+             419:   95(fvec4) Select 418 151 150
+             420:   16(float) CompositeExtract 419 0
+             421:   95(fvec4) Load 321(gl_FragColor)
+             422:   95(fvec4) CompositeConstruct 420 420 420 420
+             423:   95(fvec4) FAdd 421 422
+                              Store 321(gl_FragColor) 423
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/spv.loops.frag.out b/Test/baseResults/spv.loops.frag.out
index 6dc80cb25380f2ac9c72a4dd5d506cce9b77f5b6..f2d2fea5d502fa531feffae4466177e658a0c0e3 100755
--- a/Test/baseResults/spv.loops.frag.out
+++ b/Test/baseResults/spv.loops.frag.out
@@ -7,7 +7,7 @@ Linked fragment stage:
 
 // Module Version 99
 // Generated by (magic number): 51a00bb
-// Id's are bound by 749
+// Id's are bound by 753
 
                               Source GLSL 130
                               Capability Shader
@@ -22,74 +22,74 @@ Linked fragment stage:
                               Name 51  "bigColor"
                               Name 62  "bigColor1_1"
                               Name 92  "d2"
-                              Name 97  "d3"
-                              Name 101  "bigColor1_2"
-                              Name 112  "bigColor1_3"
-                              Name 118  "d4"
-                              Name 129  "i"
-                              Name 136  "Count"
-                              Name 139  "bigColor2"
-                              Name 157  "bigColor3"
-                              Name 162  "i"
-                              Name 177  "i"
-                              Name 215  "i"
-                              Name 240  "i"
-                              Name 268  "i"
-                              Name 305  "bigColor4"
-                              Name 343  "d5"
-                              Name 347  "bigColor5"
-                              Name 365  "d6"
-                              Name 377  "bigColor6"
-                              Name 412  "d7"
-                              Name 446  "bigColor7"
-                              Name 471  "d8"
-                              Name 517  "d9"
-                              Name 549  "d10"
-                              Name 559  "d11"
-                              Name 571  "d12"
-                              Name 599  "bigColor8"
-                              Name 627  "gl_FragColor"
-                              Name 634  "d14"
-                              Name 639  "d15"
-                              Name 657  "d16"
-                              Name 695  "d17"
-                              Name 701  "d18"
-                              Name 732  "d13"
-                              Name 733  "d19"
-                              Name 734  "d20"
-                              Name 735  "d21"
-                              Name 736  "d22"
-                              Name 737  "d23"
-                              Name 738  "d24"
-                              Name 739  "d25"
-                              Name 740  "d26"
-                              Name 741  "d27"
-                              Name 742  "d28"
-                              Name 743  "d29"
-                              Name 744  "d30"
-                              Name 745  "d31"
-                              Name 746  "d32"
-                              Name 747  "d33"
-                              Name 748  "d34"
+                              Name 99  "d3"
+                              Name 103  "bigColor1_2"
+                              Name 114  "bigColor1_3"
+                              Name 120  "d4"
+                              Name 131  "i"
+                              Name 138  "Count"
+                              Name 141  "bigColor2"
+                              Name 159  "bigColor3"
+                              Name 164  "i"
+                              Name 179  "i"
+                              Name 217  "i"
+                              Name 242  "i"
+                              Name 270  "i"
+                              Name 307  "bigColor4"
+                              Name 345  "d5"
+                              Name 349  "bigColor5"
+                              Name 367  "d6"
+                              Name 379  "bigColor6"
+                              Name 414  "d7"
+                              Name 448  "bigColor7"
+                              Name 473  "d8"
+                              Name 519  "d9"
+                              Name 551  "d10"
+                              Name 561  "d11"
+                              Name 573  "d12"
+                              Name 601  "bigColor8"
+                              Name 629  "gl_FragColor"
+                              Name 636  "d14"
+                              Name 641  "d15"
+                              Name 659  "d16"
+                              Name 699  "d17"
+                              Name 705  "d18"
+                              Name 736  "d13"
+                              Name 737  "d19"
+                              Name 738  "d20"
+                              Name 739  "d21"
+                              Name 740  "d22"
+                              Name 741  "d23"
+                              Name 742  "d24"
+                              Name 743  "d25"
+                              Name 744  "d26"
+                              Name 745  "d27"
+                              Name 746  "d28"
+                              Name 747  "d29"
+                              Name 748  "d30"
+                              Name 749  "d31"
+                              Name 750  "d32"
+                              Name 751  "d33"
+                              Name 752  "d34"
                               Decorate 11(BaseColor) Smooth
-                              Decorate 627(gl_FragColor) BuiltIn FragColor
-                              Decorate 732(d13) NoStaticUse
-                              Decorate 733(d19) NoStaticUse
-                              Decorate 734(d20) NoStaticUse
-                              Decorate 735(d21) NoStaticUse
-                              Decorate 736(d22) NoStaticUse
-                              Decorate 737(d23) NoStaticUse
-                              Decorate 738(d24) NoStaticUse
-                              Decorate 739(d25) NoStaticUse
-                              Decorate 740(d26) NoStaticUse
-                              Decorate 741(d27) NoStaticUse
-                              Decorate 742(d28) NoStaticUse
-                              Decorate 743(d29) NoStaticUse
-                              Decorate 744(d30) NoStaticUse
-                              Decorate 745(d31) NoStaticUse
-                              Decorate 746(d32) NoStaticUse
-                              Decorate 747(d33) NoStaticUse
-                              Decorate 748(d34) NoStaticUse
+                              Decorate 629(gl_FragColor) BuiltIn FragColor
+                              Decorate 736(d13) NoStaticUse
+                              Decorate 737(d19) NoStaticUse
+                              Decorate 738(d20) NoStaticUse
+                              Decorate 739(d21) NoStaticUse
+                              Decorate 740(d22) NoStaticUse
+                              Decorate 741(d23) NoStaticUse
+                              Decorate 742(d24) NoStaticUse
+                              Decorate 743(d25) NoStaticUse
+                              Decorate 744(d26) NoStaticUse
+                              Decorate 745(d27) NoStaticUse
+                              Decorate 746(d28) NoStaticUse
+                              Decorate 747(d29) NoStaticUse
+                              Decorate 748(d30) NoStaticUse
+                              Decorate 749(d31) NoStaticUse
+                              Decorate 750(d32) NoStaticUse
+                              Decorate 751(d33) NoStaticUse
+                              Decorate 752(d34) NoStaticUse
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -111,73 +111,73 @@ Linked fragment stage:
               81:    6(float) Constant 1109917696
               84:    6(float) Constant 1065353216
           92(d2):     46(ptr) Variable UniformConstant
-          97(d3):     46(ptr) Variable UniformConstant
-101(bigColor1_2):     50(ptr) Variable UniformConstant
-112(bigColor1_3):     50(ptr) Variable UniformConstant
-         118(d4):     46(ptr) Variable UniformConstant
-             127:             TypeInt 32 1
-             128:             TypePointer Function 127(int)
-             130:    127(int) Constant 0
-             135:             TypePointer UniformConstant 127(int)
-      136(Count):    135(ptr) Variable UniformConstant
-  139(bigColor2):     50(ptr) Variable UniformConstant
-             144:    127(int) Constant 1
-  157(bigColor3):     50(ptr) Variable UniformConstant
-             161:    16(bool) ConstantFalse
-             167:    127(int) Constant 42
-             182:    127(int) Constant 100
-             186:    6(float) Constant 1101004800
-             220:    127(int) Constant 120
-  305(bigColor4):     50(ptr) Variable UniformConstant
-         343(d5):     46(ptr) Variable UniformConstant
-  347(bigColor5):     50(ptr) Variable UniformConstant
-         365(d6):     46(ptr) Variable UniformConstant
-  377(bigColor6):     50(ptr) Variable UniformConstant
-         412(d7):     46(ptr) Variable UniformConstant
-             441:    6(float) Constant 0
-  446(bigColor7):     50(ptr) Variable UniformConstant
-         471(d8):     46(ptr) Variable UniformConstant
-             493:    6(float) Constant 1073741824
-         517(d9):     46(ptr) Variable UniformConstant
-             533:    6(float) Constant 1084227584
-        549(d10):     46(ptr) Variable UniformConstant
-        559(d11):     46(ptr) Variable UniformConstant
-        571(d12):     46(ptr) Variable UniformConstant
-             597:    6(float) Constant 1092616192
-  599(bigColor8):     50(ptr) Variable UniformConstant
-             626:             TypePointer Output 7(fvec4)
-627(gl_FragColor):    626(ptr) Variable Output
-        634(d14):     46(ptr) Variable UniformConstant
-        639(d15):     46(ptr) Variable UniformConstant
-        657(d16):     46(ptr) Variable UniformConstant
-        695(d17):     46(ptr) Variable UniformConstant
-        701(d18):     46(ptr) Variable UniformConstant
-        732(d13):     46(ptr) Variable UniformConstant
-        733(d19):     46(ptr) Variable UniformConstant
-        734(d20):     46(ptr) Variable UniformConstant
-        735(d21):     46(ptr) Variable UniformConstant
-        736(d22):     46(ptr) Variable UniformConstant
-        737(d23):     46(ptr) Variable UniformConstant
-        738(d24):     46(ptr) Variable UniformConstant
-        739(d25):     46(ptr) Variable UniformConstant
-        740(d26):     46(ptr) Variable UniformConstant
-        741(d27):     46(ptr) Variable UniformConstant
-        742(d28):     46(ptr) Variable UniformConstant
-        743(d29):     46(ptr) Variable UniformConstant
-        744(d30):     46(ptr) Variable UniformConstant
-        745(d31):     46(ptr) Variable UniformConstant
-        746(d32):     46(ptr) Variable UniformConstant
-        747(d33):     46(ptr) Variable UniformConstant
-        748(d34):     46(ptr) Variable UniformConstant
+          99(d3):     46(ptr) Variable UniformConstant
+103(bigColor1_2):     50(ptr) Variable UniformConstant
+114(bigColor1_3):     50(ptr) Variable UniformConstant
+         120(d4):     46(ptr) Variable UniformConstant
+             129:             TypeInt 32 1
+             130:             TypePointer Function 129(int)
+             132:    129(int) Constant 0
+             137:             TypePointer UniformConstant 129(int)
+      138(Count):    137(ptr) Variable UniformConstant
+  141(bigColor2):     50(ptr) Variable UniformConstant
+             146:    129(int) Constant 1
+  159(bigColor3):     50(ptr) Variable UniformConstant
+             163:    16(bool) ConstantFalse
+             169:    129(int) Constant 42
+             184:    129(int) Constant 100
+             188:    6(float) Constant 1101004800
+             222:    129(int) Constant 120
+  307(bigColor4):     50(ptr) Variable UniformConstant
+         345(d5):     46(ptr) Variable UniformConstant
+  349(bigColor5):     50(ptr) Variable UniformConstant
+         367(d6):     46(ptr) Variable UniformConstant
+  379(bigColor6):     50(ptr) Variable UniformConstant
+         414(d7):     46(ptr) Variable UniformConstant
+             443:    6(float) Constant 0
+  448(bigColor7):     50(ptr) Variable UniformConstant
+         473(d8):     46(ptr) Variable UniformConstant
+             495:    6(float) Constant 1073741824
+         519(d9):     46(ptr) Variable UniformConstant
+             535:    6(float) Constant 1084227584
+        551(d10):     46(ptr) Variable UniformConstant
+        561(d11):     46(ptr) Variable UniformConstant
+        573(d12):     46(ptr) Variable UniformConstant
+             599:    6(float) Constant 1092616192
+  601(bigColor8):     50(ptr) Variable UniformConstant
+             628:             TypePointer Output 7(fvec4)
+629(gl_FragColor):    628(ptr) Variable Output
+        636(d14):     46(ptr) Variable UniformConstant
+        641(d15):     46(ptr) Variable UniformConstant
+        659(d16):     46(ptr) Variable UniformConstant
+        699(d17):     46(ptr) Variable UniformConstant
+        705(d18):     46(ptr) Variable UniformConstant
+        736(d13):     46(ptr) Variable UniformConstant
+        737(d19):     46(ptr) Variable UniformConstant
+        738(d20):     46(ptr) Variable UniformConstant
+        739(d21):     46(ptr) Variable UniformConstant
+        740(d22):     46(ptr) Variable UniformConstant
+        741(d23):     46(ptr) Variable UniformConstant
+        742(d24):     46(ptr) Variable UniformConstant
+        743(d25):     46(ptr) Variable UniformConstant
+        744(d26):     46(ptr) Variable UniformConstant
+        745(d27):     46(ptr) Variable UniformConstant
+        746(d28):     46(ptr) Variable UniformConstant
+        747(d29):     46(ptr) Variable UniformConstant
+        748(d30):     46(ptr) Variable UniformConstant
+        749(d31):     46(ptr) Variable UniformConstant
+        750(d32):     46(ptr) Variable UniformConstant
+        751(d33):     46(ptr) Variable UniformConstant
+        752(d34):     46(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
         9(color):      8(ptr) Variable Function
-          129(i):    128(ptr) Variable Function
-          162(i):    128(ptr) Variable Function
-          177(i):    128(ptr) Variable Function
-          215(i):    128(ptr) Variable Function
-          240(i):    128(ptr) Variable Function
-          268(i):    128(ptr) Variable Function
+          131(i):    130(ptr) Variable Function
+          164(i):    130(ptr) Variable Function
+          179(i):    130(ptr) Variable Function
+          217(i):    130(ptr) Variable Function
+          242(i):    130(ptr) Variable Function
+          270(i):    130(ptr) Variable Function
               12:    7(fvec4) Load 11(BaseColor)
                               Store 9(color) 12
                               Branch 13
@@ -275,868 +275,878 @@ Linked fragment stage:
               91:    6(float) CompositeExtract 90 3
               93:    6(float) Load 92(d2)
               94:    16(bool) FOrdLessThan 91 93
-              95:    7(fvec4) Load 9(color)
-              96:    6(float) CompositeExtract 95 1
-              98:    6(float) Load 97(d3)
-              99:    16(bool) FOrdLessThan 96 98
-             100:    16(bool) LogicalAnd 94 99
+                              SelectionMerge 96 None
+                              BranchConditional 94 95 96
+              95:               Label
+              97:    7(fvec4)   Load 9(color)
+              98:    6(float)   CompositeExtract 97 1
+             100:    6(float)   Load 99(d3)
+             101:    16(bool)   FOrdLessThan 98 100
+                                Branch 96
+              96:             Label
+             102:    16(bool) Phi 94 87 101 95
                               LoopMerge 88 None
-                              BranchConditional 100 89 88
+                              BranchConditional 102 89 88
               89:               Label
-             102:    7(fvec4)   Load 101(bigColor1_2)
-             103:    7(fvec4)   Load 9(color)
-             104:    7(fvec4)   FAdd 103 102
-                                Store 9(color) 104
+             104:    7(fvec4)   Load 103(bigColor1_2)
+             105:    7(fvec4)   Load 9(color)
+             106:    7(fvec4)   FAdd 105 104
+                                Store 9(color) 106
                                 Branch 87
               88:             Label
-                              Branch 105
-             105:             Label
-             108:    7(fvec4) Load 9(color)
-             109:    6(float) CompositeExtract 108 2
-             110:    6(float) Load 97(d3)
-             111:    16(bool) FOrdLessThan 109 110
-                              LoopMerge 106 None
-                              BranchConditional 111 107 106
-             107:               Label
-             113:    7(fvec4)   Load 112(bigColor1_3)
-             114:    7(fvec4)   Load 9(color)
-             115:    7(fvec4)   FAdd 114 113
-                                Store 9(color) 115
+                              Branch 107
+             107:             Label
+             110:    7(fvec4) Load 9(color)
+             111:    6(float) CompositeExtract 110 2
+             112:    6(float) Load 99(d3)
+             113:    16(bool) FOrdLessThan 111 112
+                              LoopMerge 108 None
+                              BranchConditional 113 109 108
+             109:               Label
+             115:    7(fvec4)   Load 114(bigColor1_3)
              116:    7(fvec4)   Load 9(color)
-             117:    6(float)   CompositeExtract 116 1
-             119:    6(float)   Load 118(d4)
-             120:    16(bool)   FOrdLessThan 117 119
-                                SelectionMerge 122 None
-                                BranchConditional 120 121 122
-             121:                 Label
-                                  Branch 106
-             122:               Label
-             124:    7(fvec4)   Load 112(bigColor1_3)
-             125:    7(fvec4)   Load 9(color)
-             126:    7(fvec4)   FAdd 125 124
-                                Store 9(color) 126
-                                Branch 105
-             106:             Label
-                              Store 129(i) 130
-                              Branch 131
-             131:             Label
-             134:    127(int) Load 129(i)
-             137:    127(int) Load 136(Count)
-             138:    16(bool) SLessThan 134 137
-                              LoopMerge 132 None
-                              BranchConditional 138 133 132
-             133:               Label
-             140:    7(fvec4)   Load 139(bigColor2)
-             141:    7(fvec4)   Load 9(color)
-             142:    7(fvec4)   FAdd 141 140
-                                Store 9(color) 142
-             143:    127(int)   Load 129(i)
-             145:    127(int)   IAdd 143 144
-                                Store 129(i) 145
-                                Branch 131
-             132:             Label
-                              Branch 146
-             146:             Label
-             149:    16(bool) Phi 17 132 161 148
-                              LoopMerge 147 None
-                              Branch 150
-             150:             Label
-                              SelectionMerge 148 None
-                              BranchConditional 149 148 151
-             151:               Label
-             152:    7(fvec4)   Load 9(color)
-             153:    6(float)   CompositeExtract 152 0
-             154:    6(float)   Load 92(d2)
-             155:    16(bool)   FOrdLessThan 153 154
-                                SelectionMerge 156 None
-                                BranchConditional 155 156 147
-             156:               Label
-                                Branch 148
+             117:    7(fvec4)   FAdd 116 115
+                                Store 9(color) 117
+             118:    7(fvec4)   Load 9(color)
+             119:    6(float)   CompositeExtract 118 1
+             121:    6(float)   Load 120(d4)
+             122:    16(bool)   FOrdLessThan 119 121
+                                SelectionMerge 124 None
+                                BranchConditional 122 123 124
+             123:                 Label
+                                  Branch 108
+             124:               Label
+             126:    7(fvec4)   Load 114(bigColor1_3)
+             127:    7(fvec4)   Load 9(color)
+             128:    7(fvec4)   FAdd 127 126
+                                Store 9(color) 128
+                                Branch 107
+             108:             Label
+                              Store 131(i) 132
+                              Branch 133
+             133:             Label
+             136:    129(int) Load 131(i)
+             139:    129(int) Load 138(Count)
+             140:    16(bool) SLessThan 136 139
+                              LoopMerge 134 None
+                              BranchConditional 140 135 134
+             135:               Label
+             142:    7(fvec4)   Load 141(bigColor2)
+             143:    7(fvec4)   Load 9(color)
+             144:    7(fvec4)   FAdd 143 142
+                                Store 9(color) 144
+             145:    129(int)   Load 131(i)
+             147:    129(int)   IAdd 145 146
+                                Store 131(i) 147
+                                Branch 133
+             134:             Label
+                              Branch 148
              148:             Label
-             158:    7(fvec4) Load 157(bigColor3)
-             159:    7(fvec4) Load 9(color)
-             160:    7(fvec4) FAdd 159 158
-                              Store 9(color) 160
-                              Branch 146
-             147:             Label
-                              Store 162(i) 130
-                              Branch 163
-             163:             Label
-             166:    127(int) Load 162(i)
-             168:    16(bool) SLessThan 166 167
-                              LoopMerge 164 None
-                              BranchConditional 168 165 164
-             165:               Label
-             169:    6(float)   Load 97(d3)
-             170:    7(fvec4)   Load 9(color)
-             171:    6(float)   CompositeExtract 170 2
-             172:    6(float)   FAdd 171 169
-             173:    7(fvec4)   Load 9(color)
-             174:    7(fvec4)   CompositeInsert 172 173 2
-                                Store 9(color) 174
-             175:    127(int)   Load 162(i)
-             176:    127(int)   IAdd 175 144
-                                Store 162(i) 176
-                                Branch 163
-             164:             Label
-                              Store 177(i) 130
-                              Branch 178
-             178:             Label
-             181:    127(int) Load 177(i)
-             183:    16(bool) SLessThan 181 182
-                              LoopMerge 179 None
-                              BranchConditional 183 180 179
-             180:               Label
-             184:    7(fvec4)   Load 9(color)
-             185:    6(float)   CompositeExtract 184 2
-             187:    16(bool)   FOrdLessThan 185 186
-                                SelectionMerge 189 None
-                                BranchConditional 187 188 195
-             188:                 Label
-             190:    7(fvec4)     Load 9(color)
-             191:    6(float)     CompositeExtract 190 0
-             192:    6(float)     FAdd 191 84
-             193:    7(fvec4)     Load 9(color)
-             194:    7(fvec4)     CompositeInsert 192 193 0
-                                  Store 9(color) 194
-                                  Branch 189
-             195:                 Label
-             196:    7(fvec4)     Load 9(color)
-             197:    6(float)     CompositeExtract 196 1
-             198:    6(float)     FAdd 197 84
-             199:    7(fvec4)     Load 9(color)
-             200:    7(fvec4)     CompositeInsert 198 199 1
-                                  Store 9(color) 200
-                                  Branch 189
-             189:               Label
-             201:    7(fvec4)   Load 9(color)
-             202:    6(float)   CompositeExtract 201 3
-             203:    16(bool)   FOrdLessThan 202 186
-                                SelectionMerge 205 None
-                                BranchConditional 203 204 205
-             204:                 Label
-             206:    7(fvec4)     Load 9(color)
-             207:    6(float)     CompositeExtract 206 2
+             151:    16(bool) Phi 17 134 163 150
+                              LoopMerge 149 None
+                              Branch 152
+             152:             Label
+                              SelectionMerge 150 None
+                              BranchConditional 151 150 153
+             153:               Label
+             154:    7(fvec4)   Load 9(color)
+             155:    6(float)   CompositeExtract 154 0
+             156:    6(float)   Load 92(d2)
+             157:    16(bool)   FOrdLessThan 155 156
+                                SelectionMerge 158 None
+                                BranchConditional 157 158 149
+             158:               Label
+                                Branch 150
+             150:             Label
+             160:    7(fvec4) Load 159(bigColor3)
+             161:    7(fvec4) Load 9(color)
+             162:    7(fvec4) FAdd 161 160
+                              Store 9(color) 162
+                              Branch 148
+             149:             Label
+                              Store 164(i) 132
+                              Branch 165
+             165:             Label
+             168:    129(int) Load 164(i)
+             170:    16(bool) SLessThan 168 169
+                              LoopMerge 166 None
+                              BranchConditional 170 167 166
+             167:               Label
+             171:    6(float)   Load 99(d3)
+             172:    7(fvec4)   Load 9(color)
+             173:    6(float)   CompositeExtract 172 2
+             174:    6(float)   FAdd 173 171
+             175:    7(fvec4)   Load 9(color)
+             176:    7(fvec4)   CompositeInsert 174 175 2
+                                Store 9(color) 176
+             177:    129(int)   Load 164(i)
+             178:    129(int)   IAdd 177 146
+                                Store 164(i) 178
+                                Branch 165
+             166:             Label
+                              Store 179(i) 132
+                              Branch 180
+             180:             Label
+             183:    129(int) Load 179(i)
+             185:    16(bool) SLessThan 183 184
+                              LoopMerge 181 None
+                              BranchConditional 185 182 181
+             182:               Label
+             186:    7(fvec4)   Load 9(color)
+             187:    6(float)   CompositeExtract 186 2
+             189:    16(bool)   FOrdLessThan 187 188
+                                SelectionMerge 191 None
+                                BranchConditional 189 190 197
+             190:                 Label
+             192:    7(fvec4)     Load 9(color)
+             193:    6(float)     CompositeExtract 192 0
+             194:    6(float)     FAdd 193 84
+             195:    7(fvec4)     Load 9(color)
+             196:    7(fvec4)     CompositeInsert 194 195 0
+                                  Store 9(color) 196
+                                  Branch 191
+             197:                 Label
+             198:    7(fvec4)     Load 9(color)
+             199:    6(float)     CompositeExtract 198 1
+             200:    6(float)     FAdd 199 84
+             201:    7(fvec4)     Load 9(color)
+             202:    7(fvec4)     CompositeInsert 200 201 1
+                                  Store 9(color) 202
+                                  Branch 191
+             191:               Label
+             203:    7(fvec4)   Load 9(color)
+             204:    6(float)   CompositeExtract 203 3
+             205:    16(bool)   FOrdLessThan 204 188
+                                SelectionMerge 207 None
+                                BranchConditional 205 206 207
+             206:                 Label
              208:    7(fvec4)     Load 9(color)
-             209:    6(float)     CompositeExtract 208 1
-             210:    16(bool)     FOrdGreaterThan 207 209
-                                  SelectionMerge 212 None
-                                  BranchConditional 210 211 212
-             211:                   Label
-                                    Branch 212
-             212:                 Label
-                                  Branch 205
-             205:               Label
-             213:    127(int)   Load 177(i)
-             214:    127(int)   IAdd 213 144
-                                Store 177(i) 214
-                                Branch 178
-             179:             Label
-                              Store 215(i) 130
-                              Branch 216
-             216:             Label
-             219:    127(int) Load 215(i)
-             221:    16(bool) SLessThan 219 220
-                              LoopMerge 217 None
-                              BranchConditional 221 218 217
-             218:               Label
-             222:    7(fvec4)   Load 9(color)
-             223:    6(float)   CompositeExtract 222 2
-             224:    16(bool)   FOrdLessThan 223 186
-                                SelectionMerge 226 None
-                                BranchConditional 224 225 232
-             225:                 Label
-             227:    7(fvec4)     Load 9(color)
-             228:    6(float)     CompositeExtract 227 0
-             229:    6(float)     FAdd 228 84
-             230:    7(fvec4)     Load 9(color)
-             231:    7(fvec4)     CompositeInsert 229 230 0
-                                  Store 9(color) 231
-                                  Branch 226
-             232:                 Label
-             233:    7(fvec4)     Load 9(color)
-             234:    6(float)     CompositeExtract 233 1
-             235:    6(float)     FAdd 234 84
-             236:    7(fvec4)     Load 9(color)
-             237:    7(fvec4)     CompositeInsert 235 236 1
-                                  Store 9(color) 237
-                                  Branch 226
-             226:               Label
-             238:    127(int)   Load 215(i)
-             239:    127(int)   IAdd 238 144
-                                Store 215(i) 239
-                                Branch 216
-             217:             Label
-                              Store 240(i) 130
-                              Branch 241
-             241:             Label
-             244:    127(int) Load 240(i)
-             245:    16(bool) SLessThan 244 167
-                              LoopMerge 242 None
-                              BranchConditional 245 243 242
-             243:               Label
-             246:    6(float)   Load 97(d3)
-             247:    7(fvec4)   Load 9(color)
-             248:    6(float)   CompositeExtract 247 2
-             249:    6(float)   FAdd 248 246
-             250:    7(fvec4)   Load 9(color)
-             251:    7(fvec4)   CompositeInsert 249 250 2
-                                Store 9(color) 251
+             209:    6(float)     CompositeExtract 208 2
+             210:    7(fvec4)     Load 9(color)
+             211:    6(float)     CompositeExtract 210 1
+             212:    16(bool)     FOrdGreaterThan 209 211
+                                  SelectionMerge 214 None
+                                  BranchConditional 212 213 214
+             213:                   Label
+                                    Branch 214
+             214:                 Label
+                                  Branch 207
+             207:               Label
+             215:    129(int)   Load 179(i)
+             216:    129(int)   IAdd 215 146
+                                Store 179(i) 216
+                                Branch 180
+             181:             Label
+                              Store 217(i) 132
+                              Branch 218
+             218:             Label
+             221:    129(int) Load 217(i)
+             223:    16(bool) SLessThan 221 222
+                              LoopMerge 219 None
+                              BranchConditional 223 220 219
+             220:               Label
+             224:    7(fvec4)   Load 9(color)
+             225:    6(float)   CompositeExtract 224 2
+             226:    16(bool)   FOrdLessThan 225 188
+                                SelectionMerge 228 None
+                                BranchConditional 226 227 234
+             227:                 Label
+             229:    7(fvec4)     Load 9(color)
+             230:    6(float)     CompositeExtract 229 0
+             231:    6(float)     FAdd 230 84
+             232:    7(fvec4)     Load 9(color)
+             233:    7(fvec4)     CompositeInsert 231 232 0
+                                  Store 9(color) 233
+                                  Branch 228
+             234:                 Label
+             235:    7(fvec4)     Load 9(color)
+             236:    6(float)     CompositeExtract 235 1
+             237:    6(float)     FAdd 236 84
+             238:    7(fvec4)     Load 9(color)
+             239:    7(fvec4)     CompositeInsert 237 238 1
+                                  Store 9(color) 239
+                                  Branch 228
+             228:               Label
+             240:    129(int)   Load 217(i)
+             241:    129(int)   IAdd 240 146
+                                Store 217(i) 241
+                                Branch 218
+             219:             Label
+                              Store 242(i) 132
+                              Branch 243
+             243:             Label
+             246:    129(int) Load 242(i)
+             247:    16(bool) SLessThan 246 169
+                              LoopMerge 244 None
+                              BranchConditional 247 245 244
+             245:               Label
+             248:    6(float)   Load 99(d3)
+             249:    7(fvec4)   Load 9(color)
+             250:    6(float)   CompositeExtract 249 2
+             251:    6(float)   FAdd 250 248
              252:    7(fvec4)   Load 9(color)
-             253:    6(float)   CompositeExtract 252 0
-             254:    6(float)   Load 118(d4)
-             255:    16(bool)   FOrdLessThan 253 254
-                                SelectionMerge 257 None
-                                BranchConditional 255 256 257
-             256:                 Label
-             258:    127(int)     Load 240(i)
-             259:    127(int)     IAdd 258 144
-                                  Store 240(i) 259
-                                  Branch 241
-             257:               Label
-             261:    7(fvec4)   Load 9(color)
-             262:    6(float)   CompositeExtract 261 3
-             263:    6(float)   FAdd 262 84
-             264:    7(fvec4)   Load 9(color)
-             265:    7(fvec4)   CompositeInsert 263 264 3
-                                Store 9(color) 265
-             266:    127(int)   Load 240(i)
-             267:    127(int)   IAdd 266 144
-                                Store 240(i) 267
-                                Branch 241
-             242:             Label
-                              Store 268(i) 130
-                              Branch 269
-             269:             Label
-             272:    127(int) Load 268(i)
-             273:    16(bool) SLessThan 272 167
-                              LoopMerge 270 None
-                              BranchConditional 273 271 270
-             271:               Label
-             274:    6(float)   Load 97(d3)
-             275:    7(fvec4)   Load 9(color)
-             276:    6(float)   CompositeExtract 275 2
-             277:    6(float)   FAdd 276 274
-             278:    7(fvec4)   Load 9(color)
-             279:    7(fvec4)   CompositeInsert 277 278 2
-                                Store 9(color) 279
+             253:    7(fvec4)   CompositeInsert 251 252 2
+                                Store 9(color) 253
+             254:    7(fvec4)   Load 9(color)
+             255:    6(float)   CompositeExtract 254 0
+             256:    6(float)   Load 120(d4)
+             257:    16(bool)   FOrdLessThan 255 256
+                                SelectionMerge 259 None
+                                BranchConditional 257 258 259
+             258:                 Label
+             260:    129(int)     Load 242(i)
+             261:    129(int)     IAdd 260 146
+                                  Store 242(i) 261
+                                  Branch 243
+             259:               Label
+             263:    7(fvec4)   Load 9(color)
+             264:    6(float)   CompositeExtract 263 3
+             265:    6(float)   FAdd 264 84
+             266:    7(fvec4)   Load 9(color)
+             267:    7(fvec4)   CompositeInsert 265 266 3
+                                Store 9(color) 267
+             268:    129(int)   Load 242(i)
+             269:    129(int)   IAdd 268 146
+                                Store 242(i) 269
+                                Branch 243
+             244:             Label
+                              Store 270(i) 132
+                              Branch 271
+             271:             Label
+             274:    129(int) Load 270(i)
+             275:    16(bool) SLessThan 274 169
+                              LoopMerge 272 None
+                              BranchConditional 275 273 272
+             273:               Label
+             276:    6(float)   Load 99(d3)
+             277:    7(fvec4)   Load 9(color)
+             278:    6(float)   CompositeExtract 277 2
+             279:    6(float)   FAdd 278 276
              280:    7(fvec4)   Load 9(color)
-             281:    6(float)   CompositeExtract 280 0
-             282:    6(float)   Load 118(d4)
-             283:    16(bool)   FOrdLessThan 281 282
-                                SelectionMerge 285 None
-                                BranchConditional 283 284 285
-             284:                 Label
-                                  Branch 270
-             285:               Label
-             287:    7(fvec4)   Load 9(color)
-             288:    6(float)   CompositeExtract 287 3
-             289:    6(float)   FAdd 288 84
-             290:    7(fvec4)   Load 9(color)
-             291:    7(fvec4)   CompositeInsert 289 290 3
-                                Store 9(color) 291
-             292:    127(int)   Load 268(i)
-             293:    127(int)   IAdd 292 144
-                                Store 268(i) 293
-                                Branch 269
-             270:             Label
-                              Branch 294
-             294:             Label
-             297:    16(bool) Phi 17 270 161 313 161 321
-                              LoopMerge 295 None
-                              Branch 298
-             298:             Label
-                              SelectionMerge 296 None
-                              BranchConditional 297 296 299
-             299:               Label
-             300:    7(fvec4)   Load 9(color)
-             301:    6(float)   CompositeExtract 300 2
-             302:    6(float)   Load 118(d4)
-             303:    16(bool)   FOrdLessThan 301 302
-                                SelectionMerge 304 None
-                                BranchConditional 303 304 295
-             304:               Label
-                                Branch 296
+             281:    7(fvec4)   CompositeInsert 279 280 2
+                                Store 9(color) 281
+             282:    7(fvec4)   Load 9(color)
+             283:    6(float)   CompositeExtract 282 0
+             284:    6(float)   Load 120(d4)
+             285:    16(bool)   FOrdLessThan 283 284
+                                SelectionMerge 287 None
+                                BranchConditional 285 286 287
+             286:                 Label
+                                  Branch 272
+             287:               Label
+             289:    7(fvec4)   Load 9(color)
+             290:    6(float)   CompositeExtract 289 3
+             291:    6(float)   FAdd 290 84
+             292:    7(fvec4)   Load 9(color)
+             293:    7(fvec4)   CompositeInsert 291 292 3
+                                Store 9(color) 293
+             294:    129(int)   Load 270(i)
+             295:    129(int)   IAdd 294 146
+                                Store 270(i) 295
+                                Branch 271
+             272:             Label
+                              Branch 296
              296:             Label
-             306:    7(fvec4) Load 305(bigColor4)
-             307:    7(fvec4) Load 9(color)
-             308:    7(fvec4) FAdd 307 306
-                              Store 9(color) 308
+             299:    16(bool) Phi 17 272 163 315 163 323
+                              LoopMerge 297 None
+                              Branch 300
+             300:             Label
+                              SelectionMerge 298 None
+                              BranchConditional 299 298 301
+             301:               Label
+             302:    7(fvec4)   Load 9(color)
+             303:    6(float)   CompositeExtract 302 2
+             304:    6(float)   Load 120(d4)
+             305:    16(bool)   FOrdLessThan 303 304
+                                SelectionMerge 306 None
+                                BranchConditional 305 306 297
+             306:               Label
+                                Branch 298
+             298:             Label
+             308:    7(fvec4) Load 307(bigColor4)
              309:    7(fvec4) Load 9(color)
-             310:    6(float) CompositeExtract 309 0
-             311:    6(float) Load 118(d4)
-             312:    16(bool) FOrdLessThan 310 311
-                              SelectionMerge 314 None
-                              BranchConditional 312 313 314
-             313:               Label
-                                Branch 294
-             314:             Label
-             316:    7(fvec4) Load 9(color)
-             317:    6(float) CompositeExtract 316 1
-             318:    6(float) Load 118(d4)
-             319:    16(bool) FOrdLessThan 317 318
-                              SelectionMerge 321 None
-                              BranchConditional 319 320 328
-             320:               Label
-             322:    6(float)   Load 118(d4)
-             323:    7(fvec4)   Load 9(color)
-             324:    6(float)   CompositeExtract 323 1
-             325:    6(float)   FAdd 324 322
-             326:    7(fvec4)   Load 9(color)
-             327:    7(fvec4)   CompositeInsert 325 326 1
-                                Store 9(color) 327
-                                Branch 321
-             328:               Label
-             329:    6(float)   Load 118(d4)
-             330:    7(fvec4)   Load 9(color)
-             331:    6(float)   CompositeExtract 330 0
-             332:    6(float)   FAdd 331 329
-             333:    7(fvec4)   Load 9(color)
-             334:    7(fvec4)   CompositeInsert 332 333 0
-                                Store 9(color) 334
-                                Branch 321
-             321:             Label
-                              Branch 294
-             295:             Label
-                              Branch 335
-             335:             Label
-             338:    16(bool) Phi 17 295 161 356
-                              LoopMerge 336 None
-                              Branch 339
-             339:             Label
-                              SelectionMerge 337 None
-                              BranchConditional 338 337 340
-             340:               Label
-             341:    7(fvec4)   Load 9(color)
-             342:    6(float)   CompositeExtract 341 0
-             344:    6(float)   Load 343(d5)
-             345:    16(bool)   FOrdLessThan 342 344
-                                SelectionMerge 346 None
-                                BranchConditional 345 346 336
-             346:               Label
-                                Branch 337
+             310:    7(fvec4) FAdd 309 308
+                              Store 9(color) 310
+             311:    7(fvec4) Load 9(color)
+             312:    6(float) CompositeExtract 311 0
+             313:    6(float) Load 120(d4)
+             314:    16(bool) FOrdLessThan 312 313
+                              SelectionMerge 316 None
+                              BranchConditional 314 315 316
+             315:               Label
+                                Branch 296
+             316:             Label
+             318:    7(fvec4) Load 9(color)
+             319:    6(float) CompositeExtract 318 1
+             320:    6(float) Load 120(d4)
+             321:    16(bool) FOrdLessThan 319 320
+                              SelectionMerge 323 None
+                              BranchConditional 321 322 330
+             322:               Label
+             324:    6(float)   Load 120(d4)
+             325:    7(fvec4)   Load 9(color)
+             326:    6(float)   CompositeExtract 325 1
+             327:    6(float)   FAdd 326 324
+             328:    7(fvec4)   Load 9(color)
+             329:    7(fvec4)   CompositeInsert 327 328 1
+                                Store 9(color) 329
+                                Branch 323
+             330:               Label
+             331:    6(float)   Load 120(d4)
+             332:    7(fvec4)   Load 9(color)
+             333:    6(float)   CompositeExtract 332 0
+             334:    6(float)   FAdd 333 331
+             335:    7(fvec4)   Load 9(color)
+             336:    7(fvec4)   CompositeInsert 334 335 0
+                                Store 9(color) 336
+                                Branch 323
+             323:             Label
+                              Branch 296
+             297:             Label
+                              Branch 337
              337:             Label
-             348:    7(fvec4) Load 347(bigColor5)
-             349:    7(fvec4) Load 9(color)
-             350:    7(fvec4) FAdd 349 348
-                              Store 9(color) 350
+             340:    16(bool) Phi 17 297 163 358
+                              LoopMerge 338 None
+                              Branch 341
+             341:             Label
+                              SelectionMerge 339 None
+                              BranchConditional 340 339 342
+             342:               Label
+             343:    7(fvec4)   Load 9(color)
+             344:    6(float)   CompositeExtract 343 0
+             346:    6(float)   Load 345(d5)
+             347:    16(bool)   FOrdLessThan 344 346
+                                SelectionMerge 348 None
+                                BranchConditional 347 348 338
+             348:               Label
+                                Branch 339
+             339:             Label
+             350:    7(fvec4) Load 349(bigColor5)
              351:    7(fvec4) Load 9(color)
-             352:    6(float) CompositeExtract 351 1
-             353:    6(float) Load 343(d5)
-             354:    16(bool) FOrdLessThan 352 353
-                              SelectionMerge 356 None
-                              BranchConditional 354 355 356
-             355:               Label
-             357:    6(float)   Load 343(d5)
-             358:    7(fvec4)   Load 9(color)
-             359:    6(float)   CompositeExtract 358 1
-             360:    6(float)   FAdd 359 357
-             361:    7(fvec4)   Load 9(color)
-             362:    7(fvec4)   CompositeInsert 360 361 1
-                                Store 9(color) 362
-                                Branch 356
-             356:             Label
-                              Branch 335
-             336:             Label
-             363:    7(fvec4) Load 9(color)
-             364:    6(float) CompositeExtract 363 0
-             366:    6(float) Load 365(d6)
-             367:    16(bool) FOrdLessThan 364 366
-                              SelectionMerge 369 None
-                              BranchConditional 367 368 381
-             368:               Label
-                                Branch 370
+             352:    7(fvec4) FAdd 351 350
+                              Store 9(color) 352
+             353:    7(fvec4) Load 9(color)
+             354:    6(float) CompositeExtract 353 1
+             355:    6(float) Load 345(d5)
+             356:    16(bool) FOrdLessThan 354 355
+                              SelectionMerge 358 None
+                              BranchConditional 356 357 358
+             357:               Label
+             359:    6(float)   Load 345(d5)
+             360:    7(fvec4)   Load 9(color)
+             361:    6(float)   CompositeExtract 360 1
+             362:    6(float)   FAdd 361 359
+             363:    7(fvec4)   Load 9(color)
+             364:    7(fvec4)   CompositeInsert 362 363 1
+                                Store 9(color) 364
+                                Branch 358
+             358:             Label
+                              Branch 337
+             338:             Label
+             365:    7(fvec4) Load 9(color)
+             366:    6(float) CompositeExtract 365 0
+             368:    6(float) Load 367(d6)
+             369:    16(bool) FOrdLessThan 366 368
+                              SelectionMerge 371 None
+                              BranchConditional 369 370 383
              370:               Label
-             373:    7(fvec4)   Load 9(color)
-             374:    6(float)   CompositeExtract 373 1
-             375:    6(float)   Load 365(d6)
-             376:    16(bool)   FOrdLessThan 374 375
-                                LoopMerge 371 None
-                                BranchConditional 376 372 371
-             372:                 Label
-             378:    7(fvec4)     Load 377(bigColor6)
-             379:    7(fvec4)     Load 9(color)
-             380:    7(fvec4)     FAdd 379 378
-                                  Store 9(color) 380
-                                  Branch 370
-             371:               Label
-                                Branch 369
-             381:               Label
-                                Branch 382
-             382:               Label
-             385:    7(fvec4)   Load 9(color)
-             386:    6(float)   CompositeExtract 385 2
-             387:    6(float)   Load 365(d6)
-             388:    16(bool)   FOrdLessThan 386 387
-                                LoopMerge 383 None
-                                BranchConditional 388 384 383
-             384:                 Label
-             389:    7(fvec4)     Load 377(bigColor6)
-             390:    6(float)     CompositeExtract 389 2
-             391:    7(fvec4)     Load 9(color)
-             392:    6(float)     CompositeExtract 391 2
-             393:    6(float)     FAdd 392 390
-             394:    7(fvec4)     Load 9(color)
-             395:    7(fvec4)     CompositeInsert 393 394 2
-                                  Store 9(color) 395
-                                  Branch 382
+                                Branch 372
+             372:               Label
+             375:    7(fvec4)   Load 9(color)
+             376:    6(float)   CompositeExtract 375 1
+             377:    6(float)   Load 367(d6)
+             378:    16(bool)   FOrdLessThan 376 377
+                                LoopMerge 373 None
+                                BranchConditional 378 374 373
+             374:                 Label
+             380:    7(fvec4)     Load 379(bigColor6)
+             381:    7(fvec4)     Load 9(color)
+             382:    7(fvec4)     FAdd 381 380
+                                  Store 9(color) 382
+                                  Branch 372
+             373:               Label
+                                Branch 371
              383:               Label
-                                Branch 369
-             369:             Label
-             396:    7(fvec4) Load 9(color)
-             397:    6(float) CompositeExtract 396 0
-             398:    6(float) Load 365(d6)
-             399:    16(bool) FOrdLessThan 397 398
-                              SelectionMerge 401 None
-                              BranchConditional 399 400 418
-             400:               Label
-                                Branch 402
+                                Branch 384
+             384:               Label
+             387:    7(fvec4)   Load 9(color)
+             388:    6(float)   CompositeExtract 387 2
+             389:    6(float)   Load 367(d6)
+             390:    16(bool)   FOrdLessThan 388 389
+                                LoopMerge 385 None
+                                BranchConditional 390 386 385
+             386:                 Label
+             391:    7(fvec4)     Load 379(bigColor6)
+             392:    6(float)     CompositeExtract 391 2
+             393:    7(fvec4)     Load 9(color)
+             394:    6(float)     CompositeExtract 393 2
+             395:    6(float)     FAdd 394 392
+             396:    7(fvec4)     Load 9(color)
+             397:    7(fvec4)     CompositeInsert 395 396 2
+                                  Store 9(color) 397
+                                  Branch 384
+             385:               Label
+                                Branch 371
+             371:             Label
+             398:    7(fvec4) Load 9(color)
+             399:    6(float) CompositeExtract 398 0
+             400:    6(float) Load 367(d6)
+             401:    16(bool) FOrdLessThan 399 400
+                              SelectionMerge 403 None
+                              BranchConditional 401 402 420
              402:               Label
-             405:    7(fvec4)   Load 9(color)
-             406:    6(float)   CompositeExtract 405 1
-             407:    6(float)   Load 365(d6)
-             408:    16(bool)   FOrdLessThan 406 407
-                                LoopMerge 403 None
-                                BranchConditional 408 404 403
-             404:                 Label
-             409:    7(fvec4)     Load 377(bigColor6)
-             410:    7(fvec4)     Load 9(color)
-             411:    7(fvec4)     FAdd 410 409
-                                  Store 9(color) 411
-             413:    6(float)     Load 412(d7)
-             414:    16(bool)     FOrdLessThan 413 84
-                                  SelectionMerge 416 None
-                                  BranchConditional 414 415 416
-             415:                   Label
-                                    Branch 403
-             416:                 Label
-                                  Branch 402
-             403:               Label
-                                Branch 401
-             418:               Label
-                                Branch 419
-             419:               Label
-             422:    7(fvec4)   Load 9(color)
-             423:    6(float)   CompositeExtract 422 2
-             424:    6(float)   Load 365(d6)
-             425:    16(bool)   FOrdLessThan 423 424
-                                LoopMerge 420 None
-                                BranchConditional 425 421 420
-             421:                 Label
-             426:    7(fvec4)     Load 377(bigColor6)
-             427:    6(float)     CompositeExtract 426 2
-             428:    7(fvec4)     Load 9(color)
-             429:    6(float)     CompositeExtract 428 2
-             430:    6(float)     FAdd 429 427
-             431:    7(fvec4)     Load 9(color)
-             432:    7(fvec4)     CompositeInsert 430 431 2
-                                  Store 9(color) 432
-                                  Branch 419
+                                Branch 404
+             404:               Label
+             407:    7(fvec4)   Load 9(color)
+             408:    6(float)   CompositeExtract 407 1
+             409:    6(float)   Load 367(d6)
+             410:    16(bool)   FOrdLessThan 408 409
+                                LoopMerge 405 None
+                                BranchConditional 410 406 405
+             406:                 Label
+             411:    7(fvec4)     Load 379(bigColor6)
+             412:    7(fvec4)     Load 9(color)
+             413:    7(fvec4)     FAdd 412 411
+                                  Store 9(color) 413
+             415:    6(float)     Load 414(d7)
+             416:    16(bool)     FOrdLessThan 415 84
+                                  SelectionMerge 418 None
+                                  BranchConditional 416 417 418
+             417:                   Label
+                                    Branch 405
+             418:                 Label
+                                  Branch 404
+             405:               Label
+                                Branch 403
              420:               Label
-                                Branch 401
-             401:             Label
-                              Branch 433
-             433:             Label
-             436:    16(bool) Phi 17 401 161 453
-                              LoopMerge 434 None
-                              Branch 437
-             437:             Label
-                              SelectionMerge 435 None
-                              BranchConditional 436 435 438
-             438:               Label
-                                SelectionMerge 439 None
-                                BranchConditional 17 439 434
-             439:               Label
-                                Branch 435
+                                Branch 421
+             421:               Label
+             424:    7(fvec4)   Load 9(color)
+             425:    6(float)   CompositeExtract 424 2
+             426:    6(float)   Load 367(d6)
+             427:    16(bool)   FOrdLessThan 425 426
+                                LoopMerge 422 None
+                                BranchConditional 427 423 422
+             423:                 Label
+             428:    7(fvec4)     Load 379(bigColor6)
+             429:    6(float)     CompositeExtract 428 2
+             430:    7(fvec4)     Load 9(color)
+             431:    6(float)     CompositeExtract 430 2
+             432:    6(float)     FAdd 431 429
+             433:    7(fvec4)     Load 9(color)
+             434:    7(fvec4)     CompositeInsert 432 433 2
+                                  Store 9(color) 434
+                                  Branch 421
+             422:               Label
+                                Branch 403
+             403:             Label
+                              Branch 435
              435:             Label
-             440:    6(float) Load 412(d7)
-             442:    16(bool) FOrdLessThan 440 441
-                              SelectionMerge 444 None
-                              BranchConditional 442 443 444
-             443:               Label
-                                Branch 434
-             444:             Label
-             447:    7(fvec4) Load 446(bigColor7)
-             448:    7(fvec4) Load 9(color)
-             449:    7(fvec4) FAdd 448 447
-                              Store 9(color) 449
-             450:    6(float) Load 412(d7)
-             451:    16(bool) FOrdLessThan 450 84
-                              SelectionMerge 453 None
-                              BranchConditional 451 452 453
-             452:               Label
-             454:    7(fvec4)   Load 9(color)
-             455:    6(float)   CompositeExtract 454 2
-             456:    6(float)   FAdd 455 84
-             457:    7(fvec4)   Load 9(color)
-             458:    7(fvec4)   CompositeInsert 456 457 2
-                                Store 9(color) 458
-                                Branch 434
-             453:             Label
-             460:    7(fvec4) Load 11(BaseColor)
-             461:    7(fvec4) Load 9(color)
-             462:    7(fvec4) FAdd 461 460
-                              Store 9(color) 462
-                              Branch 433
-             434:             Label
-                              Branch 463
-             463:             Label
-             466:    16(bool) Phi 17 434 161 486
-                              LoopMerge 464 None
-                              Branch 467
-             467:             Label
-                              SelectionMerge 465 None
-                              BranchConditional 466 465 468
-             468:               Label
-             469:    7(fvec4)   Load 9(color)
-             470:    6(float)   CompositeExtract 469 2
-             472:    6(float)   Load 471(d8)
-             473:    16(bool)   FOrdLessThan 470 472
-                                SelectionMerge 474 None
-                                BranchConditional 473 474 464
-             474:               Label
-                                Branch 465
+             438:    16(bool) Phi 17 403 163 455
+                              LoopMerge 436 None
+                              Branch 439
+             439:             Label
+                              SelectionMerge 437 None
+                              BranchConditional 438 437 440
+             440:               Label
+                                SelectionMerge 441 None
+                                BranchConditional 17 441 436
+             441:               Label
+                                Branch 437
+             437:             Label
+             442:    6(float) Load 414(d7)
+             444:    16(bool) FOrdLessThan 442 443
+                              SelectionMerge 446 None
+                              BranchConditional 444 445 446
+             445:               Label
+                                Branch 436
+             446:             Label
+             449:    7(fvec4) Load 448(bigColor7)
+             450:    7(fvec4) Load 9(color)
+             451:    7(fvec4) FAdd 450 449
+                              Store 9(color) 451
+             452:    6(float) Load 414(d7)
+             453:    16(bool) FOrdLessThan 452 84
+                              SelectionMerge 455 None
+                              BranchConditional 453 454 455
+             454:               Label
+             456:    7(fvec4)   Load 9(color)
+             457:    6(float)   CompositeExtract 456 2
+             458:    6(float)   FAdd 457 84
+             459:    7(fvec4)   Load 9(color)
+             460:    7(fvec4)   CompositeInsert 458 459 2
+                                Store 9(color) 460
+                                Branch 436
+             455:             Label
+             462:    7(fvec4) Load 11(BaseColor)
+             463:    7(fvec4) Load 9(color)
+             464:    7(fvec4) FAdd 463 462
+                              Store 9(color) 464
+                              Branch 435
+             436:             Label
+                              Branch 465
              465:             Label
-             475:    6(float) Load 471(d8)
-             476:    16(bool) FOrdLessThan 475 441
-                              SelectionMerge 478 None
-                              BranchConditional 476 477 478
-             477:               Label
-                                Branch 464
-             478:             Label
-             480:    7(fvec4) Load 446(bigColor7)
-             481:    7(fvec4) Load 9(color)
-             482:    7(fvec4) FAdd 481 480
-                              Store 9(color) 482
-             483:    6(float) Load 471(d8)
-             484:    16(bool) FOrdLessThan 483 84
-                              SelectionMerge 486 None
-                              BranchConditional 484 485 486
-             485:               Label
-             487:    7(fvec4)   Load 9(color)
-             488:    6(float)   CompositeExtract 487 2
-             489:    6(float)   FAdd 488 84
-             490:    7(fvec4)   Load 9(color)
-             491:    7(fvec4)   CompositeInsert 489 490 2
-                                Store 9(color) 491
-             492:    6(float)   Load 471(d8)
-             494:    16(bool)   FOrdLessThan 492 493
-                                SelectionMerge 496 None
-                                BranchConditional 494 495 502
-             495:                 Label
-             497:    7(fvec4)     Load 9(color)
-             498:    6(float)     CompositeExtract 497 1
-             499:    6(float)     FAdd 498 84
-             500:    7(fvec4)     Load 9(color)
-             501:    7(fvec4)     CompositeInsert 499 500 1
-                                  Store 9(color) 501
-                                  Branch 496
-             502:                 Label
-             503:    7(fvec4)     Load 9(color)
-             504:    6(float)     CompositeExtract 503 0
-             505:    6(float)     FAdd 504 84
-             506:    7(fvec4)     Load 9(color)
-             507:    7(fvec4)     CompositeInsert 505 506 0
-                                  Store 9(color) 507
-                                  Branch 496
-             496:               Label
-                                Branch 464
-             486:             Label
-             509:    7(fvec4) Load 11(BaseColor)
-             510:    7(fvec4) Load 9(color)
-             511:    7(fvec4) FAdd 510 509
-                              Store 9(color) 511
-                              Branch 463
-             464:             Label
-                              Branch 512
-             512:             Label
-             515:    7(fvec4) Load 9(color)
-             516:    6(float) CompositeExtract 515 3
-             518:    6(float) Load 517(d9)
-             519:    16(bool) FOrdLessThan 516 518
-                              LoopMerge 513 None
-                              BranchConditional 519 514 513
-             514:               Label
-             520:    6(float)   Load 517(d9)
-             521:    6(float)   Load 471(d8)
-             522:    16(bool)   FOrdGreaterThan 520 521
-                                SelectionMerge 524 None
-                                BranchConditional 522 523 524
-             523:                 Label
-             525:    7(fvec4)     Load 9(color)
-             526:    6(float)     CompositeExtract 525 0
-             527:    6(float)     Load 412(d7)
-             528:    16(bool)     FOrdLessThanEqual 526 527
-                                  SelectionMerge 530 None
-                                  BranchConditional 528 529 530
-             529:                   Label
-             531:    7(fvec4)       Load 9(color)
-             532:    6(float)       CompositeExtract 531 2
-             534:    16(bool)       FOrdEqual 532 533
-                                    SelectionMerge 536 None
-                                    BranchConditional 534 535 542
-             535:                     Label
-             537:    7(fvec4)         Load 9(color)
-             538:    6(float)         CompositeExtract 537 3
-             539:    6(float)         FAdd 538 84
-             540:    7(fvec4)         Load 9(color)
-             541:    7(fvec4)         CompositeInsert 539 540 3
-                                      Store 9(color) 541
-                                      Branch 536
-             542:                     Label
-                                      Branch 513
-             536:                   Label
-                                    Branch 530
-             530:                 Label
-                                  Branch 524
-             524:               Label
-                                Branch 512
-             513:             Label
-                              Branch 544
-             544:             Label
-             547:    7(fvec4) Load 9(color)
-             548:    6(float) CompositeExtract 547 2
-             550:    6(float) Load 549(d10)
-             551:    16(bool) FOrdLessThan 548 550
-                              LoopMerge 545 None
-                              BranchConditional 551 546 545
-             546:               Label
-             552:    7(fvec4)   Load 9(color)
-             553:    6(float)   CompositeExtract 552 1
-             554:    6(float)   FAdd 553 84
-             555:    7(fvec4)   Load 9(color)
-             556:    7(fvec4)   CompositeInsert 554 555 1
-                                Store 9(color) 556
+             468:    16(bool) Phi 17 436 163 488
+                              LoopMerge 466 None
+                              Branch 469
+             469:             Label
+                              SelectionMerge 467 None
+                              BranchConditional 468 467 470
+             470:               Label
+             471:    7(fvec4)   Load 9(color)
+             472:    6(float)   CompositeExtract 471 2
+             474:    6(float)   Load 473(d8)
+             475:    16(bool)   FOrdLessThan 472 474
+                                SelectionMerge 476 None
+                                BranchConditional 475 476 466
+             476:               Label
+                                Branch 467
+             467:             Label
+             477:    6(float) Load 473(d8)
+             478:    16(bool) FOrdLessThan 477 443
+                              SelectionMerge 480 None
+                              BranchConditional 478 479 480
+             479:               Label
+                                Branch 466
+             480:             Label
+             482:    7(fvec4) Load 448(bigColor7)
+             483:    7(fvec4) Load 9(color)
+             484:    7(fvec4) FAdd 483 482
+                              Store 9(color) 484
+             485:    6(float) Load 473(d8)
+             486:    16(bool) FOrdLessThan 485 84
+                              SelectionMerge 488 None
+                              BranchConditional 486 487 488
+             487:               Label
+             489:    7(fvec4)   Load 9(color)
+             490:    6(float)   CompositeExtract 489 2
+             491:    6(float)   FAdd 490 84
+             492:    7(fvec4)   Load 9(color)
+             493:    7(fvec4)   CompositeInsert 491 492 2
+                                Store 9(color) 493
+             494:    6(float)   Load 473(d8)
+             496:    16(bool)   FOrdLessThan 494 495
+                                SelectionMerge 498 None
+                                BranchConditional 496 497 504
+             497:                 Label
+             499:    7(fvec4)     Load 9(color)
+             500:    6(float)     CompositeExtract 499 1
+             501:    6(float)     FAdd 500 84
+             502:    7(fvec4)     Load 9(color)
+             503:    7(fvec4)     CompositeInsert 501 502 1
+                                  Store 9(color) 503
+                                  Branch 498
+             504:                 Label
+             505:    7(fvec4)     Load 9(color)
+             506:    6(float)     CompositeExtract 505 0
+             507:    6(float)     FAdd 506 84
+             508:    7(fvec4)     Load 9(color)
+             509:    7(fvec4)     CompositeInsert 507 508 0
+                                  Store 9(color) 509
+                                  Branch 498
+             498:               Label
+                                Branch 466
+             488:             Label
+             511:    7(fvec4) Load 11(BaseColor)
+             512:    7(fvec4) Load 9(color)
+             513:    7(fvec4) FAdd 512 511
+                              Store 9(color) 513
+                              Branch 465
+             466:             Label
+                              Branch 514
+             514:             Label
+             517:    7(fvec4) Load 9(color)
+             518:    6(float) CompositeExtract 517 3
+             520:    6(float) Load 519(d9)
+             521:    16(bool) FOrdLessThan 518 520
+                              LoopMerge 515 None
+                              BranchConditional 521 516 515
+             516:               Label
+             522:    6(float)   Load 519(d9)
+             523:    6(float)   Load 473(d8)
+             524:    16(bool)   FOrdGreaterThan 522 523
+                                SelectionMerge 526 None
+                                BranchConditional 524 525 526
+             525:                 Label
+             527:    7(fvec4)     Load 9(color)
+             528:    6(float)     CompositeExtract 527 0
+             529:    6(float)     Load 414(d7)
+             530:    16(bool)     FOrdLessThanEqual 528 529
+                                  SelectionMerge 532 None
+                                  BranchConditional 530 531 532
+             531:                   Label
+             533:    7(fvec4)       Load 9(color)
+             534:    6(float)       CompositeExtract 533 2
+             536:    16(bool)       FOrdEqual 534 535
+                                    SelectionMerge 538 None
+                                    BranchConditional 536 537 544
+             537:                     Label
+             539:    7(fvec4)         Load 9(color)
+             540:    6(float)         CompositeExtract 539 3
+             541:    6(float)         FAdd 540 84
+             542:    7(fvec4)         Load 9(color)
+             543:    7(fvec4)         CompositeInsert 541 542 3
+                                      Store 9(color) 543
+                                      Branch 538
+             544:                     Label
+                                      Branch 515
+             538:                   Label
+                                    Branch 532
+             532:                 Label
+                                  Branch 526
+             526:               Label
+                                Branch 514
+             515:             Label
+                              Branch 546
+             546:             Label
+             549:    7(fvec4) Load 9(color)
+             550:    6(float) CompositeExtract 549 2
+             552:    6(float) Load 551(d10)
+             553:    16(bool) FOrdLessThan 550 552
+                              LoopMerge 547 None
+                              BranchConditional 553 548 547
+             548:               Label
+             554:    7(fvec4)   Load 9(color)
+             555:    6(float)   CompositeExtract 554 1
+             556:    6(float)   FAdd 555 84
              557:    7(fvec4)   Load 9(color)
-             558:    6(float)   CompositeExtract 557 1
-             560:    6(float)   Load 559(d11)
-             561:    16(bool)   FOrdLessThan 558 560
-                                SelectionMerge 563 None
-                                BranchConditional 561 562 563
-             562:                 Label
-             564:    7(fvec4)     Load 9(color)
-             565:    6(float)     CompositeExtract 564 2
-             566:    6(float)     FAdd 565 84
-             567:    7(fvec4)     Load 9(color)
-             568:    7(fvec4)     CompositeInsert 566 567 2
-                                  Store 9(color) 568
+             558:    7(fvec4)   CompositeInsert 556 557 1
+                                Store 9(color) 558
+             559:    7(fvec4)   Load 9(color)
+             560:    6(float)   CompositeExtract 559 1
+             562:    6(float)   Load 561(d11)
+             563:    16(bool)   FOrdLessThan 560 562
+                                SelectionMerge 565 None
+                                BranchConditional 563 564 565
+             564:                 Label
+             566:    7(fvec4)     Load 9(color)
+             567:    6(float)     CompositeExtract 566 2
+             568:    6(float)     FAdd 567 84
              569:    7(fvec4)     Load 9(color)
-             570:    6(float)     CompositeExtract 569 3
-             572:    6(float)     Load 571(d12)
-             573:    16(bool)     FOrdLessThan 570 572
-                                  SelectionMerge 575 None
-                                  BranchConditional 573 574 581
-             574:                   Label
-             576:    7(fvec4)       Load 9(color)
-             577:    6(float)       CompositeExtract 576 3
-             578:    6(float)       FAdd 577 84
-             579:    7(fvec4)       Load 9(color)
-             580:    7(fvec4)       CompositeInsert 578 579 3
-                                    Store 9(color) 580
-                                    Branch 575
-             581:                   Label
-             582:    7(fvec4)       Load 9(color)
-             583:    6(float)       CompositeExtract 582 0
-             584:    6(float)       FAdd 583 84
-             585:    7(fvec4)       Load 9(color)
-             586:    7(fvec4)       CompositeInsert 584 585 0
-                                    Store 9(color) 586
-                                    Branch 575
-             575:                 Label
-                                  Branch 544
-             563:               Label
-             588:    7(fvec4)   Load 9(color)
-             589:    7(fvec4)   CompositeConstruct 84 84 84 84
-             590:    7(fvec4)   FAdd 588 589
-                                Store 9(color) 590
-                                Branch 545
-             545:             Label
-                              Branch 592
-             592:             Label
-             595:    7(fvec4) Load 9(color)
-             596:    6(float) CompositeExtract 595 0
-             598:    16(bool) FOrdLessThan 596 597
-                              LoopMerge 593 None
-                              BranchConditional 598 594 593
-             594:               Label
-             600:    7(fvec4)   Load 599(bigColor8)
-             601:    7(fvec4)   Load 9(color)
-             602:    7(fvec4)   FAdd 601 600
-                                Store 9(color) 602
+             570:    7(fvec4)     CompositeInsert 568 569 2
+                                  Store 9(color) 570
+             571:    7(fvec4)     Load 9(color)
+             572:    6(float)     CompositeExtract 571 3
+             574:    6(float)     Load 573(d12)
+             575:    16(bool)     FOrdLessThan 572 574
+                                  SelectionMerge 577 None
+                                  BranchConditional 575 576 583
+             576:                   Label
+             578:    7(fvec4)       Load 9(color)
+             579:    6(float)       CompositeExtract 578 3
+             580:    6(float)       FAdd 579 84
+             581:    7(fvec4)       Load 9(color)
+             582:    7(fvec4)       CompositeInsert 580 581 3
+                                    Store 9(color) 582
+                                    Branch 577
+             583:                   Label
+             584:    7(fvec4)       Load 9(color)
+             585:    6(float)       CompositeExtract 584 0
+             586:    6(float)       FAdd 585 84
+             587:    7(fvec4)       Load 9(color)
+             588:    7(fvec4)       CompositeInsert 586 587 0
+                                    Store 9(color) 588
+                                    Branch 577
+             577:                 Label
+                                  Branch 546
+             565:               Label
+             590:    7(fvec4)   Load 9(color)
+             591:    7(fvec4)   CompositeConstruct 84 84 84 84
+             592:    7(fvec4)   FAdd 590 591
+                                Store 9(color) 592
+                                Branch 547
+             547:             Label
+                              Branch 594
+             594:             Label
+             597:    7(fvec4) Load 9(color)
+             598:    6(float) CompositeExtract 597 0
+             600:    16(bool) FOrdLessThan 598 599
+                              LoopMerge 595 None
+                              BranchConditional 600 596 595
+             596:               Label
+             602:    7(fvec4)   Load 601(bigColor8)
              603:    7(fvec4)   Load 9(color)
-             604:    6(float)   CompositeExtract 603 2
-             605:    6(float)   Load 471(d8)
-             606:    16(bool)   FOrdLessThan 604 605
-                                SelectionMerge 608 None
-                                BranchConditional 606 607 608
-             607:                 Label
-             609:    7(fvec4)     Load 9(color)
-             610:    6(float)     CompositeExtract 609 3
-             611:    6(float)     Load 365(d6)
-             612:    16(bool)     FOrdLessThan 610 611
-                                  SelectionMerge 614 None
-                                  BranchConditional 612 613 614
-             613:                   Label
-                                    Branch 592
-             614:                 Label
-                                  Branch 608
-             608:               Label
-             616:    7(fvec4)   Load 599(bigColor8)
-             617:    6(float)   CompositeExtract 616 0
-             618:    7(fvec4)   Load 9(color)
-             619:    6(float)   CompositeExtract 618 1
-             620:    6(float)   FAdd 619 617
-             621:    7(fvec4)   Load 9(color)
-             622:    7(fvec4)   CompositeInsert 620 621 1
-                                Store 9(color) 622
-                                Branch 592
-             593:             Label
-             623:    7(fvec4) Load 9(color)
-             624:    7(fvec4) CompositeConstruct 84 84 84 84
-             625:    7(fvec4) FAdd 623 624
-                              Store 9(color) 625
-             628:    7(fvec4) Load 9(color)
-                              Store 627(gl_FragColor) 628
-                              Branch 629
-             629:             Label
-             632:    7(fvec4) Load 9(color)
-             633:    6(float) CompositeExtract 632 0
-             635:    6(float) Load 634(d14)
-             636:    16(bool) FOrdLessThan 633 635
-                              LoopMerge 630 None
-                              BranchConditional 636 631 630
-             631:               Label
-             637:    7(fvec4)   Load 9(color)
-             638:    6(float)   CompositeExtract 637 1
-             640:    6(float)   Load 639(d15)
-             641:    16(bool)   FOrdLessThan 638 640
-                                SelectionMerge 643 None
-                                BranchConditional 641 642 645
-             642:                 Label
+             604:    7(fvec4)   FAdd 603 602
+                                Store 9(color) 604
+             605:    7(fvec4)   Load 9(color)
+             606:    6(float)   CompositeExtract 605 2
+             607:    6(float)   Load 473(d8)
+             608:    16(bool)   FOrdLessThan 606 607
+                                SelectionMerge 610 None
+                                BranchConditional 608 609 610
+             609:                 Label
+             611:    7(fvec4)     Load 9(color)
+             612:    6(float)     CompositeExtract 611 3
+             613:    6(float)     Load 367(d6)
+             614:    16(bool)     FOrdLessThan 612 613
+                                  SelectionMerge 616 None
+                                  BranchConditional 614 615 616
+             615:                   Label
+                                    Branch 594
+             616:                 Label
+                                  Branch 610
+             610:               Label
+             618:    7(fvec4)   Load 601(bigColor8)
+             619:    6(float)   CompositeExtract 618 0
+             620:    7(fvec4)   Load 9(color)
+             621:    6(float)   CompositeExtract 620 1
+             622:    6(float)   FAdd 621 619
+             623:    7(fvec4)   Load 9(color)
+             624:    7(fvec4)   CompositeInsert 622 623 1
+                                Store 9(color) 624
+                                Branch 594
+             595:             Label
+             625:    7(fvec4) Load 9(color)
+             626:    7(fvec4) CompositeConstruct 84 84 84 84
+             627:    7(fvec4) FAdd 625 626
+                              Store 9(color) 627
+             630:    7(fvec4) Load 9(color)
+                              Store 629(gl_FragColor) 630
+                              Branch 631
+             631:             Label
+             634:    7(fvec4) Load 9(color)
+             635:    6(float) CompositeExtract 634 0
+             637:    6(float) Load 636(d14)
+             638:    16(bool) FOrdLessThan 635 637
+                              LoopMerge 632 None
+                              BranchConditional 638 633 632
+             633:               Label
+             639:    7(fvec4)   Load 9(color)
+             640:    6(float)   CompositeExtract 639 1
+             642:    6(float)   Load 641(d15)
+             643:    16(bool)   FOrdLessThan 640 642
+                                SelectionMerge 645 None
+                                BranchConditional 643 644 647
+             644:                 Label
                                   Return
-             645:                 Label
-             646:    7(fvec4)     Load 9(color)
-             647:    7(fvec4)     CompositeConstruct 84 84 84 84
-             648:    7(fvec4)     FAdd 646 647
-                                  Store 9(color) 648
-                                  Branch 643
-             643:               Label
-                                Branch 629
-             630:             Label
-             649:    7(fvec4) Load 9(color)
-             650:    7(fvec4) CompositeConstruct 84 84 84 84
-             651:    7(fvec4) FAdd 649 650
-                              Store 9(color) 651
-                              Branch 652
-             652:             Label
-             655:    7(fvec4) Load 9(color)
-             656:    6(float) CompositeExtract 655 3
-             658:    6(float) Load 657(d16)
-             659:    16(bool) FOrdLessThan 656 658
-                              LoopMerge 653 None
-                              BranchConditional 659 654 653
-             654:               Label
-             660:    7(fvec4)   Load 9(color)
-             661:    6(float)   CompositeExtract 660 3
-             662:    6(float)   FAdd 661 84
-             663:    7(fvec4)   Load 9(color)
-             664:    7(fvec4)   CompositeInsert 662 663 3
-                                Store 9(color) 664
-                                Branch 652
-             653:             Label
-                              Branch 665
-             665:             Label
-             668:    7(fvec4) Load 9(color)
-             669:    6(float) CompositeExtract 668 3
-             670:    6(float) Load 92(d2)
-             671:    16(bool) FOrdLessThan 669 670
-             672:    7(fvec4) Load 9(color)
-             673:    6(float) CompositeExtract 672 1
-             674:    6(float) Load 97(d3)
-             675:    16(bool) FOrdLessThan 673 674
-             676:    16(bool) LogicalAnd 671 675
-                              LoopMerge 666 None
-                              BranchConditional 676 667 666
-             667:               Label
-             677:    7(fvec4)   Load 101(bigColor1_2)
-             678:    7(fvec4)   Load 9(color)
-             679:    7(fvec4)   FAdd 678 677
-                                Store 9(color) 679
-             680:    7(fvec4)   Load 9(color)
-             681:    6(float)   CompositeExtract 680 2
-             682:    6(float)   Load 97(d3)
-             683:    16(bool)   FOrdLessThan 681 682
-                                SelectionMerge 685 None
-                                BranchConditional 683 684 685
-             684:                 Label
+             647:                 Label
+             648:    7(fvec4)     Load 9(color)
+             649:    7(fvec4)     CompositeConstruct 84 84 84 84
+             650:    7(fvec4)     FAdd 648 649
+                                  Store 9(color) 650
+                                  Branch 645
+             645:               Label
+                                Branch 631
+             632:             Label
+             651:    7(fvec4) Load 9(color)
+             652:    7(fvec4) CompositeConstruct 84 84 84 84
+             653:    7(fvec4) FAdd 651 652
+                              Store 9(color) 653
+                              Branch 654
+             654:             Label
+             657:    7(fvec4) Load 9(color)
+             658:    6(float) CompositeExtract 657 3
+             660:    6(float) Load 659(d16)
+             661:    16(bool) FOrdLessThan 658 660
+                              LoopMerge 655 None
+                              BranchConditional 661 656 655
+             656:               Label
+             662:    7(fvec4)   Load 9(color)
+             663:    6(float)   CompositeExtract 662 3
+             664:    6(float)   FAdd 663 84
+             665:    7(fvec4)   Load 9(color)
+             666:    7(fvec4)   CompositeInsert 664 665 3
+                                Store 9(color) 666
+                                Branch 654
+             655:             Label
+                              Branch 667
+             667:             Label
+             670:    7(fvec4) Load 9(color)
+             671:    6(float) CompositeExtract 670 3
+             672:    6(float) Load 92(d2)
+             673:    16(bool) FOrdLessThan 671 672
+                              SelectionMerge 675 None
+                              BranchConditional 673 674 675
+             674:               Label
+             676:    7(fvec4)   Load 9(color)
+             677:    6(float)   CompositeExtract 676 1
+             678:    6(float)   Load 99(d3)
+             679:    16(bool)   FOrdLessThan 677 678
+                                Branch 675
+             675:             Label
+             680:    16(bool) Phi 673 667 679 674
+                              LoopMerge 668 None
+                              BranchConditional 680 669 668
+             669:               Label
+             681:    7(fvec4)   Load 103(bigColor1_2)
+             682:    7(fvec4)   Load 9(color)
+             683:    7(fvec4)   FAdd 682 681
+                                Store 9(color) 683
+             684:    7(fvec4)   Load 9(color)
+             685:    6(float)   CompositeExtract 684 2
+             686:    6(float)   Load 99(d3)
+             687:    16(bool)   FOrdLessThan 685 686
+                                SelectionMerge 689 None
+                                BranchConditional 687 688 689
+             688:                 Label
                                   Return
-             685:               Label
-                                Branch 665
-             666:             Label
-                              Branch 687
-             687:             Label
-             690:    16(bool) Phi 17 666 161 705
-                              LoopMerge 688 None
+             689:               Label
+                                Branch 667
+             668:             Label
                               Branch 691
              691:             Label
-                              SelectionMerge 689 None
-                              BranchConditional 690 689 692
-             692:               Label
-             693:    7(fvec4)   Load 9(color)
-             694:    6(float)   CompositeExtract 693 0
-             696:    6(float)   Load 695(d17)
-             697:    16(bool)   FOrdLessThan 694 696
-                                SelectionMerge 698 None
-                                BranchConditional 697 698 688
-             698:               Label
-                                Branch 689
-             689:             Label
-             699:    7(fvec4) Load 9(color)
-             700:    6(float) CompositeExtract 699 1
-             702:    6(float) Load 701(d18)
-             703:    16(bool) FOrdLessThan 700 702
-                              SelectionMerge 705 None
-                              BranchConditional 703 704 705
-             704:               Label
+             694:    16(bool) Phi 17 668 163 709
+                              LoopMerge 692 None
+                              Branch 695
+             695:             Label
+                              SelectionMerge 693 None
+                              BranchConditional 694 693 696
+             696:               Label
+             697:    7(fvec4)   Load 9(color)
+             698:    6(float)   CompositeExtract 697 0
+             700:    6(float)   Load 699(d17)
+             701:    16(bool)   FOrdLessThan 698 700
+                                SelectionMerge 702 None
+                                BranchConditional 701 702 692
+             702:               Label
+                                Branch 693
+             693:             Label
+             703:    7(fvec4) Load 9(color)
+             704:    6(float) CompositeExtract 703 1
+             706:    6(float) Load 705(d18)
+             707:    16(bool) FOrdLessThan 704 706
+                              SelectionMerge 709 None
+                              BranchConditional 707 708 709
+             708:               Label
                                 Return
-             705:             Label
-             707:    7(fvec4) Load 9(color)
-             708:    7(fvec4) CompositeConstruct 84 84 84 84
-             709:    7(fvec4) FAdd 707 708
-                              Store 9(color) 709
-                              Branch 687
-             688:             Label
-                              Branch 710
-             710:             Label
-             713:    7(fvec4) Load 9(color)
-             714:    6(float) CompositeExtract 713 1
-             715:    6(float) Load 657(d16)
-             716:    16(bool) FOrdLessThan 714 715
-                              LoopMerge 711 None
-                              BranchConditional 716 712 711
-             712:               Label
-             717:    7(fvec4)   Load 9(color)
-             718:    6(float)   CompositeExtract 717 3
-             719:    6(float)   Load 657(d16)
-             720:    16(bool)   FOrdLessThan 718 719
-                                SelectionMerge 722 None
-                                BranchConditional 720 721 724
-             721:                 Label
+             709:             Label
+             711:    7(fvec4) Load 9(color)
+             712:    7(fvec4) CompositeConstruct 84 84 84 84
+             713:    7(fvec4) FAdd 711 712
+                              Store 9(color) 713
+                              Branch 691
+             692:             Label
+                              Branch 714
+             714:             Label
+             717:    7(fvec4) Load 9(color)
+             718:    6(float) CompositeExtract 717 1
+             719:    6(float) Load 659(d16)
+             720:    16(bool) FOrdLessThan 718 719
+                              LoopMerge 715 None
+                              BranchConditional 720 716 715
+             716:               Label
+             721:    7(fvec4)   Load 9(color)
+             722:    6(float)   CompositeExtract 721 3
+             723:    6(float)   Load 659(d16)
+             724:    16(bool)   FOrdLessThan 722 723
+                                SelectionMerge 726 None
+                                BranchConditional 724 725 728
+             725:                 Label
                                   Kill
-             724:                 Label
-             725:    7(fvec4)     Load 9(color)
-             726:    7(fvec4)     CompositeConstruct 84 84 84 84
-             727:    7(fvec4)     FAdd 725 726
-                                  Store 9(color) 727
-                                  Branch 722
-             722:               Label
-                                Branch 710
-             711:             Label
-             728:    7(fvec4) Load 9(color)
-             729:    7(fvec4) CompositeConstruct 84 84 84 84
-             730:    7(fvec4) FAdd 728 729
-                              Store 9(color) 730
-             731:    7(fvec4) Load 9(color)
-                              Store 627(gl_FragColor) 731
+             728:                 Label
+             729:    7(fvec4)     Load 9(color)
+             730:    7(fvec4)     CompositeConstruct 84 84 84 84
+             731:    7(fvec4)     FAdd 729 730
+                                  Store 9(color) 731
+                                  Branch 726
+             726:               Label
+                                Branch 714
+             715:             Label
+             732:    7(fvec4) Load 9(color)
+             733:    7(fvec4) CompositeConstruct 84 84 84 84
+             734:    7(fvec4) FAdd 732 733
+                              Store 9(color) 734
+             735:    7(fvec4) Load 9(color)
+                              Store 629(gl_FragColor) 735
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/spv.shortCircuit.frag.out b/Test/baseResults/spv.shortCircuit.frag.out
new file mode 100644
index 0000000000000000000000000000000000000000..7f152f77f3b56d74eec258a640d268c96ea3e229
--- /dev/null
+++ b/Test/baseResults/spv.shortCircuit.frag.out
@@ -0,0 +1,237 @@
+spv.shortCircuit.frag
+Warning, version 400 is not yet complete; most version-specific features are present, but some are missing.
+
+
+Linked fragment stage:
+
+
+// Module Version 99
+// Generated by (magic number): 51a00bb
+// Id's are bound by 143
+
+                              Source GLSL 400
+                              Capability Shader
+               1:             ExtInstImport  "GLSL.std.450"
+                              MemoryModel Logical GLSL450
+                              EntryPoint Fragment 4  "main"
+                              ExecutionMode 4 OriginLowerLeft
+                              Name 4  "main"
+                              Name 8  "foo("
+                              Name 12  "of1"
+                              Name 23  "of4"
+                              Name 26  "ub"
+                              Name 30  "ui"
+                              Name 40  "uba"
+                              Name 109  "uf"
+                              Name 136  "uiv4"
+                              Name 138  "uv4"
+                              Name 141  "ub41"
+                              Name 142  "ub42"
+                              Decorate 136(uiv4) NoStaticUse
+                              Decorate 138(uv4) NoStaticUse
+                              Decorate 141(ub41) NoStaticUse
+                              Decorate 142(ub42) NoStaticUse
+               2:             TypeVoid
+               3:             TypeFunction 2
+               6:             TypeBool
+               7:             TypeFunction 6(bool)
+              10:             TypeFloat 32
+              11:             TypePointer Output 10(float)
+         12(of1):     11(ptr) Variable Output
+              14:   10(float) Constant 1065353216
+              17:   10(float) Constant 1092616192
+              20:   10(float) Constant 0
+              21:             TypeVector 10(float) 4
+              22:             TypePointer Output 21(fvec4)
+         23(of4):     22(ptr) Variable Output
+              24:   21(fvec4) ConstantComposite 20 20 20 20
+              25:             TypePointer UniformConstant 6(bool)
+          26(ub):     25(ptr) Variable UniformConstant
+              28:             TypeInt 32 1
+              29:             TypePointer UniformConstant 28(int)
+          30(ui):     29(ptr) Variable UniformConstant
+              32:     28(int) Constant 2
+         40(uba):     25(ptr) Variable UniformConstant
+             108:             TypePointer UniformConstant 10(float)
+         109(uf):    108(ptr) Variable UniformConstant
+             112:   10(float) Constant 1082130432
+             134:             TypeVector 28(int) 4
+             135:             TypePointer UniformConstant 134(ivec4)
+       136(uiv4):    135(ptr) Variable UniformConstant
+             137:             TypePointer UniformConstant 21(fvec4)
+        138(uv4):    137(ptr) Variable UniformConstant
+             139:             TypeVector 6(bool) 4
+             140:             TypePointer UniformConstant 139(bvec4)
+       141(ub41):    140(ptr) Variable UniformConstant
+       142(ub42):    140(ptr) Variable UniformConstant
+         4(main):           2 Function None 3
+               5:             Label
+                              Store 12(of1) 20
+                              Store 23(of4) 24
+              27:     6(bool) Load 26(ub)
+              31:     28(int) Load 30(ui)
+              33:     6(bool) SGreaterThan 31 32
+              34:     6(bool) LogicalOr 27 33
+                              SelectionMerge 36 None
+                              BranchConditional 34 35 36
+              35:               Label
+              37:   10(float)   Load 12(of1)
+              38:   10(float)   FAdd 37 14
+                                Store 12(of1) 38
+                                Branch 36
+              36:             Label
+              39:     6(bool) Load 26(ub)
+              41:     6(bool) Load 40(uba)
+              42:     6(bool) LogicalNot 41
+              43:     6(bool) LogicalAnd 39 42
+                              SelectionMerge 45 None
+                              BranchConditional 43 44 45
+              44:               Label
+              46:   10(float)   Load 12(of1)
+              47:   10(float)   FAdd 46 14
+                                Store 12(of1) 47
+                                Branch 45
+              45:             Label
+              48:     6(bool) Load 26(ub)
+              49:     6(bool) LogicalNot 48
+                              SelectionMerge 51 None
+                              BranchConditional 49 50 51
+              50:               Label
+              52:     6(bool)   FunctionCall 8(foo()
+                                Branch 51
+              51:             Label
+              53:     6(bool) Phi 48 45 52 50
+                              SelectionMerge 55 None
+                              BranchConditional 53 54 55
+              54:               Label
+              56:   10(float)   Load 12(of1)
+              57:   10(float)   FAdd 56 14
+                                Store 12(of1) 57
+                                Branch 55
+              55:             Label
+              58:     6(bool) Load 26(ub)
+                              SelectionMerge 60 None
+                              BranchConditional 58 59 60
+              59:               Label
+              61:     6(bool)   FunctionCall 8(foo()
+                                Branch 60
+              60:             Label
+              62:     6(bool) Phi 58 55 61 59
+                              SelectionMerge 64 None
+                              BranchConditional 62 63 64
+              63:               Label
+              65:   10(float)   Load 12(of1)
+              66:   10(float)   FAdd 65 14
+                                Store 12(of1) 66
+                                Branch 64
+              64:             Label
+              67:     6(bool) FunctionCall 8(foo()
+              68:     6(bool) Load 26(ub)
+              69:     6(bool) LogicalOr 67 68
+                              SelectionMerge 71 None
+                              BranchConditional 69 70 71
+              70:               Label
+              72:   10(float)   Load 12(of1)
+              73:   10(float)   FAdd 72 14
+                                Store 12(of1) 73
+                                Branch 71
+              71:             Label
+              74:     6(bool) FunctionCall 8(foo()
+              75:     6(bool) Load 26(ub)
+              76:     6(bool) LogicalAnd 74 75
+                              SelectionMerge 78 None
+                              BranchConditional 76 77 78
+              77:               Label
+              79:   10(float)   Load 12(of1)
+              80:   10(float)   FAdd 79 14
+                                Store 12(of1) 80
+                                Branch 78
+              78:             Label
+              81:     6(bool) Load 26(ub)
+              82:     6(bool) LogicalNot 81
+                              SelectionMerge 84 None
+                              BranchConditional 82 83 84
+              83:               Label
+              85:   10(float)   Load 12(of1)
+              86:   10(float)   FAdd 85 14
+                                Store 12(of1) 86
+              87:     6(bool)   FOrdGreaterThan 86 14
+                                Branch 84
+              84:             Label
+              88:     6(bool) Phi 81 78 87 83
+                              SelectionMerge 90 None
+                              BranchConditional 88 89 90
+              89:               Label
+              91:   21(fvec4)   Load 23(of4)
+              92:   21(fvec4)   CompositeConstruct 14 14 14 14
+              93:   21(fvec4)   FAdd 91 92
+                                Store 23(of4) 93
+                                Branch 90
+              90:             Label
+              94:   10(float) Load 12(of1)
+              95:   10(float) FAdd 94 14
+                              Store 12(of1) 95
+              96:     6(bool) FOrdGreaterThan 95 14
+              97:     6(bool) Load 26(ub)
+              98:     6(bool) LogicalOr 96 97
+                              SelectionMerge 100 None
+                              BranchConditional 98 99 100
+              99:               Label
+             101:   21(fvec4)   Load 23(of4)
+             102:   21(fvec4)   CompositeConstruct 14 14 14 14
+             103:   21(fvec4)   FAdd 101 102
+                                Store 23(of4) 103
+                                Branch 100
+             100:             Label
+             104:     6(bool) Load 26(ub)
+             105:     6(bool) LogicalNot 104
+                              SelectionMerge 107 None
+                              BranchConditional 105 106 107
+             106:               Label
+             110:   10(float)   Load 109(uf)
+             111:   10(float)   ExtInst 1(GLSL.std.450) 13(Sin) 110
+             113:   10(float)   FMul 111 112
+             114:   10(float)   Load 12(of1)
+             115:     6(bool)   FOrdGreaterThan 113 114
+                                Branch 107
+             107:             Label
+             116:     6(bool) Phi 104 100 115 106
+                              SelectionMerge 118 None
+                              BranchConditional 116 117 118
+             117:               Label
+             119:   10(float)   Load 12(of1)
+             120:   10(float)   FAdd 119 14
+                                Store 12(of1) 120
+                                Branch 118
+             118:             Label
+             121:     6(bool) Load 26(ub)
+                              SelectionMerge 123 None
+                              BranchConditional 121 122 123
+             122:               Label
+             124:   10(float)   Load 109(uf)
+             125:   10(float)   ExtInst 1(GLSL.std.450) 13(Sin) 124
+             126:   10(float)   FMul 125 112
+             127:   10(float)   Load 12(of1)
+             128:     6(bool)   FOrdGreaterThan 126 127
+                                Branch 123
+             123:             Label
+             129:     6(bool) Phi 121 118 128 122
+                              SelectionMerge 131 None
+                              BranchConditional 129 130 131
+             130:               Label
+             132:   10(float)   Load 12(of1)
+             133:   10(float)   FAdd 132 14
+                                Store 12(of1) 133
+                                Branch 131
+             131:             Label
+                              Return
+                              FunctionEnd
+         8(foo():     6(bool) Function None 7
+               9:             Label
+              13:   10(float) Load 12(of1)
+              15:   10(float) FAdd 13 14
+                              Store 12(of1) 15
+              16:   10(float) Load 12(of1)
+              18:     6(bool) FOrdGreaterThan 16 17
+                              ReturnValue 18
+                              FunctionEnd
diff --git a/Test/spv.shortCircuit.frag b/Test/spv.shortCircuit.frag
new file mode 100755
index 0000000000000000000000000000000000000000..dc1bf79ac7db5333089f31ca453cb04c95fddc1e
--- /dev/null
+++ b/Test/spv.shortCircuit.frag
@@ -0,0 +1,50 @@
+#version 400
+
+uniform ivec4 uiv4;
+uniform vec4 uv4;
+uniform bool ub;
+uniform bool uba;
+uniform bvec4 ub41, ub42;
+uniform float uf;
+uniform int ui;
+
+out float of1;
+out vec4  of4;
+
+bool foo() { ++of1; return of1 > 10.0; }
+
+void main()
+{
+    of1 = 0.0;
+    of4 = vec4(0.0);
+
+    if (ub || ui > 2)  // not worth short circuiting
+        ++of1;
+
+    if (ub && !uba)  // not worth short circuiting
+        ++of1;
+
+    if (ub || foo())   // must short circuit
+        ++of1;
+
+    if (ub && foo())   // must short circuit
+        ++of1;
+
+    if (foo() || ub)   // not worth short circuiting
+        ++of1;
+
+    if (foo() && ub)   // not worth short circuiting
+        ++of1;
+
+    if (ub || ++of1 > 1.0)   // must short circuit
+        ++of4;
+
+    if (++of1 > 1.0 || ub)   // not worth short circuiting
+        ++of4;
+
+    if (ub || sin(uf) * 4.0 > of1)  // worth short circuiting
+        ++of1;
+
+    if (ub && sin(uf) * 4.0 > of1)  // worth short circuiting
+        ++of1;
+}
diff --git a/Test/test-spirv-list b/Test/test-spirv-list
index d3b65213a01108a5c6dcaa13b40bb458a03b796f..64d1f2962b98e2f57f31edaa67b1267d23de7824 100644
--- a/Test/test-spirv-list
+++ b/Test/test-spirv-list
@@ -82,3 +82,6 @@ spv.whileLoop.frag
 spv.atomic.comp
 spv.AofA.frag
 spv.queryL.frag
+spv.shortCircuit.frag
+# GLSL-level semantics
+vulkan.frag
diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h
index 5097b47486ac74400dd6c7cd5699d7ef331a43bd..cb98f939c96335125b97743326049e9eef2d1aa9 100644
--- a/glslang/Include/revision.h
+++ b/glslang/Include/revision.h
@@ -2,5 +2,5 @@
 // For the version, it uses the latest git tag followed by the number of commits.
 // For the date, it uses the current date (when then script is run).
 
-#define GLSLANG_REVISION "3.0.788"
-#define GLSLANG_DATE "14-Oct-2015"
+#define GLSLANG_REVISION "3.0.789"
+#define GLSLANG_DATE "15-Oct-2015"