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

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 5 20:48:50 PDT 2021


mkazantsev added a comment.

How much worse does it become if we simply check that `start <= MAX_INT - step` and bail if we can't prove it?



================
Comment at: llvm/include/llvm/Analysis/ScalarEvolution.h:2039
+  /// of "Stride - 1" doesn't overflow.
+  const SCEV *computeBECount(bool IsSigned, const SCEV *End, const SCEV *Start,
+                             const SCEV *Stride);
----------------
I feel it a bit confusing to pass end before start. Reverse order maybe?


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