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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 13 14:10:19 PDT 2021


efriedma added a comment.

The general formula for the backedge-taken count can be written, in arbitrary-precision arithmetic, as something like `floor(max(End - Start + Stride - 1, 0) / Stride)`, I think.  We could define a function to compute that, I guess, separate from howManyLessThans, and optimize based on that.

Granted, that's basically just taking this patch, and shoving the code into a different function.  But it might be easier to reason about future changes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D105216



More information about the llvm-commits mailing list