aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Transforms/InstCombine/InstructionCombining.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp
index 8802ba4..066b2ec 100644
--- a/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -915,13 +915,12 @@ 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)
+ // We do not handle pointer-vector geps here.
+ if (!StrippedPtrTy)
return 0;
- PointerType *StrippedPtrTy = dyn_cast<PointerType>(StrippedPtr->getType());
-
if (StrippedPtr != PtrOp &&
StrippedPtrTy->getAddressSpace() == GEP.getPointerAddressSpace()) {