[llvm] [InstCombine] Avoid Allocating Arrays Too Large For the Target (PR #70980)
Qiongsi Wu via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 2 06:48:47 PDT 2023
================
@@ -210,14 +210,23 @@ static Instruction *simplifyAllocaArraySize(InstCombinerImpl &IC,
if (const ConstantInt *C = dyn_cast<ConstantInt>(AI.getArraySize())) {
if (C->getValue().getActiveBits() <= 64) {
Type *NewTy = ArrayType::get(AI.getAllocatedType(), C->getZExtValue());
+
+ // Make sure we do not create an array type larger than pointers on the
+ // target can index.
+ unsigned MaxArrSizeBitWidth =
+ IC.getDataLayout().getPointerTypeSizeInBits(AI.getType());
----------------
qiongsiwu wrote:
Thanks Matt! Fixed.
https://github.com/llvm/llvm-project/pull/70980
More information about the llvm-commits
mailing list