[all-commits] [llvm/llvm-project] 5a3a39: [LoopCacheAnalysis] Guard against bit-width overfl...
Amy Kwan via All-commits
all-commits at lists.llvm.org
Fri Oct 2 21:22:00 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 5a3a399c2773bf4d86413e1855f6be2cf35da8af
https://github.com/llvm/llvm-project/commit/5a3a399c2773bf4d86413e1855f6be2cf35da8af
Author: Amy Kwan <amy.kwan1 at ibm.com>
Date: 2026-10-03 (Sat, 03 Oct 2026)
Changed paths:
M llvm/lib/Analysis/LoopCacheAnalysis.cpp
A llvm/test/Analysis/LoopCacheAnalysis/nestedloop-cost.ll
Log Message:
-----------
[LoopCacheAnalysis] Guard against bit-width overflow in computeRefCost (#224427)
In `computeRefCost()`, the non-consecutive access path estimates the
cache cost by multiplying the trip counts across outer loop dimensions.
Each multiplication ends up calling `getExtendedType()` to obtain an
integer type twice as wide as the current one.
For a deeply-nested loop (such as the 20-dimensional array found in this
change), it is possible for the doubling to exceed `MAX_INT_BITS`, which
triggers the following assert in `IntegerType::get()`.
```
Assertion failed: NumBits <= MAX_INT_BITS && "bitwidth too large", file llvm-project/llvm/lib/IR/Type.cpp, line 340, static IntegerType *llvm::IntegerType::get(LLVMContext &, unsigned int)()
```
This change checks whether the current integer width already exceeds
`MAX_INT_BITS / 2`. If this is true, the doubled width would overflow,
so we return `CacheCostTy::getInvalid()` instead of asserting.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list