[PATCH] D147868: [SCEV] Strengthen huge constant trip multiples.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 9 11:26:46 PDT 2023


efriedma added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:8248
+  // Guard against huge trip multiples (this requires checking for zero to
+  // handle the case where the trip count == -1 and the addition wraps).
   assert(Result && "SCEVConstant expected to have non-null ConstantInt");
----------------
If the Result is zero, countTrailingZeros() will return the bitwidth of the integer, I think, which doesn't match the comment.

I don't think the wrapping thing can actually happen since D110587 was merged, though, so we shouldn't see a trip count of zero.  So maybe update the comment while you're here.

(Maybe it's theoretically possible that some combination of folding could end up folding a poison trip count to zero.  In that case, though, it wouldn't really matter what multiple we return.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147868



More information about the llvm-commits mailing list