[PATCH] Teach ScalarEvolution to exploit min and max expressions.

David Majnemer david.majnemer at gmail.com
Thu Dec 11 20:51:02 PST 2014


================
Comment at: lib/Analysis/ScalarEvolution.cpp:6982
@@ +6981,3 @@
+
+  for (unsigned i = 0, e = MaxExpr->getNumOperands(); i != e; i++) {
+    const SCEV *Difference = SE.getMinusSCEV(Candidate, MaxExpr->getOperand(i));
----------------
Might be more concise as:
  for (const SCEV *Operand : MaxExpr)
    const SCEV *Difference = SE.getMinusSCEV(Candidate, Operand);

================
Comment at: lib/Analysis/ScalarEvolution.cpp:7004-7006
@@ +7003,5 @@
+        SE, MaybeMaxExpr, SE.getNotSCEV(Candidate));
+  else
+    return IsMaxConsistingOf<SCEVUMaxExpr>(
+        SE, MaybeMaxExpr, SE.getNotSCEV(Candidate));
+}
----------------
This seems contrary to http://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return

================
Comment at: lib/Analysis/ScalarEvolution.cpp:7015-7016
@@ +7014,4 @@
+                                      const SCEV *LHS, const SCEV *RHS) {
+  switch (Pred) {
+    default:
+      return false;
----------------
I thought case labels should be at the same indentation level as the switch.

http://reviews.llvm.org/D6635

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list