diff --git a/Test/baseResults/hlsl.noSemantic.functionality1.comp.out b/Test/baseResults/hlsl.noSemantic.functionality1.comp.out
index 8fd35e956312e4ec5f8563e8996c8639dddd9d79..0b6e9eb18ec00f15c52806fb3c6fc87d0aeed865 100644
--- a/Test/baseResults/hlsl.noSemantic.functionality1.comp.out
+++ b/Test/baseResults/hlsl.noSemantic.functionality1.comp.out
@@ -1,7 +1,7 @@
 hlsl.noSemantic.functionality1.comp
 // Module Version 10000
 // Generated by (magic number): 80006
-// Id's are bound by 31
+// Id's are bound by 30
 
                               Capability Shader
                               Extension  "SPV_GOOGLE_hlsl_functionality1"
@@ -15,18 +15,18 @@ hlsl.noSemantic.functionality1.comp
                               Name 11  "Buf"
                               MemberName 11(Buf) 0  "@data"
                               Name 13  "Buf"
-                              Name 16  "Buf@count"
-                              MemberName 16(Buf@count) 0  "@count"
-                              Name 18  "Buf@count"
+                              Name 17  "Buf@count"
+                              MemberName 17(Buf@count) 0  "@count"
+                              Name 19  "Buf@count"
                               Decorate 10 ArrayStride 16
                               MemberDecorate 11(Buf) 0 Offset 0
                               Decorate 11(Buf) BufferBlock
                               Decorate 13(Buf) DescriptorSet 0
                               Decorate 13(Buf) Binding 0
-                              MemberDecorate 16(Buf@count) 0 Offset 0
-                              Decorate 16(Buf@count) BufferBlock
-                              Decorate 18(Buf@count) DescriptorSet 0
-                              DecorateId 13(Buf) DecorationHlslCounterBufferGOOGLE 18(Buf@count)
+                              MemberDecorate 17(Buf@count) 0 Offset 0
+                              Decorate 17(Buf@count) BufferBlock
+                              Decorate 19(Buf@count) DescriptorSet 0
+                              DecorateId 13(Buf) DecorationHlslCounterBufferGOOGLE 19(Buf@count)
                2:             TypeVoid
                3:             TypeFunction 2
                8:             TypeFloat 32
@@ -37,27 +37,26 @@ hlsl.noSemantic.functionality1.comp
          13(Buf):     12(ptr) Variable Uniform
               14:             TypeInt 32 1
               15:     14(int) Constant 0
-   16(Buf@count):             TypeStruct 14(int)
-              17:             TypePointer Uniform 16(Buf@count)
-   18(Buf@count):     17(ptr) Variable Uniform
-              19:             TypePointer Uniform 14(int)
-              21:     14(int) Constant 1
-              22:             TypeInt 32 0
-              23:     22(int) Constant 1
-              24:     22(int) Constant 0
-              26:    8(float) Constant 1065353216
-              27:    9(fvec4) ConstantComposite 26 26 26 26
-              28:             TypePointer Uniform 9(fvec4)
+              16:             TypeInt 32 0
+   17(Buf@count):             TypeStruct 16(int)
+              18:             TypePointer Uniform 17(Buf@count)
+   19(Buf@count):     18(ptr) Variable Uniform
+              20:             TypePointer Uniform 16(int)
+              22:     16(int) Constant 1
+              23:     16(int) Constant 0
+              25:    8(float) Constant 1065353216
+              26:    9(fvec4) ConstantComposite 25 25 25 25
+              27:             TypePointer Uniform 9(fvec4)
          4(main):           2 Function None 3
                5:             Label
