This is an alternative to https://reviews.llvm.org/D57103.
The issue at hand is that the base rewriting algorithm doesn't consider the fact that GEPs can turn a scalar input into a vector of outputs. We had handling for scalar GEPs and fully vector GEPs (i.e. all vector operands), but not the scalar-base + vector-index forms. A true fix here requires treating GEP analogously to extractelement or shufflevector.
This patch is merely a workaround. It simply hides the crash at the cost of some ugly code gen for this presumable very rare pattern.
do you think it makes sense to add an assert here as the else part:
Btw, this property is also verified in the IRVerifier when we come across a vector GEP (vector GEP is one where *any* of the GEP operands is a vector type).