[llvm] [SLSR] Skip candidate-basis differences when `SCEVUnknown`s differ (NFC) (PR #217451)
Justin Fargnoli via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 19:34:15 PDT 2026
justinfargnoli wrote:
> It would also be great if you could share some statistics showing the compile-time improvements in real cases.
@Chengjunp, the motivating use case came from a change to an internal unrolling heuristic that caused a loop to be fully unrolled when it previously wasn't. The IR the unrolled loop produced caused SLSR to take 401 seconds. With this patch, it takes 27 seconds on my local machine.
> The extra cache makes me a bit uneasy
To motivate adding a cache, although I understand your comment is pointing out something different, SLSR processes the problematic IR without a cache in 80 seconds compared to 27 seconds with the cache.
Compile time data:
| Configuration | SLSR wall time (s) |
|---|---:|
| Baseline | 401 |
| `computeConstantDifference()` | 127 |
| `SCEVUnknown` filter without cache | 80|
| `SCEVUnknown` filter with cache | 27 |
---
> I don't really see any reason to store the cache on ScalarEvolution; might as well just keep it in SLSR itself.
@efriedma-quic, done.
https://github.com/llvm/llvm-project/pull/217451
More information about the llvm-commits
mailing list