[llvm-commits] [llvm] r62046 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner sabre at nondot.org
Sun Jan 11 12:23:52 PST 2009


Author: lattner
Date: Sun Jan 11 14:23:52 2009
New Revision: 62046

URL: http://llvm.org/viewvc/llvm-project?rev=62046&view=rev
Log:
do not generated GEPs into vectors where they don't already exist.
We should treat vectors as atomic types, not like arrays.

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

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=62046&r1=62045&r2=62046&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sun Jan 11 14:23:52 2009
@@ -7739,13 +7739,12 @@
       
       Offset -= SL->getElementOffset(Elt);
       Ty = STy->getElementType(Elt);
-    } else if (isa<ArrayType>(Ty) || isa<VectorType>(Ty)) {
-      const SequentialType *STy = cast<SequentialType>(Ty);
-      uint64_t EltSize = TD->getABITypeSize(STy->getElementType());
+    } else if (const ArrayType *AT = dyn_cast<ArrayType>(Ty)) {
+      uint64_t EltSize = TD->getABITypeSize(AT->getElementType());
       assert(EltSize && "Cannot index into a zero-sized array");
       NewIndices.push_back(ConstantInt::get(IntPtrTy,Offset/EltSize));
       Offset %= EltSize;
-      Ty = STy->getElementType();
+      Ty = AT->getElementType();
     } else {
       // Otherwise, we can't index into the middle of this atomic type, bail.
       return false;





More information about the llvm-commits mailing list