It doesn't matter what the 2nd operand is; if the GEP has 2 operands and
authorBrian Gaeke <gaeke@uiuc.edu>
Tue, 6 Jul 2004 19:24:47 +0000 (19:24 +0000)
committerBrian Gaeke <gaeke@uiuc.edu>
Tue, 6 Jul 2004 19:24:47 +0000 (19:24 +0000)
the first is a zero, we should leave it alone.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14648 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp

index bcd0f78aba2685b8a1620b894ca58d2050a134b2..72e537a7dcd49f44bf6f0f2e953269dfa47e39b0 100644 (file)
@@ -83,8 +83,7 @@ static inline bool isZeroConst (Value *V) {
 bool llvm::DecomposeArrayRef(GetElementPtrInst* GEP) {
   if (GEP->getNumIndices() < 2
       || (GEP->getNumIndices() == 2
-          && isZeroConst(GEP->getOperand(1))
-          && isa<ConstantInt>(GEP->getOperand(2)))) {
+          && isZeroConst(GEP->getOperand(1)))) {
     DEBUG (std::cerr << "DecomposeArrayRef: Skipping " << *GEP);
     return false;
   } else {