1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

PR12357: The pointer was used before it was checked.

llvm-svn: 153465
This commit is contained in:
Nadav Rotem 2012-03-26 20:39:18 +00:00
parent a7e2266fa7
commit 165c8a3432

View File

@ -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()) {