[PATCH] D13686: [SCEV] Teach SCEV some axioms about non-wrapping arithmetic

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 14 12:26:16 PDT 2015


reames added inline comments.

================
Comment at: include/llvm/Analysis/ScalarEvolution.h:579
@@ -578,1 +578,3 @@
 
+    /// Try to prove the condition described by "LHS Pred RHS" by ruling out
+    /// certain kinds of overflow.
----------------
The naming of this seems really odd.  Possibly: ViaIntegerFacts?

"certian kinds of overflow" is confusing in the comment.  

================
Comment at: lib/Analysis/ScalarEvolution.cpp:7177
@@ +7176,3 @@
+
+  auto MatchBinaryAdd = [this](const SCEV *Result, const SCEV *X, APInt &OutY,
+                               SCEV::NoWrapFlags ExpectedFlags) {
----------------
A comment explaining what this matches would help.  

================
Comment at: lib/Analysis/ScalarEvolution.cpp:7199
@@ +7198,3 @@
+  case ICmpInst::ICMP_SLE:
+    // X s<= (X + C)<nsw> if C >= 0
+    if (MatchBinaryAdd(RHS, LHS, C, SCEV::FlagNSW) && C.isNonNegative())
----------------
Notation wise: X s<= (X +<nsw> C) if C >= 0 would be far more clear.


http://reviews.llvm.org/D13686





More information about the llvm-commits mailing list