diff --git a/SPIRV/SPVRemapper.cpp b/SPIRV/SPVRemapper.cpp
index 5c551fb8475fcb7ebed1fb20ea9a98404ad92bef..f30963b13c5a16b2aa02f53709df99322af1b014 100755
--- a/SPIRV/SPVRemapper.cpp
+++ b/SPIRV/SPVRemapper.cpp
@@ -327,12 +327,10 @@ namespace spv {
         bound(maxBound); // reset header ID bound to as big as it now needs to be
     }
 
+    // Mark debug instructions for stripping
     void spirvbin_t::stripDebug()
     {
-        if ((options & STRIP) == 0)
-            return;
-
-        // build local Id and name maps
+        // Strip instructions in the stripOp set: debug info.
         process(
             [&](spv::Op opCode, unsigned start) {
                 // remember opcodes we want to strip later
@@ -343,6 +341,32 @@ namespace spv {
             op_fn_nop);
     }
 
+    // Mark instructions that refer to now-removed IDs for stripping
+    void spirvbin_t::stripDeadRefs()
+    {
+        process(
+            [&](spv::Op opCode, unsigned start) {
+                // strip opcodes pointing to removed data
+                switch (opCode) {
+                case spv::OpName:
+                case spv::OpMemberName:
+                case spv::OpDecorate:
+                case spv::OpMemberDecorate:
+                    if (idPosR.find(asId(start+1)) == idPosR.end())
+                        stripInst(start);
+                    break;
+                default: 
+                    break; // leave it alone
+                }
+
+                return true;
+            },
+            op_fn_nop);
+
+        strip();
+    }
+
+    // Update local maps of ID, type, etc positions
     void spirvbin_t::buildLocalMaps()
     {
         msg(2, 2, std::string("build local maps: "));
@@ -351,7 +375,6 @@ namespace spv {
         idMapL.clear();
 //      preserve nameMap, so we don't clear that.
         fnPos.clear();
-        fnPosDCE.clear();
         fnCalls.clear();
         typeConstPos.clear();
         idPosR.clear();
@@ -366,10 +389,6 @@ namespace spv {
         // build local Id and name maps
         process(
             [&](spv::Op opCode, unsigned start) {
-                // remember opcodes we want to strip later
-                if ((options & STRIP) && isStripOp(opCode))
-                    stripInst(start);
-
                 unsigned word = start+1;
                 spv::Id  typeId = spv::NoResult;
 
@@ -957,7 +976,6 @@ namespace spv {
                 if (call_it == fnCalls.end() || call_it->second == 0) {
                     changed = true;
                     stripRange.push_back(fn->second);
-                    fnPosDCE.insert(*fn);
 
                     // decrease counts of called functions
                     process(
@@ -1011,11 +1029,15 @@ namespace spv {
         // Remove single-use function variables + associated decorations and names
         process(
             [&](spv::Op opCode, unsigned start) {
-                if ((opCode == spv::OpVariable && varUseCount[asId(start+2)] == 1)  ||
-                    (opCode == spv::OpDecorate && varUseCount[asId(start+1)] == 1)  ||
-                    (opCode == spv::OpName     && varUseCount[asId(start+1)] == 1)) {
-                        stripInst(start);
-                }
+                spv::Id id = spv::NoResult;
+                if (opCode == spv::OpVariable)
+                    id = asId(start+2);
+                if (opCode == spv::OpDecorate || opCode == spv::OpName)
+                    id = asId(start+1);
+
+                if (id != spv::NoResult && varUseCount[id] == 1)
+                    stripInst(start);
+
                 return true;
             },
             op_fn_nop);
@@ -1276,25 +1298,31 @@ namespace spv {
         // Set up opcode tables from SpvDoc
         spv::Parameterize();
 
-        validate();  // validate header
-        buildLocalMaps();
+        validate();       // validate header
+        buildLocalMaps(); // build ID maps
 
         msg(3, 4, std::string("ID bound: ") + std::to_string(bound()));
 
+        if (options & STRIP)         stripDebug();
         strip();        // strip out data we decided to eliminate
         if (options & OPT_LOADSTORE) optLoadStore();
         if (options & OPT_FWD_LS)    forwardLoadStores();
         if (options & DCE_FUNCS)     dceFuncs();
         if (options & DCE_VARS)      dceVars();
         if (options & DCE_TYPES)     dceTypes();
-        strip();        // strip out data we decided to eliminate
+
+        strip();         // strip out data we decided to eliminate
+        stripDeadRefs(); // remove references to things we DCEed
+        // after the last strip, we must clean any debug info referring to now-deleted data
 
         if (options & MAP_TYPES)     mapTypeConst();
         if (options & MAP_NAMES)     mapNames();
         if (options & MAP_FUNCS)     mapFnBodies();
 
-        mapRemainder(); // map any unmapped IDs
-        applyMap();     // Now remap each shader to the new IDs we've come up with
+        if (options & MAP_ALL) {
+            mapRemainder(); // map any unmapped IDs
+            applyMap();     // Now remap each shader to the new IDs we've come up with
+        }
     }
 
     // remap from a memory image
diff --git a/SPIRV/SPVRemapper.h b/SPIRV/SPVRemapper.h
index b3c686aae5806e1eb9781178ddc684084dc368d7..77c965821a1a2b8d93cd83aa97ceb4fa6654f2de 100755
--- a/SPIRV/SPVRemapper.h
+++ b/SPIRV/SPVRemapper.h
@@ -239,7 +239,8 @@ private:
 
    void        applyMap();            // remap per local name map
    void        mapRemainder();        // map any IDs we haven't touched yet
-   void        stripDebug();          // strip debug info
+   void        stripDebug();          // strip all debug info
+   void        stripDeadRefs();       // strips debug info for now-dead references after DCE
    void        strip();               // remove debug symbols
    
    std::vector<spirword_t> spv;      // SPIR words
@@ -264,7 +265,6 @@ private:
    // Function start and end.  use unordered_map because we'll have
    // many fewer functions than IDs.
    std::unordered_map<spv::Id, range_t> fnPos;
-   std::unordered_map<spv::Id, range_t> fnPosDCE; // deleted functions
 
    // Which functions are called, anywhere in the module, with a call count
    std::unordered_map<spv::Id, int> fnCalls;
diff --git a/Test/baseResults/remap.basic.dcefunc.frag.out b/Test/baseResults/remap.basic.dcefunc.frag.out
index 99b4d551949733da7bd8b10c35d29e951de6fc2e..c28d90a39578d34e4170acbb2c8e627b674486ff 100644
--- a/Test/baseResults/remap.basic.dcefunc.frag.out
+++ b/Test/baseResults/remap.basic.dcefunc.frag.out
@@ -3,34 +3,33 @@ Warning, version 450 is not yet complete; most version-specific features are pre
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 19
+// Id's are bound by 22
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 14 16
+                              EntryPoint Fragment 4  "main" 17 19
                               ExecutionMode 4 OriginUpperLeft
                               Source GLSL 450
                               Name 4  "main"
-                              Name 9  "dead_fn("
-                              Name 14  "outf4"
-                              Name 16  "inf"
+                              Name 17  "outf4"
+                              Name 19  "inf"
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
                7:             TypeVector 6(float) 3
                8:             TypeFunction 7(fvec3)
-              10:    6(float) Constant 0
-              11:    7(fvec3) ConstantComposite 10 10 10
-              12:             TypeVector 6(float) 4
-              13:             TypePointer Output 12(fvec4)
-       14(outf4):     13(ptr) Variable Output
-              15:             TypePointer Input 6(float)
-         16(inf):     15(ptr) Variable Input
+              11:    6(float) Constant 0
+              12:    7(fvec3) ConstantComposite 11 11 11
+              15:             TypeVector 6(float) 4
+              16:             TypePointer Output 15(fvec4)
+       17(outf4):     16(ptr) Variable Output
+              18:             TypePointer Input 6(float)
+         19(inf):     18(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
-              17:    6(float) Load 16(inf)
-              18:   12(fvec4) CompositeConstruct 17 17 17 17
-                              Store 14(outf4) 18
+              20:    6(float) Load 19(inf)
+              21:   15(fvec4) CompositeConstruct 20 20 20 20
+                              Store 17(outf4) 21
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/remap.basic.none.frag.out b/Test/baseResults/remap.basic.none.frag.out
index 39e56b2e012f1ddba46c66db41ea5e8a5cfed7ea..44f5747bf1364330c52f7d86576820811f4507ce 100644
--- a/Test/baseResults/remap.basic.none.frag.out
+++ b/Test/baseResults/remap.basic.none.frag.out
@@ -3,18 +3,18 @@ Warning, version 450 is not yet complete; most version-specific features are pre
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 20
+// Id's are bound by 22
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 15 17
+                              EntryPoint Fragment 4  "main" 17 19
                               ExecutionMode 4 OriginUpperLeft
                               Source GLSL 450
                               Name 4  "main"
                               Name 9  "dead_fn("
-                              Name 15  "outf4"
-                              Name 17  "inf"
+                              Name 17  "outf4"
+                              Name 19  "inf"
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -22,16 +22,16 @@ Warning, version 450 is not yet complete; most version-specific features are pre
                8:             TypeFunction 7(fvec3)
               11:    6(float) Constant 0
               12:    7(fvec3) ConstantComposite 11 11 11
-              13:             TypeVector 6(float) 4
-              14:             TypePointer Output 13(fvec4)
-       15(outf4):     14(ptr) Variable Output
-              16:             TypePointer Input 6(float)
-         17(inf):     16(ptr) Variable Input
+              15:             TypeVector 6(float) 4
+              16:             TypePointer Output 15(fvec4)
+       17(outf4):     16(ptr) Variable Output
+              18:             TypePointer Input 6(float)
+         19(inf):     18(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
-              18:    6(float) Load 17(inf)
-              19:   13(fvec4) CompositeConstruct 18 18 18 18
-                              Store 15(outf4) 19
+              20:    6(float) Load 19(inf)
+              21:   15(fvec4) CompositeConstruct 20 20 20 20
+                              Store 17(outf4) 21
                               Return
                               FunctionEnd
      9(dead_fn():    7(fvec3) Function None 8
diff --git a/Test/baseResults/remap.basic.strip.frag.out b/Test/baseResults/remap.basic.strip.frag.out
index 27c0874b7dd41c7ff1a39e352010fff949a450bc..ab1a003af32ff929fdbd44622fbfc7c68ade684e 100644
--- a/Test/baseResults/remap.basic.strip.frag.out
+++ b/Test/baseResults/remap.basic.strip.frag.out
@@ -3,12 +3,12 @@ Warning, version 450 is not yet complete; most version-specific features are pre
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 20
+// Id's are bound by 22
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 15 17
+                              EntryPoint Fragment 4  "main" 17 19
                               ExecutionMode 4 OriginUpperLeft
                2:             TypeVoid
                3:             TypeFunction 2
@@ -17,16 +17,16 @@ Warning, version 450 is not yet complete; most version-specific features are pre
                8:             TypeFunction 7(fvec3)
               11:    6(float) Constant 0
               12:    7(fvec3) ConstantComposite 11 11 11
-              13:             TypeVector 6(float) 4
-              14:             TypePointer Output 13(fvec4)
-              15:     14(ptr) Variable Output
-              16:             TypePointer Input 6(float)
-              17:     16(ptr) Variable Input
+              15:             TypeVector 6(float) 4
+              16:             TypePointer Output 15(fvec4)
+              17:     16(ptr) Variable Output
+              18:             TypePointer Input 6(float)
+              19:     18(ptr) Variable Input
                4:           2 Function None 3
                5:             Label
-              18:    6(float) Load 17
-              19:   13(fvec4) CompositeConstruct 18 18 18 18
-                              Store 15 19
+              20:    6(float) Load 19
+              21:   15(fvec4) CompositeConstruct 20 20 20 20
+                              Store 17 21
                               Return
                               FunctionEnd
                9:    7(fvec3) Function None 8
diff --git a/Test/baseResults/remap.hlsl.sample.basic.none.frag.out b/Test/baseResults/remap.hlsl.sample.basic.none.frag.out
index 28c384cee406d2687f421adad13ff71a735439cf..51ad1a8bf964d5f9bcc98664558b46401fb6a091 100644
--- a/Test/baseResults/remap.hlsl.sample.basic.none.frag.out
+++ b/Test/baseResults/remap.hlsl.sample.basic.none.frag.out
@@ -3,7 +3,7 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 190
+// Id's are bound by 191
 
                               Capability Shader
                               Capability Sampled1D
@@ -57,9 +57,9 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented
                               Name 173  "psout"
                               Name 180  "Color"
                               Name 184  "Depth"
-                              Name 187  "g_sSamp2d"
-                              Name 188  "g_sSamp2D_b"
-                              Name 189  "g_tTex1df4a"
+                              Name 188  "g_sSamp2d"
+                              Name 189  "g_sSamp2D_b"
+                              Name 190  "g_tTex1df4a"
                               Decorate 41(g_tTex1df4) DescriptorSet 0
                               Decorate 41(g_tTex1df4) Binding 0
                               Decorate 45(g_sSamp) DescriptorSet 0
@@ -77,10 +77,10 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented
                               Decorate 165(g_tTexcdu4) DescriptorSet 0
                               Decorate 180(Color) Location 0
                               Decorate 184(Depth) BuiltIn FragDepth
-                              Decorate 187(g_sSamp2d) DescriptorSet 0
-                              Decorate 188(g_sSamp2D_b) DescriptorSet 0
-                              Decorate 189(g_tTex1df4a) DescriptorSet 0
-                              Decorate 189(g_tTex1df4a) Binding 1
+                              Decorate 188(g_sSamp2d) DescriptorSet 0
+                              Decorate 189(g_sSamp2D_b) DescriptorSet 0
+                              Decorate 190(g_tTex1df4a) DescriptorSet 0
+                              Decorate 190(g_tTex1df4a) Binding 1
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1
@@ -184,9 +184,9 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented
       180(Color):    179(ptr) Variable Output
              183:             TypePointer Output 35(float)
       184(Depth):    183(ptr) Variable Output
-  187(g_sSamp2d):     44(ptr) Variable UniformConstant
-188(g_sSamp2D_b):     44(ptr) Variable UniformConstant
-189(g_tTex1df4a):     40(ptr) Variable UniformConstant
+  188(g_sSamp2d):     44(ptr) Variable UniformConstant
+189(g_sSamp2D_b):     44(ptr) Variable UniformConstant
+190(g_tTex1df4a):     40(ptr) Variable UniformConstant
          4(main):           2 Function None 3
                5:             Label
         9(mtest):      8(ptr) Variable Function
diff --git a/Test/baseResults/remap.hlsl.sample.basic.strip.frag.out b/Test/baseResults/remap.hlsl.sample.basic.strip.frag.out
index 10a8938df34831f91b9f4a5df8f011c168d254d1..f95d7effbbc912e4ec26bb2c309216d2db7d685e 100644
--- a/Test/baseResults/remap.hlsl.sample.basic.strip.frag.out
+++ b/Test/baseResults/remap.hlsl.sample.basic.strip.frag.out
@@ -3,7 +3,7 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 190
+// Id's are bound by 191
 
                               Capability Shader
                               Capability Sampled1D
@@ -28,10 +28,10 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented
                               Decorate 165 DescriptorSet 0
                               Decorate 180 Location 0
                               Decorate 184 BuiltIn FragDepth
-                              Decorate 187 DescriptorSet 0
                               Decorate 188 DescriptorSet 0
                               Decorate 189 DescriptorSet 0
-                              Decorate 189 Binding 1
+                              Decorate 190 DescriptorSet 0
+                              Decorate 190 Binding 1
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1
@@ -135,9 +135,9 @@ WARNING: 0:4: 'immediate sampler state' : unimplemented
              180:    179(ptr) Variable Output
              183:             TypePointer Output 35(float)
              184:    183(ptr) Variable Output
-             187:     44(ptr) Variable UniformConstant
              188:     44(ptr) Variable UniformConstant
-             189:     40(ptr) Variable UniformConstant
+             189:     44(ptr) Variable UniformConstant
+             190:     40(ptr) Variable UniformConstant
                4:           2 Function None 3
                5:             Label
                9:      8(ptr) Variable Function
diff --git a/Test/baseResults/remap.hlsl.templatetypes.none.frag.out b/Test/baseResults/remap.hlsl.templatetypes.none.frag.out
index c3fab1a29a834814cb7594508b1ea0c31d6f94bd..027f020776560e8b78ae35c33d2f5304b0a7c467 100644
--- a/Test/baseResults/remap.hlsl.templatetypes.none.frag.out
+++ b/Test/baseResults/remap.hlsl.templatetypes.none.frag.out
@@ -1,13 +1,13 @@
 remap.hlsl.templatetypes.none.frag
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 149
+// Id's are bound by 150
 
                               Capability Shader
                               Capability Float64
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 146 148
+                              EntryPoint Fragment 4  "main" 146 149
                               ExecutionMode 4 OriginUpperLeft
                               Name 4  "main"
                               Name 9  "r00"
@@ -39,9 +39,9 @@ remap.hlsl.templatetypes.none.frag
                               Name 136  "r65"
                               Name 141  "r66"
                               Name 146  "@entryPointOutput"
-                              Name 148  "input"
+                              Name 149  "input"
                               Decorate 146(@entryPointOutput) Location 0
-                              Decorate 148(input) Location 0
+                              Decorate 149(input) Location 0
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -157,8 +157,8 @@ remap.hlsl.templatetypes.none.frag
              144:         139 ConstantComposite 72 126 142 143
              145:             TypePointer Output 6(float)
 146(@entryPointOutput):    145(ptr) Variable Output
-             147:             TypePointer Input 7(fvec4)
-      148(input):    147(ptr) Variable Input
+             148:             TypePointer Input 7(fvec4)
+      149(input):    148(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
           9(r00):      8(ptr) Variable Function
diff --git a/Test/baseResults/remap.similar_1a.none.frag.out b/Test/baseResults/remap.similar_1a.none.frag.out
index ad1273aec38494cec6ddc39ad50b76d02baa379d..910ef424a44513f89ebd28ada6db10d471b8cb28 100644
--- a/Test/baseResults/remap.similar_1a.none.frag.out
+++ b/Test/baseResults/remap.similar_1a.none.frag.out
@@ -3,12 +3,12 @@ Warning, version 450 is not yet complete; most version-specific features are pre
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 82
+// Id's are bound by 86
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 50 69 71
+                              EntryPoint Fragment 4  "main" 53 73 75
                               ExecutionMode 4 OriginUpperLeft
                               Source GLSL 450
                               Name 4  "main"
@@ -18,13 +18,13 @@ Warning, version 450 is not yet complete; most version-specific features are pre
                               Name 13  "bound"
                               Name 17  "r"
                               Name 19  "x"
-                              Name 42  "param"
-                              Name 50  "ini4"
-                              Name 69  "outf4"
-                              Name 71  "inf"
-                              Name 74  "param"
+                              Name 44  "param"
+                              Name 53  "ini4"
+                              Name 73  "outf4"
+                              Name 75  "inf"
                               Name 78  "param"
-                              Decorate 50(ini4) Flat
+                              Name 82  "param"
+                              Decorate 53(ini4) Flat
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1
@@ -37,35 +37,35 @@ Warning, version 450 is not yet complete; most version-specific features are pre
               28:             TypeBool
               30:    8(float) Constant 1056964608
               34:      6(int) Constant 1
-              38:      6(int) Constant 2
-              48:             TypeVector 6(int) 4
-              49:             TypePointer Input 48(ivec4)
-        50(ini4):     49(ptr) Variable Input
-              51:             TypeInt 32 0
-              52:     51(int) Constant 1
-              53:             TypePointer Input 6(int)
-              56:     51(int) Constant 2
-              61:     51(int) Constant 0
-              67:             TypeVector 8(float) 4
-              68:             TypePointer Output 67(fvec4)
-       69(outf4):     68(ptr) Variable Output
-              70:             TypePointer Input 8(float)
-         71(inf):     70(ptr) Variable Input
+              40:      6(int) Constant 2
+              51:             TypeVector 6(int) 4
+              52:             TypePointer Input 51(ivec4)
+        53(ini4):     52(ptr) Variable Input
+              54:             TypeInt 32 0
+              55:     54(int) Constant 1
+              56:             TypePointer Input 6(int)
+              59:     54(int) Constant 2
+              64:     54(int) Constant 0
+              71:             TypeVector 8(float) 4
+              72:             TypePointer Output 71(fvec4)
+       73(outf4):     72(ptr) Variable Output
+              74:             TypePointer Input 8(float)
+         75(inf):     74(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
-       74(param):      7(ptr) Variable Function
        78(param):      7(ptr) Variable Function
-              72:    8(float) Load 71(inf)
-              73:      6(int) ConvertFToS 72
-                              Store 74(param) 73
-              75:    8(float) FunctionCall 11(Test1(i1;) 74(param)
-              76:    8(float) Load 71(inf)
+       82(param):      7(ptr) Variable Function
+              76:    8(float) Load 75(inf)
               77:      6(int) ConvertFToS 76
                               Store 78(param) 77
-              79:    8(float) FunctionCall 14(Test2(i1;) 78(param)
-              80:    8(float) FAdd 75 79
-              81:   67(fvec4) CompositeConstruct 80 80 80 80
-                              Store 69(outf4) 81
+              79:    8(float) FunctionCall 11(Test1(i1;) 78(param)
+              80:    8(float) Load 75(inf)
+              81:      6(int) ConvertFToS 80
+                              Store 82(param) 81
+              83:    8(float) FunctionCall 14(Test2(i1;) 82(param)
+              84:    8(float) FAdd 79 83
+              85:   71(fvec4) CompositeConstruct 84 84 84 84
+                              Store 73(outf4) 85
                               Return
                               FunctionEnd
    11(Test1(i1;):    8(float) Function None 9
@@ -101,31 +101,31 @@ Warning, version 450 is not yet complete; most version-specific features are pre
    14(Test2(i1;):    8(float) Function None 9
        13(bound):      7(ptr) FunctionParameter
               15:             Label
-       42(param):      7(ptr) Variable Function
-              37:      6(int) Load 13(bound)
-              39:    28(bool) SGreaterThan 37 38
-                              SelectionMerge 41 None
-                              BranchConditional 39 40 45
-              40:               Label
-              43:      6(int)   Load 13(bound)
-                                Store 42(param) 43
-              44:    8(float)   FunctionCall 11(Test1(i1;) 42(param)
-                                ReturnValue 44
-              45:               Label
-              46:      6(int)   Load 13(bound)
-              47:      6(int)   IMul 46 38
-              54:     53(ptr)   AccessChain 50(ini4) 52
-              55:      6(int)   Load 54
-              57:     53(ptr)   AccessChain 50(ini4) 56
+       44(param):      7(ptr) Variable Function
+              39:      6(int) Load 13(bound)
+              41:    28(bool) SGreaterThan 39 40
+                              SelectionMerge 43 None
+                              BranchConditional 41 42 48
+              42:               Label
+              45:      6(int)   Load 13(bound)
+                                Store 44(param) 45
+              46:    8(float)   FunctionCall 11(Test1(i1;) 44(param)
+                                ReturnValue 46
+              48:               Label
+              49:      6(int)   Load 13(bound)
+              50:      6(int)   IMul 49 40
+              57:     56(ptr)   AccessChain 53(ini4) 55
               58:      6(int)   Load 57
-              59:      6(int)   IMul 55 58
-              60:      6(int)   IAdd 47 59
-              62:     53(ptr)   AccessChain 50(ini4) 61
-              63:      6(int)   Load 62
-              64:      6(int)   IAdd 60 63
-              65:    8(float)   ConvertSToF 64
-                                ReturnValue 65
-              41:             Label
-              66:    8(float) Undef
-                              ReturnValue 66
+              60:     56(ptr)   AccessChain 53(ini4) 59
+              61:      6(int)   Load 60
+              62:      6(int)   IMul 58 61
+              63:      6(int)   IAdd 50 62
+              65:     56(ptr)   AccessChain 53(ini4) 64
+              66:      6(int)   Load 65
+              67:      6(int)   IAdd 63 66
+              68:    8(float)   ConvertSToF 67
+                                ReturnValue 68
+              43:             Label
+              70:    8(float) Undef
+                              ReturnValue 70
                               FunctionEnd
diff --git a/Test/baseResults/remap.similar_1b.none.frag.out b/Test/baseResults/remap.similar_1b.none.frag.out
index b86fd4b61b0866bbe66b87a3b5b680d5b9a4c55b..ce79e00beffe95435a49265324aadb0e159795aa 100644
--- a/Test/baseResults/remap.similar_1b.none.frag.out
+++ b/Test/baseResults/remap.similar_1b.none.frag.out
@@ -3,12 +3,12 @@ Warning, version 450 is not yet complete; most version-specific features are pre
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 87
+// Id's are bound by 91
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 55 74 76
+                              EntryPoint Fragment 4  "main" 58 78 80
                               ExecutionMode 4 OriginUpperLeft
                               Source GLSL 450
                               Name 4  "main"
@@ -18,13 +18,13 @@ Warning, version 450 is not yet complete; most version-specific features are pre
                               Name 13  "bound"
                               Name 17  "r"
                               Name 19  "x"
-                              Name 47  "param"
-                              Name 55  "ini4"
-                              Name 74  "outf4"
-                              Name 76  "inf"
-                              Name 79  "param"
+                              Name 49  "param"
+                              Name 58  "ini4"
+                              Name 78  "outf4"
+                              Name 80  "inf"
                               Name 83  "param"
-                              Decorate 55(ini4) Flat
+                              Name 87  "param"
+                              Decorate 58(ini4) Flat
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 1
@@ -38,36 +38,36 @@ Warning, version 450 is not yet complete; most version-specific features are pre
               30:    8(float) Constant 1056964608
               34:      6(int) Constant 1
               36:    8(float) Constant 1045220557
-              41:      6(int) Constant 2
-              51:      6(int) Constant 4
-              53:             TypeVector 6(int) 4
-              54:             TypePointer Input 53(ivec4)
-        55(ini4):     54(ptr) Variable Input
-              56:             TypeInt 32 0
-              57:     56(int) Constant 1
-              58:             TypePointer Input 6(int)
-              61:     56(int) Constant 2
-              66:     56(int) Constant 0
-              72:             TypeVector 8(float) 4
-              73:             TypePointer Output 72(fvec4)
-       74(outf4):     73(ptr) Variable Output
-              75:             TypePointer Input 8(float)
-         76(inf):     75(ptr) Variable Input
+              43:      6(int) Constant 2
+              54:      6(int) Constant 4
+              56:             TypeVector 6(int) 4
+              57:             TypePointer Input 56(ivec4)
+        58(ini4):     57(ptr) Variable Input
+              59:             TypeInt 32 0
+              60:     59(int) Constant 1
+              61:             TypePointer Input 6(int)
+              64:     59(int) Constant 2
+              69:     59(int) Constant 0
+              76:             TypeVector 8(float) 4
+              77:             TypePointer Output 76(fvec4)
+       78(outf4):     77(ptr) Variable Output
+              79:             TypePointer Input 8(float)
+         80(inf):     79(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
-       79(param):      7(ptr) Variable Function
        83(param):      7(ptr) Variable Function
-              77:    8(float) Load 76(inf)
-              78:      6(int) ConvertFToS 77
-                              Store 79(param) 78
-              80:    8(float) FunctionCall 11(Test1(i1;) 79(param)
-              81:    8(float) Load 76(inf)
+       87(param):      7(ptr) Variable Function
+              81:    8(float) Load 80(inf)
               82:      6(int) ConvertFToS 81
                               Store 83(param) 82
-              84:    8(float) FunctionCall 14(Test2(i1;) 83(param)
-              85:    8(float) FAdd 80 84
-              86:   72(fvec4) CompositeConstruct 85 85 85 85
-                              Store 74(outf4) 86
+              84:    8(float) FunctionCall 11(Test1(i1;) 83(param)
+              85:    8(float) Load 80(inf)
+              86:      6(int) ConvertFToS 85
+                              Store 87(param) 86
+              88:    8(float) FunctionCall 14(Test2(i1;) 87(param)
+              89:    8(float) FAdd 84 88
+              90:   76(fvec4) CompositeConstruct 89 89 89 89
+                              Store 78(outf4) 90
                               Return
                               FunctionEnd
    11(Test1(i1;):    8(float) Function None 9
@@ -106,32 +106,32 @@ Warning, version 450 is not yet complete; most version-specific features are pre
    14(Test2(i1;):    8(float) Function None 9
        13(bound):      7(ptr) FunctionParameter
               15:             Label
-       47(param):      7(ptr) Variable Function
-              40:      6(int) Load 13(bound)
-              42:    28(bool) SGreaterThan 40 41
-                              SelectionMerge 44 None
-                              BranchConditional 42 43 49
-              43:               Label
-              45:      6(int)   Load 13(bound)
-              46:      6(int)   IMul 45 41
-                                Store 47(param) 46
-              48:    8(float)   FunctionCall 11(Test1(i1;) 47(param)
-                                ReturnValue 48
-              49:               Label
-              50:      6(int)   Load 13(bound)
-              52:      6(int)   IMul 50 51
-              59:     58(ptr)   AccessChain 55(ini4) 57
-              60:      6(int)   Load 59
-              62:     58(ptr)   AccessChain 55(ini4) 61
+       49(param):      7(ptr) Variable Function
+              42:      6(int) Load 13(bound)
+              44:    28(bool) SGreaterThan 42 43
+                              SelectionMerge 46 None
+                              BranchConditional 44 45 52
+              45:               Label
+              47:      6(int)   Load 13(bound)
+              48:      6(int)   IMul 47 43
+                                Store 49(param) 48
+              50:    8(float)   FunctionCall 11(Test1(i1;) 49(param)
+                                ReturnValue 50
+              52:               Label
+              53:      6(int)   Load 13(bound)
+              55:      6(int)   IMul 53 54
+              62:     61(ptr)   AccessChain 58(ini4) 60
               63:      6(int)   Load 62
-              64:      6(int)   IMul 60 63
-              65:      6(int)   IAdd 52 64
-              67:     58(ptr)   AccessChain 55(ini4) 66
-              68:      6(int)   Load 67
-              69:      6(int)   IAdd 65 68
-              70:    8(float)   ConvertSToF 69
-                                ReturnValue 70
-              44:             Label
-              71:    8(float) Undef
-                              ReturnValue 71
+              65:     61(ptr)   AccessChain 58(ini4) 64
+              66:      6(int)   Load 65
+              67:      6(int)   IMul 63 66
+              68:      6(int)   IAdd 55 67
+              70:     61(ptr)   AccessChain 58(ini4) 69
+              71:      6(int)   Load 70
+              72:      6(int)   IAdd 68 71
+              73:    8(float)   ConvertSToF 72
+                                ReturnValue 73
+              46:             Label
+              75:    8(float) Undef
+                              ReturnValue 75
                               FunctionEnd
diff --git a/Test/baseResults/remap.switch.none.frag.out b/Test/baseResults/remap.switch.none.frag.out
index 5d373ccf9c496552e03e8cd19e8127ab2c7afdb4..68d075b2579b52f1488c6bae0b8c849845cfd6cf 100644
--- a/Test/baseResults/remap.switch.none.frag.out
+++ b/Test/baseResults/remap.switch.none.frag.out
@@ -5,7 +5,7 @@ WARNING: 0:5: '' : all default precisions are highp; use precision statements to
 
 // Module Version 10000
 // Generated by (magic number): 80001
-// Id's are bound by 44
+// Id's are bound by 48
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
@@ -20,8 +20,8 @@ WARNING: 0:5: '' : all default precisions are highp; use precision statements to
                               Decorate 23(FragColor) RelaxedPrecision
                               Decorate 23(FragColor) Location 0
                               Decorate 29 RelaxedPrecision
-                              Decorate 35 RelaxedPrecision
-                              Decorate 41 RelaxedPrecision
+                              Decorate 36 RelaxedPrecision
+                              Decorate 43 RelaxedPrecision
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -36,12 +36,12 @@ WARNING: 0:5: '' : all default precisions are highp; use precision statements to
    23(FragColor):     22(ptr) Variable Output
               24:     10(int) Constant 0
               27:    6(float) Constant 0
-              30:     10(int) Constant 1
-              33:    6(float) Constant 1065353216
-              36:     10(int) Constant 2
-              39:    6(float) Constant 1073741824
-              42:    6(float) Constant 3212836864
-              43:    7(fvec4) ConstantComposite 42 42 42 42
+              31:     10(int) Constant 1
+              34:    6(float) Constant 1065353216
+              38:     10(int) Constant 2
+              41:    6(float) Constant 1073741824
+              45:    6(float) Constant 3212836864
+              46:    7(fvec4) ConstantComposite 45 45 45 45
          4(main):           2 Function None 3
                5:             Label
               13:     12(ptr) AccessChain 9(in0) 11
@@ -53,7 +53,7 @@ WARNING: 0:5: '' : all default precisions are highp; use precision statements to
                                      case 1: 18
                                      case 2: 19
               20:               Label
-                                Store 23(FragColor) 43
+                                Store 23(FragColor) 46
                                 Branch 21
               17:               Label
               25:     12(ptr)   AccessChain 9(in0) 24
@@ -63,18 +63,18 @@ WARNING: 0:5: '' : all default precisions are highp; use precision statements to
                                 Store 23(FragColor) 29
                                 Branch 21
               18:               Label
-              31:     12(ptr)   AccessChain 9(in0) 30
-              32:    6(float)   Load 31
-              34:    6(float)   FAdd 32 33
-              35:    7(fvec4)   CompositeConstruct 34 34 34 34
-                                Store 23(FragColor) 35
+              32:     12(ptr)   AccessChain 9(in0) 31
+              33:    6(float)   Load 32
+              35:    6(float)   FAdd 33 34
+              36:    7(fvec4)   CompositeConstruct 35 35 35 35
+                                Store 23(FragColor) 36
                                 Branch 21
               19:               Label
-              37:     12(ptr)   AccessChain 9(in0) 36
-              38:    6(float)   Load 37
-              40:    6(float)   FAdd 38 39
-              41:    7(fvec4)   CompositeConstruct 40 40 40 40
-                                Store 23(FragColor) 41
+              39:     12(ptr)   AccessChain 9(in0) 38
+              40:    6(float)   Load 39
+              42:    6(float)   FAdd 40 41
+              43:    7(fvec4)   CompositeConstruct 42 42 42 42
+                                Store 23(FragColor) 43
                                 Branch 21
               21:             Label
                               Return