[SeparateConstOffsetFromGEP] make two tests more strict

inbounds are not necessary in these two tests. zext(a +nuw b) = zext(a) +
zext(b) should hold with or without inbounds.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210437 91177308-0d34-0410-b5e6-96231b3b80d8
Refactor canonicalizing array indices to a helper function

No functionality changes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210438 91177308-0d34-0410-b5e6-96231b3b80d8
[SeparateConstOffsetFromGEP] Fix an illegitimate optimization on zext

zext(a + b) != zext(a) + zext(b) even if a + b >= 0 && b >= 0.

e.g., a = i4 0b1111, b = i4 0b0001
zext a + b to i8 = zext 0b0000 to i8 = 0b00000000
(zext a to i8) + (zext b to i8) = 0b00001111 + 0b00000001 = 0b00010000


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210439 91177308-0d34-0410-b5e6-96231b3b80d8