-              30:           2 FunctionCall 6(@main()
+              29:           2 FunctionCall 6(@main()
                               Return
                               FunctionEnd
        6(@main():           2 Function None 3
                7:             Label
-              20:     19(ptr) AccessChain 18(Buf@count) 15
-              25:     22(int) AtomicIAdd 20 23 24 21
-              29:     28(ptr) AccessChain 13(Buf) 15 25
-                              Store 29 27
+              21:     20(ptr) AccessChain 19(Buf@count) 15
+              24:     16(int) AtomicIAdd 21 22 23 22
+              28:     27(ptr) AccessChain 13(Buf) 15 24
+                              Store 28 26
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.structbuffer.append.fn.frag.out b/Test/baseResults/hlsl.structbuffer.append.fn.frag.out
index 1848a968c3a3950b3883be099d8485bc69ce2a3c..6aa82e4682d70dba2b0b4847ab251035a538f9e1 100644
--- a/Test/baseResults/hlsl.structbuffer.append.fn.frag.out
+++ b/Test/baseResults/hlsl.structbuffer.append.fn.frag.out
@@ -5,9 +5,9 @@ gl_FragCoord origin is upper left
 0:8  Function Definition: Fn2(block--vf4[0]1;block--vf4[0]1; ( temp 4-component vector of float)
 0:8    Function Parameters: 
 0:8      'arg_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:8      'arg_a@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:8      'arg_a@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:8      'arg_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:8      'arg_c@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:8      'arg_c@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:?     Sequence
 0:9      move second child to first child ( temp 4-component vector of float)
 0:9        indirect index ( buffer 4-component vector of float)
@@ -16,12 +16,12 @@ gl_FragCoord origin is upper left
 0:9            Constant:
 0:9              0 (const uint)
 0:9          AtomicAdd ( temp uint)
-0:9            @count: direct index for structure ( temp int)
-0:9              'arg_a@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:9            @count: direct index for structure ( temp uint)
+0:9              'arg_a@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:9              Constant:
 0:9                0 (const int)
 0:9            Constant:
-0:9              1 (const int)
+0:9              1 (const uint)
 0:?         Constant:
 0:?           1.000000
 0:?           2.000000
@@ -35,12 +35,12 @@ gl_FragCoord origin is upper left
 0:10              0 (const uint)
 0:10          add ( temp uint)
 0:10            AtomicAdd ( temp uint)
-0:10              @count: direct index for structure ( temp int)
-0:10                'arg_c@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:10              @count: direct index for structure ( temp uint)
+0:10                'arg_c@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:10                Constant:
 0:10                  0 (const int)
 0:10              Constant:
-0:10                -1 (const int)
+0:10                4294967295 (const uint)
 0:10            Constant:
 0:10              -1 (const int)
 0:19  Function Definition: @main(u1; ( temp 4-component vector of float)
@@ -50,9 +50,9 @@ gl_FragCoord origin is upper left
 0:22      Branch: Return with expression
 0:22        Function Call: Fn2(block--vf4[0]1;block--vf4[0]1; ( temp 4-component vector of float)
 0:22          'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:22          'sbuf_a@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:22          'sbuf_a@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:22          'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:22          'sbuf_c@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:22          'sbuf_c@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:19  Function Definition: main( ( temp void)
 0:19    Function Parameters: 
 0:?     Sequence
@@ -65,9 +65,9 @@ gl_FragCoord origin is upper left
 0:?           'pos' ( temp uint)
 0:?   Linker Objects
 0:?     'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:?     'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:?     'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:?     'pos' (layout( location=0) flat in uint)
@@ -82,9 +82,9 @@ gl_FragCoord origin is upper left
 0:8  Function Definition: Fn2(block--vf4[0]1;block--vf4[0]1; ( temp 4-component vector of float)
 0:8    Function Parameters: 
 0:8      'arg_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:8      'arg_a@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:8      'arg_a@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:8      'arg_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:8      'arg_c@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:8      'arg_c@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:?     Sequence
 0:9      move second child to first child ( temp 4-component vector of float)
 0:9        indirect index ( buffer 4-component vector of float)
@@ -93,12 +93,12 @@ gl_FragCoord origin is upper left
 0:9            Constant:
 0:9              0 (const uint)
 0:9          AtomicAdd ( temp uint)
-0:9            @count: direct index for structure ( temp int)
-0:9              'arg_a@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:9            @count: direct index for structure ( temp uint)
+0:9              'arg_a@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:9              Constant:
 0:9                0 (const int)
 0:9            Constant:
-0:9              1 (const int)
+0:9              1 (const uint)
 0:?         Constant:
 0:?           1.000000
 0:?           2.000000
@@ -112,12 +112,12 @@ gl_FragCoord origin is upper left
 0:10              0 (const uint)
 0:10          add ( temp uint)
 0:10            AtomicAdd ( temp uint)
-0:10              @count: direct index for structure ( temp int)
-0:10                'arg_c@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:10              @count: direct index for structure ( temp uint)
+0:10                'arg_c@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:10                Constant:
 0:10                  0 (const int)
 0:10              Constant:
-0:10                -1 (const int)
+0:10                4294967295 (const uint)
 0:10            Constant:
 0:10              -1 (const int)
 0:19  Function Definition: @main(u1; ( temp 4-component vector of float)
@@ -127,9 +127,9 @@ gl_FragCoord origin is upper left
 0:22      Branch: Return with expression
 0:22        Function Call: Fn2(block--vf4[0]1;block--vf4[0]1; ( temp 4-component vector of float)
 0:22          'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:22          'sbuf_a@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:22          'sbuf_a@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:22          'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:22          'sbuf_c@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:22          'sbuf_c@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:19  Function Definition: main( ( temp void)
 0:19    Function Parameters: 
 0:?     Sequence
@@ -142,9 +142,9 @@ gl_FragCoord origin is upper left
 0:?           'pos' ( temp uint)
 0:?   Linker Objects
 0:?     'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:?     'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:?     'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:?     'pos' (layout( location=0) flat in uint)
@@ -169,8 +169,8 @@ gl_FragCoord origin is upper left
                               Name 16  "arg_a@count"
                               Name 17  "arg_c"
                               Name 18  "arg_c@count"
-                              Name 25  "@main(u1;"
-                              Name 24  "pos"
+                              Name 24  "@main(u1;"
+                              Name 23  "pos"
                               Name 49  "sbuf_a"
                               Name 50  "sbuf_a@count"
                               Name 51  "sbuf_c"
@@ -207,30 +207,30 @@ gl_FragCoord origin is upper left
                8:             TypeRuntimeArray 7(fvec4)
                9:             TypeStruct 8
               10:             TypePointer Uniform 9(struct)
-              11:             TypeInt 32 1
+              11:             TypeInt 32 0
               12:             TypeStruct 11(int)
               13:             TypePointer Uniform 12(struct)
               14:             TypeFunction 7(fvec4) 10(ptr) 13(ptr) 10(ptr) 13(ptr)
-              21:             TypeInt 32 0
-              22:             TypePointer Function 21(int)
-              23:             TypeFunction 7(fvec4) 22(ptr)
-              27:     11(int) Constant 0
+              21:             TypePointer Function 11(int)
+              22:             TypeFunction 7(fvec4) 21(ptr)
+              26:             TypeInt 32 1
+              27:     26(int) Constant 0
               28:             TypePointer Uniform 11(int)
               30:     11(int) Constant 1
-              31:     21(int) Constant 1
-              32:     21(int) Constant 0
-              34:    6(float) Constant 1065353216
-              35:    6(float) Constant 1073741824
-              36:    6(float) Constant 1077936128
-              37:    6(float) Constant 1082130432
-              38:    7(fvec4) ConstantComposite 34 35 36 37
-              39:             TypePointer Uniform 7(fvec4)
-              42:     11(int) Constant 4294967295
+              31:     11(int) Constant 0
+              33:    6(float) Constant 1065353216
+              34:    6(float) Constant 1073741824
+              35:    6(float) Constant 1077936128
+              36:    6(float) Constant 1082130432
+              37:    7(fvec4) ConstantComposite 33 34 35 36
+              38:             TypePointer Uniform 7(fvec4)
+              41:     11(int) Constant 4294967295
+              43:     26(int) Constant 4294967295
       49(sbuf_a):     10(ptr) Variable Uniform
 50(sbuf_a@count):     13(ptr) Variable Uniform
       51(sbuf_c):     10(ptr) Variable Uniform
 52(sbuf_c@count):     13(ptr) Variable Uniform
-              57:             TypePointer Input 21(int)
+              57:             TypePointer Input 11(int)
          58(pos):     57(ptr) Variable Input
               60:             TypePointer Output 7(fvec4)
 61(@entryPointOutput):     60(ptr) Variable Output
@@ -241,13 +241,13 @@ gl_FragCoord origin is upper left
  69(sbuf_unused):     10(ptr) Variable Uniform
          4(main):           2 Function None 3
                5:             Label
-         56(pos):     22(ptr) Variable Function
-       62(param):     22(ptr) Variable Function
-              59:     21(int) Load 58(pos)
+         56(pos):     21(ptr) Variable Function
+       62(param):     21(ptr) Variable Function
+              59:     11(int) Load 58(pos)
                               Store 56(pos) 59
-              63:     21(int) Load 56(pos)
+              63:     11(int) Load 56(pos)
                               Store 62(param) 63
-              64:    7(fvec4) FunctionCall 25(@main(u1;) 62(param)
+              64:    7(fvec4) FunctionCall 24(@main(u1;) 62(param)
                               Store 61(@entryPointOutput) 64
                               Return
                               FunctionEnd
@@ -258,19 +258,19 @@ gl_FragCoord origin is upper left
  18(arg_c@count):     13(ptr) FunctionParameter
               20:             Label
               29:     28(ptr) AccessChain 16(arg_a@count) 27
-              33:     21(int) AtomicIAdd 29 31 32 30
-              40:     39(ptr) AccessChain 15(arg_a) 27 33
-                              Store 40 38
-              41:     28(ptr) AccessChain 18(arg_c@count) 27
-              43:     21(int) AtomicIAdd 41 31 32 42
-              44:     21(int) IAdd 43 42
-              45:     39(ptr) AccessChain 17(arg_c) 27 44
+              32:     11(int) AtomicIAdd 29 30 31 30
+              39:     38(ptr) AccessChain 15(arg_a) 27 32
+                              Store 39 37
+              40:     28(ptr) AccessChain 18(arg_c@count) 27
+              42:     11(int) AtomicIAdd 40 30 31 41
+              44:     11(int) IAdd 42 43
+              45:     38(ptr) AccessChain 17(arg_c) 27 44
               46:    7(fvec4) Load 45
                               ReturnValue 46
                               FunctionEnd
-   25(@main(u1;):    7(fvec4) Function None 23
-         24(pos):     22(ptr) FunctionParameter
-              26:             Label
+   24(@main(u1;):    7(fvec4) Function None 22
+         23(pos):     21(ptr) FunctionParameter
+              25:             Label
               53:    7(fvec4) FunctionCall 19(Fn2(block--vf4[0]1;block--vf4[0]1;) 49(sbuf_a) 50(sbuf_a@count) 51(sbuf_c) 52(sbuf_c@count)
                               ReturnValue 53
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.structbuffer.append.frag.out b/Test/baseResults/hlsl.structbuffer.append.frag.out
index ab3998f5550ceff5a3b2b0bfe91edd454e7f05ad..8026a1252a755041a4909da2ae03b27714b466ad 100644
--- a/Test/baseResults/hlsl.structbuffer.append.frag.out
+++ b/Test/baseResults/hlsl.structbuffer.append.frag.out
@@ -13,12 +13,12 @@ gl_FragCoord origin is upper left
 0:8            Constant:
 0:8              0 (const uint)
 0:8          AtomicAdd ( temp uint)
-0:8            @count: direct index for structure ( temp int)
-0:8              'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:8            @count: direct index for structure ( temp uint)
+0:8              'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:8              Constant:
 0:8                0 (const int)
 0:8            Constant:
-0:8              1 (const int)
+0:8              1 (const uint)
 0:?         Constant:
 0:?           1.000000
 0:?           2.000000
@@ -32,12 +32,12 @@ gl_FragCoord origin is upper left
 0:10              0 (const uint)
 0:10          add ( temp uint)
 0:10            AtomicAdd ( temp uint)
-0:10              @count: direct index for structure ( temp int)
-0:10                'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:10              @count: direct index for structure ( temp uint)
+0:10                'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:10                Constant:
 0:10                  0 (const int)
 0:10              Constant:
-0:10                -1 (const int)
+0:10                4294967295 (const uint)
 0:10            Constant:
 0:10              -1 (const int)
 0:7  Function Definition: main( ( temp void)
@@ -52,9 +52,9 @@ gl_FragCoord origin is upper left
 0:?           'pos' ( temp uint)
 0:?   Linker Objects
 0:?     'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:?     'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:?     'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:?     'pos' (layout( location=0) flat in uint)
@@ -77,12 +77,12 @@ gl_FragCoord origin is upper left
 0:8            Constant:
 0:8              0 (const uint)
 0:8          AtomicAdd ( temp uint)
-0:8            @count: direct index for structure ( temp int)
-0:8              'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:8            @count: direct index for structure ( temp uint)
+0:8              'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:8              Constant:
 0:8                0 (const int)
 0:8            Constant:
-0:8              1 (const int)
+0:8              1 (const uint)
 0:?         Constant:
 0:?           1.000000
 0:?           2.000000
@@ -96,12 +96,12 @@ gl_FragCoord origin is upper left
 0:10              0 (const uint)
 0:10          add ( temp uint)
 0:10            AtomicAdd ( temp uint)
-0:10              @count: direct index for structure ( temp int)
-0:10                'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:10              @count: direct index for structure ( temp uint)
+0:10                'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:10                Constant:
 0:10                  0 (const int)
 0:10              Constant:
-0:10                -1 (const int)
+0:10                4294967295 (const uint)
 0:10            Constant:
 0:10              -1 (const int)
 0:7  Function Definition: main( ( temp void)
@@ -116,9 +116,9 @@ gl_FragCoord origin is upper left
 0:?           'pos' ( temp uint)
 0:?   Linker Objects
 0:?     'sbuf_a' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:?     'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'sbuf_a@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'sbuf_c' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
-0:?     'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'sbuf_c@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'sbuf_unused' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:?     'pos' (layout( location=0) flat in uint)
@@ -142,8 +142,8 @@ gl_FragCoord origin is upper left
                               Name 20  "sbuf_a@count"
                               MemberName 20(sbuf_a@count) 0  "@count"
                               Name 22  "sbuf_a@count"
-                              Name 36  "sbuf_c"
-                              Name 37  "sbuf_c@count"
+                              Name 35  "sbuf_c"
+                              Name 36  "sbuf_c@count"
                               Name 46  "pos"
                               Name 48  "pos"
                               Name 51  "@entryPointOutput"
@@ -156,8 +156,8 @@ gl_FragCoord origin is upper left
                               MemberDecorate 20(sbuf_a@count) 0 Offset 0
                               Decorate 20(sbuf_a@count) BufferBlock
                               Decorate 22(sbuf_a@count) DescriptorSet 0
-                              Decorate 36(sbuf_c) DescriptorSet 0
-                              Decorate 37(sbuf_c@count) DescriptorSet 0
+                              Decorate 35(sbuf_c) DescriptorSet 0
+                              Decorate 36(sbuf_c@count) DescriptorSet 0
                               Decorate 48(pos) Flat
                               Decorate 48(pos) Location 0
                               Decorate 51(@entryPointOutput) Location 0
@@ -175,22 +175,22 @@ gl_FragCoord origin is upper left
       17(sbuf_a):     16(ptr) Variable Uniform
               18:             TypeInt 32 1
               19:     18(int) Constant 0
-20(sbuf_a@count):             TypeStruct 18(int)
+20(sbuf_a@count):             TypeStruct 6(int)
               21:             TypePointer Uniform 20(sbuf_a@count)
 22(sbuf_a@count):     21(ptr) Variable Uniform
-              23:             TypePointer Uniform 18(int)
-              25:     18(int) Constant 1
-              26:      6(int) Constant 1
-              27:      6(int) Constant 0
-              29:    8(float) Constant 1065353216
-              30:    8(float) Constant 1073741824
-              31:    8(float) Constant 1077936128
-              32:    8(float) Constant 1082130432
-              33:    9(fvec4) ConstantComposite 29 30 31 32
-              34:             TypePointer Uniform 9(fvec4)
-      36(sbuf_c):     16(ptr) Variable Uniform
-37(sbuf_c@count):     21(ptr) Variable Uniform
-              39:     18(int) Constant 4294967295
+              23:             TypePointer Uniform 6(int)
+              25:      6(int) Constant 1
+              26:      6(int) Constant 0
+              28:    8(float) Constant 1065353216
+              29:    8(float) Constant 1073741824
+              30:    8(float) Constant 1077936128
+              31:    8(float) Constant 1082130432
+              32:    9(fvec4) ConstantComposite 28 29 30 31
+              33:             TypePointer Uniform 9(fvec4)
+      35(sbuf_c):     16(ptr) Variable Uniform
+36(sbuf_c@count):     21(ptr) Variable Uniform
+              38:      6(int) Constant 4294967295
+              40:     18(int) Constant 4294967295
               47:             TypePointer Input 6(int)
          48(pos):     47(ptr) Variable Input
               50:             TypePointer Output 9(fvec4)
@@ -212,13 +212,13 @@ gl_FragCoord origin is upper left
          11(pos):      7(ptr) FunctionParameter
               13:             Label
               24:     23(ptr) AccessChain 22(sbuf_a@count) 19
-              28:      6(int) AtomicIAdd 24 26 27 25
-              35:     34(ptr) AccessChain 17(sbuf_a) 19 28
-                              Store 35 33
-              38:     23(ptr) AccessChain 37(sbuf_c@count) 19
-              40:      6(int) AtomicIAdd 38 26 27 39
-              41:      6(int) IAdd 40 39
-              42:     34(ptr) AccessChain 36(sbuf_c) 19 41
+              27:      6(int) AtomicIAdd 24 25 26 25
+              34:     33(ptr) AccessChain 17(sbuf_a) 19 27
+                              Store 34 32
+              37:     23(ptr) AccessChain 36(sbuf_c@count) 19
+              39:      6(int) AtomicIAdd 37 25 26 38
+              41:      6(int) IAdd 39 40
+              42:     33(ptr) AccessChain 35(sbuf_c) 19 41
               43:    9(fvec4) Load 42
                               ReturnValue 43
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.structbuffer.floatidx.comp.out b/Test/baseResults/hlsl.structbuffer.floatidx.comp.out
index 0a4dd69d0741d6999ef92fbf8864b0a318dcf056..d1591d5a22f9c2f843a6960d8181f2fdbd5cf97a 100644
--- a/Test/baseResults/hlsl.structbuffer.floatidx.comp.out
+++ b/Test/baseResults/hlsl.structbuffer.floatidx.comp.out
@@ -16,12 +16,12 @@ local_size = (1, 1, 1)
 0:14                0 (const uint)
 0:14            add ( temp uint)
 0:14              AtomicAdd ( temp uint)
-0:14                @count: direct index for structure ( temp int)
-0:14                  'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:14                @count: direct index for structure ( temp uint)
+0:14                  'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:14                  Constant:
 0:14                    0 (const int)
 0:14                Constant:
-0:14                  -1 (const int)
+0:14                  4294967295 (const uint)
 0:14              Constant:
 0:14                -1 (const int)
 0:15      Sequence
@@ -83,7 +83,7 @@ local_size = (1, 1, 1)
 0:?   Linker Objects
 0:?     'outtx' (layout( rgba32f) uniform image2D)
 0:?     'csb' (layout( binding=1 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of float color,  temp 2-component vector of uint threadId} @data})
-0:?     'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
 0:?     'nThreadId' ( in 3-component vector of uint GlobalInvocationID)
 
@@ -108,12 +108,12 @@ local_size = (1, 1, 1)
 0:14                0 (const uint)
 0:14            add ( temp uint)
 0:14              AtomicAdd ( temp uint)
-0:14                @count: direct index for structure ( temp int)
-0:14                  'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:14                @count: direct index for structure ( temp uint)
+0:14                  'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:14                  Constant:
 0:14                    0 (const int)
 0:14                Constant:
-0:14                  -1 (const int)
+0:14                  4294967295 (const uint)
 0:14              Constant:
 0:14                -1 (const int)
 0:15      Sequence
@@ -175,18 +175,18 @@ local_size = (1, 1, 1)
 0:?   Linker Objects
 0:?     'outtx' (layout( rgba32f) uniform image2D)
 0:?     'csb' (layout( binding=1 row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of structure{ temp 4-component vector of float color,  temp 2-component vector of uint threadId} @data})
-0:?     'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'csb@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'rwsb' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of float @data})
 0:?     'nThreadId' ( in 3-component vector of uint GlobalInvocationID)
 
 // Module Version 10000
 // Generated by (magic number): 80006
-// Id's are bound by 84
+// Id's are bound by 85
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint GLCompute 4  "main" 79
+                              EntryPoint GLCompute 4  "main" 80
                               ExecutionMode 4 LocalSize 1 1 1
                               Source HLSL 500
                               Name 4  "main"
@@ -205,15 +205,15 @@ local_size = (1, 1, 1)
                               Name 26  "csb@count"
                               MemberName 26(csb@count) 0  "@count"
                               Name 28  "csb@count"
-                              Name 48  "coord"
-                              Name 52  "storeTemp"
-                              Name 57  "outtx"
-                              Name 63  "rwsb"
-                              MemberName 63(rwsb) 0  "@data"
-                              Name 65  "rwsb"
-                              Name 77  "nThreadId"
-                              Name 79  "nThreadId"
-                              Name 81  "param"
+                              Name 49  "coord"
+                              Name 53  "storeTemp"
+                              Name 58  "outtx"
+                              Name 64  "rwsb"
+                              MemberName 64(rwsb) 0  "@data"
+                              Name 66  "rwsb"
+                              Name 78  "nThreadId"
+                              Name 80  "nThreadId"
+                              Name 82  "param"
                               MemberDecorate 19(sb_t) 0 Offset 0
                               MemberDecorate 19(sb_t) 1 Offset 16
                               Decorate 20 ArrayStride 32
@@ -224,12 +224,12 @@ local_size = (1, 1, 1)
                               MemberDecorate 26(csb@count) 0 Offset 0
                               Decorate 26(csb@count) BufferBlock
                               Decorate 28(csb@count) DescriptorSet 0
-                              Decorate 57(outtx) DescriptorSet 0
-                              Decorate 62 ArrayStride 16
-                              MemberDecorate 63(rwsb) 0 Offset 0
-                              Decorate 63(rwsb) BufferBlock
-                              Decorate 65(rwsb) DescriptorSet 0
-                              Decorate 79(nThreadId) BuiltIn GlobalInvocationId
+                              Decorate 58(outtx) DescriptorSet 0
+                              Decorate 63 ArrayStride 16
+                              MemberDecorate 64(rwsb) 0 Offset 0
+                              Decorate 64(rwsb) BufferBlock
+                              Decorate 66(rwsb) DescriptorSet 0
+                              Decorate 80(nThreadId) BuiltIn GlobalInvocationId
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 0
@@ -248,79 +248,80 @@ local_size = (1, 1, 1)
          23(csb):     22(ptr) Variable Uniform
               24:             TypeInt 32 1
               25:     24(int) Constant 0
-   26(csb@count):             TypeStruct 24(int)
+   26(csb@count):             TypeStruct 6(int)
               27:             TypePointer Uniform 26(csb@count)
    28(csb@count):     27(ptr) Variable Uniform
-              29:             TypePointer Uniform 24(int)
-              31:     24(int) Constant 4294967295
+              29:             TypePointer Uniform 6(int)
+              31:      6(int) Constant 4294967295
               32:      6(int) Constant 1
               33:      6(int) Constant 0
-              36:             TypePointer Uniform 19(sb_t)
-              40:             TypePointer Function 14(fvec4)
-              43:     24(int) Constant 1
-              44:             TypePointer Function 15(ivec2)
-              46:             TypeVector 13(float) 2
-              47:             TypePointer Function 46(fvec2)
-              55:             TypeImage 13(float) 2D nonsampled format:Rgba32f
-              56:             TypePointer UniformConstant 55
-       57(outtx):     56(ptr) Variable UniformConstant
-              62:             TypeRuntimeArray 14(fvec4)
-        63(rwsb):             TypeStruct 62
-              64:             TypePointer Uniform 63(rwsb)
-        65(rwsb):     64(ptr) Variable Uniform
-              66:             TypePointer Function 13(float)
-              73:             TypePointer Uniform 14(fvec4)
-              78:             TypePointer Input 7(ivec3)
-   79(nThreadId):     78(ptr) Variable Input
+              35:     24(int) Constant 4294967295
+              37:             TypePointer Uniform 19(sb_t)
+              41:             TypePointer Function 14(fvec4)
+              44:     24(int) Constant 1
+              45:             TypePointer Function 15(ivec2)
+              47:             TypeVector 13(float) 2
+              48:             TypePointer Function 47(fvec2)
+              56:             TypeImage 13(float) 2D nonsampled format:Rgba32f
+              57:             TypePointer UniformConstant 56
+       58(outtx):     57(ptr) Variable UniformConstant
+              63:             TypeRuntimeArray 14(fvec4)
+        64(rwsb):             TypeStruct 63
+              65:             TypePointer Uniform 64(rwsb)
+        66(rwsb):     65(ptr) Variable Uniform
+              67:             TypePointer Function 13(float)
+              74:             TypePointer Uniform 14(fvec4)
+              79:             TypePointer Input 7(ivec3)
+   80(nThreadId):     79(ptr) Variable Input
          4(main):           2 Function None 3
                5:             Label
-   77(nThreadId):      8(ptr) Variable Function
-       81(param):      8(ptr) Variable Function
-              80:    7(ivec3) Load 79(nThreadId)
-                              Store 77(nThreadId) 80
-              82:    7(ivec3) Load 77(nThreadId)
-                              Store 81(param) 82
-              83:           2 FunctionCall 11(@main(vu3;) 81(param)
+   78(nThreadId):      8(ptr) Variable Function
+       82(param):      8(ptr) Variable Function
+              81:    7(ivec3) Load 80(nThreadId)
+                              Store 78(nThreadId) 81
+              83:    7(ivec3) Load 78(nThreadId)
+                              Store 82(param) 83
+              84:           2 FunctionCall 11(@main(vu3;) 82(param)
                               Return
                               FunctionEnd
   11(@main(vu3;):           2 Function None 9
    10(nThreadId):      8(ptr) FunctionParameter
               12:             Label
         18(data):     17(ptr) Variable Function
-       48(coord):     47(ptr) Variable Function
-   52(storeTemp):     40(ptr) Variable Function
+       49(coord):     48(ptr) Variable Function
+   53(storeTemp):     41(ptr) Variable Function
               30:     29(ptr) AccessChain 28(csb@count) 25
               34:      6(int) AtomicIAdd 30 32 33 31
-              35:      6(int) IAdd 34 31
-              37:     36(ptr) AccessChain 23(csb) 25 35
-              38:    19(sb_t) Load 37
-              39:   14(fvec4) CompositeExtract 38 0
-              41:     40(ptr) AccessChain 18(data) 25
-                              Store 41 39
-              42:   15(ivec2) CompositeExtract 38 1
-              45:     44(ptr) AccessChain 18(data) 43
-                              Store 45 42
-              49:     44(ptr) AccessChain 18(data) 43
-              50:   15(ivec2) Load 49
-              51:   46(fvec2) ConvertUToF 50
-                              Store 48(coord) 51
-              53:     40(ptr) AccessChain 18(data) 25
-              54:   14(fvec4) Load 53
-                              Store 52(storeTemp) 54
-              58:          55 Load 57(outtx)
-              59:   46(fvec2) Load 48(coord)
-              60:   15(ivec2) ConvertFToU 59
-              61:   14(fvec4) Load 52(storeTemp)
-                              ImageWrite 58 60 61
-              67:     66(ptr) AccessChain 48(coord) 33
-              68:   13(float) Load 67
-              69:      6(int) ConvertFToU 68
-              70:     66(ptr) AccessChain 48(coord) 32
-              71:   13(float) Load 70
-              72:      6(int) ConvertFToU 71
-              74:     73(ptr) AccessChain 65(rwsb) 25 72
-              75:   14(fvec4) Load 74
-              76:     73(ptr) AccessChain 65(rwsb) 25 69
-                              Store 76 75
+              36:      6(int) IAdd 34 35
+              38:     37(ptr) AccessChain 23(csb) 25 36
+              39:    19(sb_t) Load 38
+              40:   14(fvec4) CompositeExtract 39 0
+              42:     41(ptr) AccessChain 18(data) 25
+                              Store 42 40
+              43:   15(ivec2) CompositeExtract 39 1
+              46:     45(ptr) AccessChain 18(data) 44
+                              Store 46 43
+              50:     45(ptr) AccessChain 18(data) 44
+              51:   15(ivec2) Load 50
+              52:   47(fvec2) ConvertUToF 51
+                              Store 49(coord) 52
+              54:     41(ptr) AccessChain 18(data) 25
+              55:   14(fvec4) Load 54
+                              Store 53(storeTemp) 55
+              59:          56 Load 58(outtx)
+              60:   47(fvec2) Load 49(coord)
+              61:   15(ivec2) ConvertFToU 60
+              62:   14(fvec4) Load 53(storeTemp)
+                              ImageWrite 59 61 62
+              68:     67(ptr) AccessChain 49(coord) 33
+              69:   13(float) Load 68
+              70:      6(int) ConvertFToU 69
+              71:     67(ptr) AccessChain 49(coord) 32
+              72:   13(float) Load 71
+              73:      6(int) ConvertFToU 72
+              75:     74(ptr) AccessChain 66(rwsb) 25 73
+              76:   14(fvec4) Load 75
+              77:     74(ptr) AccessChain 66(rwsb) 25 70
+                              Store 77 76
                               Return
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.structbuffer.fn.frag.out b/Test/baseResults/hlsl.structbuffer.fn.frag.out
index d8b350d0780b184bf0d64bc99a17b3d24e2d01d4..396ab2010edfc5e90831480514eb6a643d3ab248 100644
--- a/Test/baseResults/hlsl.structbuffer.fn.frag.out
+++ b/Test/baseResults/hlsl.structbuffer.fn.frag.out
@@ -17,7 +17,7 @@ gl_FragCoord origin is upper left
 0:10  Function Definition: set(block--vu4[0]1;u1;vu4; ( temp void)
 0:10    Function Parameters: 
 0:10      'sb' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data})
-0:10      'sb@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:10      'sb@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:10      'bufferOffset' ( in uint)
 0:10      'data' ( in 4-component vector of uint)
 0:?     Sequence
@@ -35,7 +35,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:21      Function Call: set(block--vu4[0]1;u1;vu4; ( temp void)
 0:21        'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data})
-0:21        'sbuf2@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:21        'sbuf2@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:21        Constant:
 0:21          2 (const uint)
 0:21        Function Call: get(block--vu4[0]1;u1; ( temp 4-component vector of uint)
@@ -61,7 +61,7 @@ gl_FragCoord origin is upper left
 0:?   Linker Objects
 0:?     'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data})
 0:?     'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data})
-0:?     'sbuf2@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'sbuf2@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'sbuf3' (layout( binding=12 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 3-component vector of uint @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:?     'pos' (layout( location=0) flat in uint)
@@ -88,7 +88,7 @@ gl_FragCoord origin is upper left
 0:10  Function Definition: set(block--vu4[0]1;u1;vu4; ( temp void)
 0:10    Function Parameters: 
 0:10      'sb' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data})
-0:10      'sb@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:10      'sb@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:10      'bufferOffset' ( in uint)
 0:10      'data' ( in 4-component vector of uint)
 0:?     Sequence
@@ -106,7 +106,7 @@ gl_FragCoord origin is upper left
 0:?     Sequence
 0:21      Function Call: set(block--vu4[0]1;u1;vu4; ( temp void)
 0:21        'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data})
-0:21        'sbuf2@count' ( buffer block{layout( row_major std430) buffer int @count})
+0:21        'sbuf2@count' ( buffer block{layout( row_major std430) buffer uint @count})
 0:21        Constant:
 0:21          2 (const uint)
 0:21        Function Call: get(block--vu4[0]1;u1; ( temp 4-component vector of uint)
@@ -132,7 +132,7 @@ gl_FragCoord origin is upper left
 0:?   Linker Objects
 0:?     'sbuf' (layout( binding=10 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data})
 0:?     'sbuf2' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data})
-0:?     'sbuf2@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'sbuf2@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'sbuf3' (layout( binding=12 row_major std430) readonly buffer block{layout( row_major std430) buffer unsized 1-element array of 3-component vector of uint @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:?     'pos' (layout( location=0) flat in uint)
@@ -155,15 +155,15 @@ gl_FragCoord origin is upper left
                               Name 14  "bufferOffset"
                               Name 18  ""
                               MemberName 18 0  "@data"
-                              Name 21  ""
-                              MemberName 21 0  "@count"
-                              Name 29  "set(block--vu4[0]1;u1;vu4;"
-                              Name 25  "sb"
-                              Name 26  "sb@count"
-                              Name 27  "bufferOffset"
-                              Name 28  "data"
-                              Name 35  "@main(u1;"
-                              Name 34  "pos"
+                              Name 20  ""
+                              MemberName 20 0  "@count"
+                              Name 28  "set(block--vu4[0]1;u1;vu4;"
+                              Name 24  "sb"
+                              Name 25  "sb@count"
+                              Name 26  "bufferOffset"
+                              Name 27  "data"
+                              Name 34  "@main(u1;"
+                              Name 33  "pos"
                               Name 47  "sbuf2"
                               Name 48  "sbuf2@count"
                               Name 50  "sbuf"
@@ -188,7 +188,7 @@ gl_FragCoord origin is upper left
                               Decorate 17 ArrayStride 16
                               MemberDecorate 18 0 Offset 0
                               Decorate 18 BufferBlock
-                              Decorate 21 BufferBlock
+                              Decorate 20 BufferBlock
                               Decorate 47(sbuf2) DescriptorSet 0
                               Decorate 48(sbuf2@count) DescriptorSet 0
                               Decorate 50(sbuf) DescriptorSet 0
@@ -217,28 +217,28 @@ gl_FragCoord origin is upper left
               17:             TypeRuntimeArray 7(ivec4)
               18:             TypeStruct 17
               19:             TypePointer Uniform 18(struct)
-              20:             TypeInt 32 1
-              21:             TypeStruct 20(int)
-              22:             TypePointer Uniform 21(struct)
-              23:             TypePointer Function 7(ivec4)
-              24:             TypeFunction 2 19(ptr) 22(ptr) 11(ptr) 23(ptr)
-              31:             TypeFloat 32
-              32:             TypeVector 31(float) 4
-              33:             TypeFunction 32(fvec4) 11(ptr)
-              37:     20(int) Constant 0
+              20:             TypeStruct 6(int)
+              21:             TypePointer Uniform 20(struct)
+              22:             TypePointer Function 7(ivec4)
+              23:             TypeFunction 2 19(ptr) 21(ptr) 11(ptr) 22(ptr)
+              30:             TypeFloat 32
+              31:             TypeVector 30(float) 4
+              32:             TypeFunction 31(fvec4) 11(ptr)
+              36:             TypeInt 32 1
+              37:     36(int) Constant 0
               39:             TypePointer Uniform 7(ivec4)
        47(sbuf2):     19(ptr) Variable Uniform
- 48(sbuf2@count):     22(ptr) Variable Uniform
+ 48(sbuf2@count):     21(ptr) Variable Uniform
               49:      6(int) Constant 2
         50(sbuf):     10(ptr) Variable Uniform
               51:      6(int) Constant 3
-              57:   31(float) Constant 0
-              58:   32(fvec4) ConstantComposite 57 57 57 57
+              57:   30(float) Constant 0
+              58:   31(fvec4) ConstantComposite 57 57 57 57
               62:             TypePointer Input 6(int)
          63(pos):     62(ptr) Variable Input
-              65:             TypePointer Output 32(fvec4)
+              65:             TypePointer Output 31(fvec4)
 66(@entryPointOutput):     65(ptr) Variable Output
- 70(sbuf2@count):             TypeStruct 20(int)
+ 70(sbuf2@count):             TypeStruct 6(int)
               71:             TypePointer Uniform 70(sbuf2@count)
  72(sbuf2@count):     71(ptr) Variable Uniform
               73:             TypeVector 6(int) 3
@@ -254,7 +254,7 @@ gl_FragCoord origin is upper left
                               Store 61(pos) 64
               68:      6(int) Load 61(pos)
                               Store 67(param) 68
-              69:   32(fvec4) FunctionCall 35(@main(u1;) 67(param)
+              69:   31(fvec4) FunctionCall 34(@main(u1;) 67(param)
                               Store 66(@entryPointOutput) 69
                               Return
                               FunctionEnd
@@ -267,28 +267,28 @@ gl_FragCoord origin is upper left
               41:    7(ivec4) Load 40
                               ReturnValue 41
                               FunctionEnd
-29(set(block--vu4[0]1;u1;vu4;):           2 Function None 24
-          25(sb):     19(ptr) FunctionParameter
-    26(sb@count):     22(ptr) FunctionParameter
-27(bufferOffset):     11(ptr) FunctionParameter
-        28(data):     23(ptr) FunctionParameter
-              30:             Label
-              44:      6(int) Load 27(bufferOffset)
-              45:    7(ivec4) Load 28(data)
-              46:     39(ptr) AccessChain 25(sb) 37 44
+28(set(block--vu4[0]1;u1;vu4;):           2 Function None 23
+          24(sb):     19(ptr) FunctionParameter
+    25(sb@count):     21(ptr) FunctionParameter
+26(bufferOffset):     11(ptr) FunctionParameter
+        27(data):     22(ptr) FunctionParameter
+              29:             Label
+              44:      6(int) Load 26(bufferOffset)
+              45:    7(ivec4) Load 27(data)
+              46:     39(ptr) AccessChain 24(sb) 37 44
                               Store 46 45
                               Return
                               FunctionEnd
-   35(@main(u1;):   32(fvec4) Function None 33
-         34(pos):     11(ptr) FunctionParameter
-              36:             Label
+   34(@main(u1;):   31(fvec4) Function None 32
+         33(pos):     11(ptr) FunctionParameter
+              35:             Label
        52(param):     11(ptr) Variable Function
        54(param):     11(ptr) Variable Function
-       55(param):     23(ptr) Variable Function
+       55(param):     22(ptr) Variable Function
                               Store 52(param) 51
               53:    7(ivec4) FunctionCall 15(get(block--vu4[0]1;u1;) 50(sbuf) 52(param)
                               Store 54(param) 49
                               Store 55(param) 53
-              56:           2 FunctionCall 29(set(block--vu4[0]1;u1;vu4;) 47(sbuf2) 48(sbuf2@count) 54(param) 55(param)
+              56:           2 FunctionCall 28(set(block--vu4[0]1;u1;vu4;) 47(sbuf2) 48(sbuf2@count) 54(param) 55(param)
                               ReturnValue 58
                               FunctionEnd
diff --git a/Test/baseResults/hlsl.structbuffer.incdec.frag.hlslfun1.out b/Test/baseResults/hlsl.structbuffer.incdec.frag.hlslfun1.out
index 9e42ed344bfcb8fb3a5c910f52a7f1529222ad49..b5cb56d3c4b1fdd1b749188a4794832115f75a46 100644
--- a/Test/baseResults/hlsl.structbuffer.incdec.frag.hlslfun1.out
+++ b/Test/baseResults/hlsl.structbuffer.incdec.frag.hlslfun1.out
@@ -23,8 +23,8 @@ hlsl.structbuffer.incdec.frag
                               Name 34  "sbuf_rw_i@count"
                               MemberName 34(sbuf_rw_i@count) 0  "@count"
                               Name 36  "sbuf_rw_i@count"
-                              Name 42  "c2"
-                              Name 43  "sbuf_rw_d@count"
+                              Name 41  "c2"
+                              Name 42  "sbuf_rw_d@count"
                               Name 61  "pos"
                               Name 63  "pos"
                               Name 66  "@entryPointOutput"
@@ -38,14 +38,14 @@ hlsl.structbuffer.incdec.frag
                               MemberDecorate 34(sbuf_rw_i@count) 0 Offset 0
                               Decorate 34(sbuf_rw_i@count) BufferBlock
                               Decorate 36(sbuf_rw_i@count) DescriptorSet 0
-                              Decorate 43(sbuf_rw_d@count) DescriptorSet 0
+                              Decorate 42(sbuf_rw_d@count) DescriptorSet 0
                               Decorate 63(pos) Flat
                               Decorate 63(pos) Location 0
                               DecorateStringGOOGLE 63(pos) DecorationHlslSemanticGOOGLE  "FOO"
                               Decorate 66(@entryPointOutput) Location 0
                               DecorateStringGOOGLE 66(@entryPointOutput) DecorationHlslSemanticGOOGLE  "SV_TARGET0"
                               DecorateId 22(sbuf_rw_i) DecorationHlslCounterBufferGOOGLE 36(sbuf_rw_i@count)
-                              DecorateId 26(sbuf_rw_d) DecorationHlslCounterBufferGOOGLE 43(sbuf_rw_d@count)
+                              DecorateId 26(sbuf_rw_d) DecorationHlslCounterBufferGOOGLE 42(sbuf_rw_d@count)
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeInt 32 0
@@ -70,14 +70,14 @@ hlsl.structbuffer.incdec.frag
               29:      6(int) Constant 2
               30:   14(ivec4) ConstantComposite 29 29 29 29
               31:             TypePointer Uniform 14(ivec4)
-34(sbuf_rw_i@count):             TypeStruct 23(int)
+34(sbuf_rw_i@count):             TypeStruct 6(int)
               35:             TypePointer Uniform 34(sbuf_rw_i@count)
 36(sbuf_rw_i@count):     35(ptr) Variable Uniform
-              37:             TypePointer Uniform 23(int)
-              39:     23(int) Constant 1
-              40:      6(int) Constant 1
-43(sbuf_rw_d@count):     35(ptr) Variable Uniform
-              45:     23(int) Constant 4294967295
+              37:             TypePointer Uniform 6(int)
+              39:      6(int) Constant 1
+42(sbuf_rw_d@count):     35(ptr) Variable Uniform
+              44:      6(int) Constant 4294967295
+              46:     23(int) Constant 4294967295
               62:             TypePointer Input 6(int)
          63(pos):     62(ptr) Variable Input
               65:             TypePointer Output 9(fvec4)
@@ -99,26 +99,26 @@ hlsl.structbuffer.incdec.frag
               13:             Label
       16(result):     15(ptr) Variable Function
           33(c1):      7(ptr) Variable Function
-          42(c2):      7(ptr) Variable Function
+          41(c2):      7(ptr) Variable Function
                               Store 16(result) 18
               32:     31(ptr) AccessChain 27(sbuf_rw_nocounter) 24 28
                               Store 32 30
               38:     37(ptr) AccessChain 36(sbuf_rw_i@count) 24
-              41:      6(int) AtomicIAdd 38 40 17 39
-                              Store 33(c1) 41
-              44:     37(ptr) AccessChain 43(sbuf_rw_d@count) 24
-              46:      6(int) AtomicIAdd 44 40 17 45
-              47:      6(int) IAdd 46 45
-                              Store 42(c2) 47
+              40:      6(int) AtomicIAdd 38 39 17 39
+                              Store 33(c1) 40
+              43:     37(ptr) AccessChain 42(sbuf_rw_d@count) 24
+              45:      6(int) AtomicIAdd 43 39 17 44
+              47:      6(int) IAdd 45 46
+                              Store 41(c2) 47
               48:      7(ptr) AccessChain 16(result) 17
               49:      6(int) Load 48
               50:    8(float) ConvertUToF 49
-              51:      7(ptr) AccessChain 16(result) 40
+              51:      7(ptr) AccessChain 16(result) 39
               52:      6(int) Load 51
               53:    8(float) ConvertUToF 52
               54:      6(int) Load 33(c1)
               55:    8(float) ConvertUToF 54
-              56:      6(int) Load 42(c2)
+              56:      6(int) Load 41(c2)
               57:    8(float) ConvertUToF 56
               58:    9(fvec4) CompositeConstruct 50 53 55 57
                               ReturnValue 58
diff --git a/Test/baseResults/hlsl.structbuffer.incdec.frag.out b/Test/baseResults/hlsl.structbuffer.incdec.frag.out
index c979e05d943314eb413486592f769832b6c31c99..0afea5bf25ffd897bd61787d6c8903ba4c376d55 100644
--- a/Test/baseResults/hlsl.structbuffer.incdec.frag.out
+++ b/Test/baseResults/hlsl.structbuffer.incdec.frag.out
@@ -45,23 +45,23 @@ gl_FragCoord origin is upper left
 0:15        move second child to first child ( temp uint)
 0:15          'c1' ( temp uint)
 0:15          AtomicAdd ( temp uint)
-0:15            @count: direct index for structure ( temp int)
-0:15              'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:15            @count: direct index for structure ( temp uint)
+0:15              'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:15              Constant:
 0:15                0 (const int)
 0:15            Constant:
-0:15              1 (const int)
+0:15              1 (const uint)
 0:16      Sequence
 0:16        move second child to first child ( temp uint)
 0:16          'c2' ( temp uint)
 0:16          add ( temp uint)
 0:16            AtomicAdd ( temp uint)
-0:16              @count: direct index for structure ( temp int)
-0:16                'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:16              @count: direct index for structure ( temp uint)
+0:16                'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:16                Constant:
 0:16                  0 (const int)
 0:16              Constant:
-0:16                -1 (const int)
+0:16                4294967295 (const uint)
 0:16            Constant:
 0:16              -1 (const int)
 0:18      Branch: Return with expression
@@ -92,9 +92,9 @@ gl_FragCoord origin is upper left
 0:?           'pos' ( temp uint)
 0:?   Linker Objects
 0:?     'sbuf_rw_i' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data})
-0:?     'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'sbuf_rw_d' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data})
-0:?     'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:?     'pos' (layout( location=0) flat in uint)
@@ -149,23 +149,23 @@ gl_FragCoord origin is upper left
 0:15        move second child to first child ( temp uint)
 0:15          'c1' ( temp uint)
 0:15          AtomicAdd ( temp uint)
-0:15            @count: direct index for structure ( temp int)
-0:15              'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:15            @count: direct index for structure ( temp uint)
+0:15              'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:15              Constant:
 0:15                0 (const int)
 0:15            Constant:
-0:15              1 (const int)
+0:15              1 (const uint)
 0:16      Sequence
 0:16        move second child to first child ( temp uint)
 0:16          'c2' ( temp uint)
 0:16          add ( temp uint)
 0:16            AtomicAdd ( temp uint)
-0:16              @count: direct index for structure ( temp int)
-0:16                'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:16              @count: direct index for structure ( temp uint)
+0:16                'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:16                Constant:
 0:16                  0 (const int)
 0:16              Constant:
-0:16                -1 (const int)
+0:16                4294967295 (const uint)
 0:16            Constant:
 0:16              -1 (const int)
 0:18      Branch: Return with expression
@@ -196,9 +196,9 @@ gl_FragCoord origin is upper left
 0:?           'pos' ( temp uint)
 0:?   Linker Objects
 0:?     'sbuf_rw_i' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data})
-0:?     'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'sbuf_rw_i@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'sbuf_rw_d' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data})
-0:?     'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer int @count})
+0:?     'sbuf_rw_d@count' (layout( row_major std430) buffer block{layout( row_major std430) buffer uint @count})
 0:?     'sbuf_rw_nocounter' (layout( row_major std430) buffer block{layout( row_major std430) buffer unsized 1-element array of 4-component vector of uint @data})
 0:?     '@entryPointOutput' (layout( location=0) out 4-component vector of float)
 0:?     'pos' (layout( location=0) flat in uint)
@@ -226,8 +226,8 @@ gl_FragCoord origin is upper left
                               Name 34  "sbuf_rw_i@count"
                               MemberName 34(sbuf_rw_i@count) 0  "@count"
                               Name 36  "sbuf_rw_i@count"
-                              Name 42  "c2"
-                              Name 43  "sbuf_rw_d@count"
+                              Name 41  "c2"
+                              Name 42  "sbuf_rw_d@count"
                               Name 61  "pos"
                               Name 63  "pos"
                               Name 66  "@entryPointOutput"
@@ -241,7 +241,7 @@ gl_FragCoord origin is upper left
                               MemberDecorate 34(sbuf_rw_i@count) 0 Offset 0
                               Decorate 34(sbuf_rw_i@count) BufferBlock
                               Decorate 36(sbuf_rw_i@count) DescriptorSet 0
-                              Decorate 43(sbuf_rw_d@count) DescriptorSet 0
+                              Decorate 42(sbuf_rw_d@count) DescriptorSet 0
                               Decorate 63(pos) Flat
                               Decorate 63(pos) Location 0
                               Decorate 66(@entryPointOutput) Location 0
@@ -269,14 +269,14 @@ gl_FragCoord origin is upper left
               29:      6(int) Constant 2
               30:   14(ivec4) ConstantComposite 29 29 29 29
               31:             TypePointer Uniform 14(ivec4)
-34(sbuf_rw_i@count):             TypeStruct 23(int)
+34(sbuf_rw_i@count):             TypeStruct 6(int)
               35:             TypePointer Uniform 34(sbuf_rw_i@count)
 36(sbuf_rw_i@count):     35(ptr) Variable Uniform
-              37:             TypePointer Uniform 23(int)
-              39:     23(int) Constant 1
-              40:      6(int) Constant 1
-43(sbuf_rw_d@count):     35(ptr) Variable Uniform
-              45:     23(int) Constant 4294967295
+              37:             TypePointer Uniform 6(int)
+              39:      6(int) Constant 1
+42(sbuf_rw_d@count):     35(ptr) Variable Uniform
+              44:      6(int) Constant 4294967295
+              46:     23(int) Constant 4294967295
               62:             TypePointer Input 6(int)
          63(pos):     62(ptr) Variable Input
               65:             TypePointer Output 9(fvec4)
@@ -298,26 +298,26 @@ gl_FragCoord origin is upper left
               13:             Label
       16(result):     15(ptr) Variable Function
           33(c1):      7(ptr) Variable Function
-          42(c2):      7(ptr) Variable Function
+          41(c2):      7(ptr) Variable Function
                               Store 16(result) 18
               32:     31(ptr) AccessChain 27(sbuf_rw_nocounter) 24 28
                               Store 32 30
               38:     37(ptr) AccessChain 36(sbuf_rw_i@count) 24
-              41:      6(int) AtomicIAdd 38 40 17 39
-                              Store 33(c1) 41
-              44:     37(ptr) AccessChain 43(sbuf_rw_d@count) 24
-              46:      6(int) AtomicIAdd 44 40 17 45
-              47:      6(int) IAdd 46 45
-                              Store 42(c2) 47
+              40:      6(int) AtomicIAdd 38 39 17 39
+                              Store 33(c1) 40
+              43:     37(ptr) AccessChain 42(sbuf_rw_d@count) 24
+              45:      6(int) AtomicIAdd 43 39 17 44
+              47:      6(int) IAdd 45 46
+                              Store 41(c2) 47
               48:      7(ptr) AccessChain 16(result) 17
               49:      6(int) Load 48
               50:    8(float) ConvertUToF 49
-              51:      7(ptr) AccessChain 16(result) 40
+              51:      7(ptr) AccessChain 16(result) 39
               52:      6(int) Load 51
               53:    8(float) ConvertUToF 52
               54:      6(int) Load 33(c1)
               55:    8(float) ConvertUToF 54
-              56:      6(int) Load 42(c2)
+              56:      6(int) Load 41(c2)
               57:    8(float) ConvertUToF 56
               58:    9(fvec4) CompositeConstruct 50 53 55 57
                               ReturnValue 58
diff --git a/Test/baseResults/spv.ssboAlias.frag.out b/Test/baseResults/spv.ssboAlias.frag.out
index 2ead8764a45138e6ac46e67d7cad8a4ce0b928d7..c507031ee03eb0bc25e7d7bb9a22657b0c95e14e 100755
--- a/Test/baseResults/spv.ssboAlias.frag.out
+++ b/Test/baseResults/spv.ssboAlias.frag.out
@@ -1,12 +1,12 @@
 spv.ssboAlias.frag
 // Module Version 10000
 // Generated by (magic number): 80006
-// Id's are bound by 46
+// Id's are bound by 44
 
                               Capability Shader
                1:             ExtInstImport  "GLSL.std.450"
                               MemoryModel Logical GLSL450
-                              EntryPoint Fragment 4  "main" 43
+                              EntryPoint Fragment 4  "main" 41
                               ExecutionMode 4 OriginUpperLeft
                               Source HLSL 500
                               Name 4  "main"
@@ -17,10 +17,10 @@ spv.ssboAlias.frag
                               Name 18  "Buf1@count"
                               MemberName 18(Buf1@count) 0  "@count"
                               Name 20  "Buf1@count"
-                              Name 30  "Buf2"
-                              Name 31  "Buf2@count"
-                              Name 43  "@entryPointOutput"
-                              Name 45  "Buf3"
+                              Name 28  "Buf2"
+                              Name 29  "Buf2@count"
+                              Name 41  "@entryPointOutput"
+                              Name 43  "Buf3"
                               Decorate 12 ArrayStride 4
                               MemberDecorate 13(Buf1) 0 Offset 0
                               Decorate 13(Buf1) BufferBlock
@@ -30,13 +30,13 @@ spv.ssboAlias.frag
                               Decorate 18(Buf1@count) BufferBlock
                               Decorate 20(Buf1@count) DescriptorSet 0
                               Decorate 20(Buf1@count) Binding 83
-                              Decorate 30(Buf2) DescriptorSet 0
-                              Decorate 30(Buf2) Binding 85
-                              Decorate 31(Buf2@count) DescriptorSet 0
-                              Decorate 31(Buf2@count) Binding 86
-                              Decorate 43(@entryPointOutput) Location 0
-                              Decorate 45(Buf3) DescriptorSet 0
-                              Decorate 45(Buf3) Binding 84
+                              Decorate 28(Buf2) DescriptorSet 0
+                              Decorate 28(Buf2) Binding 85
+                              Decorate 29(Buf2@count) DescriptorSet 0
+                              Decorate 29(Buf2@count) Binding 86
+                              Decorate 41(@entryPointOutput) Location 0
+                              Decorate 43(Buf3) DescriptorSet 0
+                              Decorate 43(Buf3) Binding 84
                2:             TypeVoid
                3:             TypeFunction 2
                6:             TypeFloat 32
@@ -49,40 +49,38 @@ spv.ssboAlias.frag
         15(Buf1):     14(ptr) Variable Uniform
               16:             TypeInt 32 1
               17:     16(int) Constant 0
-  18(Buf1@count):             TypeStruct 16(int)
+  18(Buf1@count):             TypeStruct 11(int)
               19:             TypePointer Uniform 18(Buf1@count)
   20(Buf1@count):     19(ptr) Variable Uniform
-              21:             TypePointer Uniform 16(int)
-              23:     16(int) Constant 1
-              24:     11(int) Constant 1
-              25:     11(int) Constant 0
-              27:     11(int) Constant 10
-              28:             TypePointer Uniform 11(int)
-        30(Buf2):     14(ptr) Variable Uniform
-  31(Buf2@count):     19(ptr) Variable Uniform
-              34:     11(int) Constant 20
-              36:    6(float) Constant 1065353216
-              37:    6(float) Constant 1077936128
-              38:    6(float) Constant 1084227584
-              39:    7(fvec4) ConstantComposite 36 37 38 36
-              42:             TypePointer Output 7(fvec4)
-43(@entryPointOutput):     42(ptr) Variable Output
-        45(Buf3):     14(ptr) Variable Uniform
+              21:             TypePointer Uniform 11(int)
+              23:     11(int) Constant 1
+              24:     11(int) Constant 0
+              26:     11(int) Constant 10
+        28(Buf2):     14(ptr) Variable Uniform
+  29(Buf2@count):     19(ptr) Variable Uniform
+              32:     11(int) Constant 20
+              34:    6(float) Constant 1065353216
+              35:    6(float) Constant 1077936128
+              36:    6(float) Constant 1084227584
+              37:    7(fvec4) ConstantComposite 34 35 36 34
+              40:             TypePointer Output 7(fvec4)
+41(@entryPointOutput):     40(ptr) Variable Output
+        43(Buf3):     14(ptr) Variable Uniform
          4(main):           2 Function None 3
                5:             Label
-              44:    7(fvec4) FunctionCall 9(@main()
-                              Store 43(@entryPointOutput) 44
+              42:    7(fvec4) FunctionCall 9(@main()
+                              Store 41(@entryPointOutput) 42
                               Return
                               FunctionEnd
        9(@main():    7(fvec4) Function None 8
               10:             Label
               22:     21(ptr) AccessChain 20(Buf1@count) 17
-              26:     11(int) AtomicIAdd 22 24 25 23
-              29:     28(ptr) AccessChain 15(Buf1) 17 26
-                              Store 29 27
-              32:     21(ptr) AccessChain 31(Buf2@count) 17
-              33:     11(int) AtomicIAdd 32 24 25 23
-              35:     28(ptr) AccessChain 30(Buf2) 17 33
-                              Store 35 34
-                              ReturnValue 39
+              25:     11(int) AtomicIAdd 22 23 24 23
+              27:     21(ptr) AccessChain 15(Buf1) 17 25
+                              Store 27 26
+              30:     21(ptr) AccessChain 29(Buf2@count) 17
+              31:     11(int) AtomicIAdd 30 23 24 23
+              33:     21(ptr) AccessChain 28(Buf2) 17 31
+                              Store 33 32
+                              ReturnValue 37
                               FunctionEnd
diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp
index 8588a7016f94c1043d61dba32f50d9bcd399d157..c3090e51f97ef565e8a862f0beb38cbb5227032b 100755
--- a/hlsl/hlslParseHelper.cpp
+++ b/hlsl/hlslParseHelper.cpp
@@ -3164,7 +3164,7 @@ bool HlslParseContext::hasStructBuffCounter(const TType& type) const
 void HlslParseContext::counterBufferType(const TSourceLoc& loc, TType& type)
 {
     // Counter type
-    TType* counterType = new TType(EbtInt, EvqBuffer);
+    TType* counterType = new TType(EbtUint, EvqBuffer);
     counterType->setFieldName(intermediate.implicitCounterName);
 
     TTypeList* blockStruct = new TTypeList;
@@ -3216,7 +3216,7 @@ TIntermTyped* HlslParseContext::getStructBufferCounter(const TSourceLoc& loc, TI
     TIntermTyped* index = intermediate.addConstantUnion(0, loc); // index to counter inside block struct
 
     TIntermTyped* counterMember = intermediate.addIndex(EOpIndexDirectStruct, counterVar, index, loc);
-    counterMember->setType(TType(EbtInt));
+    counterMember->setType(TType(EbtUint));
     return counterMember;
 }
 
@@ -3249,7 +3249,7 @@ void HlslParseContext::decomposeStructBufferMethods(const TSourceLoc& loc, TInte
     // Some methods require a hidden internal counter, obtained via getStructBufferCounter().
     // This lambda adds something to it and returns the old value.
     const auto incDecCounter = [&](int incval) -> TIntermTyped* {
-        TIntermTyped* incrementValue = intermediate.addConstantUnion(incval, loc, true);
+        TIntermTyped* incrementValue = intermediate.addConstantUnion(static_cast<unsigned int>(incval), loc, true);
         TIntermTyped* counter = getStructBufferCounter(loc, bufferObj); // obtain the counter member
 
         if (counter == nullptr)