Make constant folding for GEPs a bit more aggressive.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146639 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eli Friedman
2011-12-15 04:33:48 +00:00
parent ca072a3977
commit adeb0a6e64
2 changed files with 6 additions and 3 deletions

View File

@@ -2209,7 +2209,7 @@ static Constant *ConstantFoldGetElementPtrImpl(Constant *C,
I != E; ++I)
LastTy = *I;
if ((LastTy && LastTy->isArrayTy()) || Idx0->isNullValue()) {
if ((LastTy && isa<SequentialType>(LastTy)) || Idx0->isNullValue()) {
SmallVector<Value*, 16> NewIndices;
NewIndices.reserve(Idxs.size() + CE->getNumOperands());
for (unsigned i = 1, e = CE->getNumOperands()-1; i != e; ++i)