diff options
author | Nadav Rotem <nadav.rotem@intel.com> | 2012-03-26 20:39:18 +0000 |
---|---|---|
committer | Nadav Rotem <nadav.rotem@intel.com> | 2012-03-26 20:39:18 +0000 |
commit | c71108b6f843f39d4a305e6d351e4a2be4f604b2 (patch) | |
tree | f6240f3dea405e731eeba5bd6afaf61ce0ebaebd /lib/Transforms/InstCombine | |
parent | 05fecbe42e835b30274a7b38af27687a8abbd114 (diff) | |
download | external_llvm-c71108b6f843f39d4a305e6d351e4a2be4f604b2.zip external_llvm-c71108b6f843f39d4a305e6d351e4a2be4f604b2.tar.gz external_llvm-c71108b6f843f39d4a305e6d351e4a2be4f604b2.tar.bz2 |
PR12357: The pointer was used before it was checked.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153465 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine')
-rw-r--r-- | lib/Transforms/InstCombine/InstructionCombining.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/InstCombine/InstructionCombining.cpp b/lib/Transforms/InstCombine/InstructionCombining.cpp index 349ba83..8802ba4 100644 --- a/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -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()) { |