@@ -8167,6 +8167,10 @@ static bool passingValueIsAlwaysUndefined(Value *V, Instruction *I, bool PtrValu
81678167 // Look through GEPs. A load from a GEP derived from NULL is still undefined
81688168 if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(User))
81698169 if (GEP->getPointerOperand () == I) {
8170+ // The type of GEP may differ from the type of base pointer.
8171+ // Bail out on vector GEPs, as they are not handled by other checks.
8172+ if (GEP->getType ()->isVectorTy ())
8173+ return false ;
81708174 // The current base address is null, there are four cases to consider:
81718175 // getelementptr (TY, null, 0) -> null
81728176 // getelementptr (TY, null, not zero) -> may be modified
@@ -8178,10 +8182,6 @@ static bool passingValueIsAlwaysUndefined(Value *V, Instruction *I, bool PtrValu
81788182 NullPointerIsDefined (GEP->getFunction (),
81798183 GEP->getPointerAddressSpace ())))
81808184 PtrValueMayBeModified = true ;
8181- // The type of GEP may differ from the type of base pointer.
8182- if (V->getType () != GEP->getType ())
8183- V = ConstantVector::getSplat (
8184- cast<VectorType>(GEP->getType ())->getElementCount (), C);
81858185 return passingValueIsAlwaysUndefined (V, GEP, PtrValueMayBeModified);
81868186 }
81878187
0 commit comments