forked from OSchip/llvm-project
PR12357: The pointer was used before it was checked.
llvm-svn: 153465
This commit is contained in:
parent
6da64f39d4
commit
e63e59cc44
|
@ -915,11 +915,13 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) {
|
|||
|
||||
// Handle gep(bitcast x) and gep(gep x, 0, 0, 0).
|
||||
Value *StrippedPtr = PtrOp->stripPointerCasts();
|
||||
PointerType *StrippedPtrTy = dyn_cast<PointerType>(StrippedPtr->getType());
|
||||
|
||||
// We do not handle pointer-vector geps here
|
||||
if (!StrippedPtr)
|
||||
return 0;
|
||||
|
||||
PointerType *StrippedPtrTy = dyn_cast<PointerType>(StrippedPtr->getType());
|
||||
|
||||
if (StrippedPtr != PtrOp &&
|
||||
StrippedPtrTy->getAddressSpace() == GEP.getPointerAddressSpace()) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue