[llvm-commits] [llvm] r153465 - /llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp

Nadav Rotem nadav.rotem at intel.com
Mon Mar 26 13:39:18 PDT 2012


Author: nadav
Date: Mon Mar 26 15:39:18 2012
New Revision: 153465

URL: http://llvm.org/viewvc/llvm-project?rev=153465&view=rev
Log:
PR12357: The pointer was used before it was checked.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp?rev=153465&r1=153464&r2=153465&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstructionCombining.cpp Mon Mar 26 15:39:18 2012
@@ -915,11 +915,13 @@
 
   // 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()) {
 





More information about the llvm-commits mailing list