Hi Tim and other reviewers,
When lowing shuffle vector, there is a function called isEXTMask to check whether we can optimize it into a EXT. But that function misses on situation, as a result it will generate incorrect indexed EXT.
It considers about the mask starts with UNDEFs as following:
<-1, -1, 3, ...> means that an EXT must start at 3 - 2 = 1,
But if there are too many UNDEFs, such as <-1, -1, -1, 1, ...>, the index counter will be overflowed into a very large unsigned int (i.e. unsigned Imm = 1 - 3).
This patch fixes this bug. To make it looks more simpler, it also adjust the position of logic about operands traverse. Review please.
Thanks,
-Hao