[PATCH] D28158: [SCEV] limit recursion depth and operands number in getAddExpr

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 8 14:35:31 PST 2017


hfinkel added a comment.

> added threshold for inlining addition operands (the same way as it's already implemented for multiplication operands inlining)

What do you mean exactly? getMulExpr does not have a depth parameter like this. We have a comparison depth limit and a depth limit on SimplifyICmpOperands.



================
Comment at: include/llvm/Analysis/ScalarEvolution.h:1160
+    SmallVector<const SCEV *, 2> Ops = {LHS, RHS};
+    return getAddExpr(Ops, SCEV::FlagAnyWrap, Depth + 1);
+  }
----------------
Increasing the depth here does not seem right - it is not a real recursion, but just a simple convenience wrapper.


================
Comment at: include/llvm/Analysis/ScalarEvolution.h:1171
     SmallVector<const SCEV *, 3> Ops = {Op0, Op1, Op2};
-    return getAddExpr(Ops, Flags);
+    return getAddExpr(Ops, Flags, Depth+1);
   }
----------------
Same here.


https://reviews.llvm.org/D28158





More information about the llvm-commits mailing list