[PATCH] D137505: [SCEV] Cache ZExt SCEV expressions.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 08:07:27 PST 2022


fhahn updated this revision to Diff 481283.
fhahn marked an inline comment as done.
fhahn added a comment.



In D137505#3978188 <https://reviews.llvm.org/D137505#3978188>, @nikic wrote:

> In D137505#3977595 <https://reviews.llvm.org/D137505#3977595>, @nikic wrote:
>
>> My main thought here was that a forwarding node would avoid the need to do two folding set lookups, and should also avoid the need for the separate FoldID.
>
> For what it's worth, I roughly sketched out what I had in mind here: https://github.com/llvm/llvm-project/commit/b158b70df1bb49036da8312a76f0b54de6466f7f This causes a change in incorrect-
> exit-count.ll though, so probably it's not right.

Thanks for sharing! I went ahead and cleaned up the code in my patch a bit, with an early exit if the entry is cached and only add the resulting SCEV to the cache if it is not a SCEVZeroExtendExpr.

This improves the compile-time impact a bit further:
https://llvm-compile-time-tracker.com/compare.php?from=bf9de7464946c65f488fe86ea61bfdecb8c654c1&to=5ac0108553992fb3d58bc27b1518e8cf06658a32&stat=instructions:u


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137505/new/

https://reviews.llvm.org/D137505

Files:
  llvm/include/llvm/Analysis/ScalarEvolution.h
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/test/Analysis/ScalarEvolution/pr58402-large-number-of-zext-exprs.ll
  llvm/test/Transforms/IndVarSimplify/AArch64/widen-loop-comp.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137505.481283.patch
Type: text/x-patch
Size: 28445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221208/ade96981/attachment.bin>


More information about the llvm-commits mailing list