diff options
author | Sanjay Patel <spatel@rotateright.com> | 2016-12-11 20:07:02 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2016-12-11 20:07:02 +0000 |
commit | 81ed3499cdf61dcf3cfb426de24f4f406bd04b0f (patch) | |
tree | 8db3592c665f7d0a1f0a8083a09a00398031f442 /llvm/lib | |
parent | 7c98a79f7beedbfe09b2ede8e44fdcf1fcf2536d (diff) | |
download | bcm5719-llvm-81ed3499cdf61dcf3cfb426de24f4f406bd04b0f.tar.gz bcm5719-llvm-81ed3499cdf61dcf3cfb426de24f4f406bd04b0f.zip |
[Constants] don't die processing non-ConstantInt GEP indices in isGEPWithNoNotionalOverIndexing() (PR31262)
This should fix:
https://llvm.org/bugs/show_bug.cgi?id=31262
llvm-svn: 289401
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 6a6820234a0..a3db1525931 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -1071,13 +1071,15 @@ bool ConstantExpr::isGEPWithNoNotionalOverIndexing() const { gep_type_iterator GEPI = gep_type_begin(this), E = gep_type_end(this); User::const_op_iterator OI = std::next(this->op_begin()); - // The remaining indices must be compile-time known integers within the - // bounds of the corresponding notional static array types. + // The remaining indices may be compile-time known integers within the bounds + // of the corresponding notional static array types. for (; GEPI != E; ++GEPI, ++OI) { - ConstantInt *CI = dyn_cast<ConstantInt>(*OI); - if (GEPI.isBoundedSequential() && - (CI->getValue().getActiveBits() > 64 || - CI->getZExtValue() >= GEPI.getSequentialNumElements())) + if (isa<UndefValue>(*OI)) + continue; + auto *CI = dyn_cast<ConstantInt>(*OI); + if (!CI || (GEPI.isBoundedSequential() && + (CI->getValue().getActiveBits() > 64 || + CI->getZExtValue() >= GEPI.getSequentialNumElements()))) return false; } |