Subzero: Fix the name mangling code's base-36 increment.

SZZZ_ was being incremented to S0000_ instead of S1000_.

BUG= https://codereview.chromium.org/385273002/
R=wala@chromium.org

Review URL: https://codereview.chromium.org/390533002
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index 50ac5bd..a7b1b64 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -166,9 +166,10 @@
         assert(OldName[OldPos - 1] == 'S');
         assert(OldName[OldPos + Length] == '_');
         if (AllZs) {
-          // Replace N 'Z' characters with N+1 '0' characters.  (This
-          // is also true for N=0, i.e. S_ ==> S0_ .)
-          for (size_t i = 0; i < Length + 1; ++i) {
+          // Replace N 'Z' characters with a '0' (if N=0) or '1' (if
+          // N>0) followed by N '0' characters.
+          NewName[NewPos++] = (Length ? '1' : '0');
+          for (size_t i = 0; i < Length; ++i) {
             NewName[NewPos++] = '0';
           }
         } else {
diff --git a/tests_lit/llvm2ice_tests/mangle.ll b/tests_lit/llvm2ice_tests/mangle.ll
index 4271244..8373d1c 100644
--- a/tests_lit/llvm2ice_tests/mangle.ll
+++ b/tests_lit/llvm2ice_tests/mangle.ll
@@ -105,14 +105,14 @@
 ; Test for substitution incrementing.  This single test captures:
 ;   S<num>_ ==> S<num+1>_ for single-digit <num>
 ;   S_ ==> S0_
-;   String length increase, e.g. SZZZ_ ==> S0000_
+;   String length increase, e.g. SZZZ_ ==> S1000_
 ;   At least one digit wrapping without length increase, e.g. SZ9ZZ_ ==> SZA00_
 ;   Unrelated identifiers containing S[0-9A-Z]* , e.g. MyClassS1x
 ;   A proper substring of S<num>_ at the end of the string
 ;     (to test parser edge cases)
 
 define internal void @_Z3fooP10MyClassS1xP10MyClassS2xRS_RS1_S_S1_SZZZ_SZ9ZZ_S12345() {
-; MANGLE:   _ZN7Subzero3fooEP10MyClassS1xP10MyClassS2xRS0_RS2_S0_S2_S0000_SZA00_S12345:
+; MANGLE:   _ZN7Subzero3fooEP10MyClassS1xP10MyClassS2xRS0_RS2_S0_S2_S1000_SZA00_S12345:
 entry:
   ret void
 }