[PATCH] D88015: [SCEV] Support unsigned predicates in isKnownPredicateViaNoOverflow

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 02:37:47 PDT 2020


mkazantsev added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:9302-9303
+  case ICmpInst::ICMP_ULE:
+    // X u<= (X + C)<nuw> for any C
+    if (MatchBinaryAddToConst(RHS, LHS, C, SCEV::FlagNUW))
+      return true;
----------------
lebedev.ri wrote:
> It is unclear how much it matters in practice, but
> i don't think `C` needs to be a constant,
> which means that we only need to check that RHS is an `NUW` `SCEVAddExpr`, and that
> `any_of(AE->operands(), [L](SCEV*Op){ return Op == L; })`.
I think such cases are handled in different aux functions of `isKnownViaNonRecursiveReasoning`. This one is specifically for constant offset.


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

https://reviews.llvm.org/D88015



More information about the llvm-commits mailing list