[PATCH] D105216: [ScalarEvolution] Fix overflow in computeBECount.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 7 20:24:39 PDT 2021


efriedma updated this revision to Diff 357123.
efriedma added a comment.

Spent some more time on this.

I discovered that some of the checks were not really necessary.  I think I must have added a check, then didn't realize it became unnecessary as I added other checks.  So it's down to three relatively straightforward checks.  We can re-add the other checks if we discover practical cases where they're necessary.

I rewrote the power-of-two proof; hopefully makes it more clear that it's actually correct.  And I clarified the signed vs. unsigned on the other checks.

Separated out getUDivCeilSCEV() as a separate function.  Makes this patch a little easier to read, and hopefully the general utility  is useful for other cases in the future.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105216

Files:
  llvm/include/llvm/Analysis/ScalarEvolution.h
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/test/Analysis/ScalarEvolution/2008-11-18-Stride1.ll
  llvm/test/Analysis/ScalarEvolution/2008-11-18-Stride2.ll
  llvm/test/Analysis/ScalarEvolution/trip-count-unknown-stride.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105216.357123.patch
Type: text/x-patch
Size: 14950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210708/6c7d1535/attachment.bin>


More information about the llvm-commits mailing list