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 | e63e59cc44ea513d1df05141c53b9b9241e1f815 (patch) | |
| tree | 4cb14eb7bb8f6652eb537c45bf636270695dd1ce /llvm/lib | |
| parent | 6da64f39d44161636d2aa9f8512f74324cd69110 (diff) | |
| download | bcm5719-llvm-e63e59cc44ea513d1df05141c53b9b9241e1f815.tar.gz bcm5719-llvm-e63e59cc44ea513d1df05141c53b9b9241e1f815.zip | |
PR12357: The pointer was used before it was checked.
llvm-svn: 153465
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 349ba83961c..8802ba448e7 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/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()) { |

