Index: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -3330,8 +3330,9 @@ if (CI->isZero()) continue; APInt Offs = ElementSize * CI->getValue().sextOrTrunc(PtrSize); + LLVMContext &Context = *DAG.getContext(); SDValue OffsVal = VectorWidth ? - DAG.getConstant(Offs, dl, MVT::getVectorVT(PtrTy, VectorWidth)) : + DAG.getConstant(Offs, dl, EVT::getVectorVT(Context, PtrTy, VectorWidth)) : DAG.getConstant(Offs, dl, PtrTy); // In an inbouds GEP with an offset that is nonnegative even when Index: test/CodeGen/X86/gep-expanded-vector.ll =================================================================== --- test/CodeGen/X86/gep-expanded-vector.ll +++ test/CodeGen/X86/gep-expanded-vector.ll @@ -0,0 +1,10 @@ +; RUN: llc < %s -O2 -mcpu=skx + +%struct.S1 = type { %struct.S1*, %struct.S1* } + +define void @malloc_init_state() unnamed_addr { +entry: + %VectorGep7 = getelementptr inbounds %struct.S1*, <64 x %struct.S1**> undef, i64 -2 + ret void +} +