[PATCH] D33984: [ScalarEvolution] Apply Depth limit to getMulExpr

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 14 23:04:16 PDT 2017


sanjoy accepted this revision.
sanjoy added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: lib/Analysis/ScalarEvolution.cpp:2630
+                                    SCEV::NoWrapFlags Flags) {
+FoldingSetNodeID ID;
+  ID.AddInteger(scMulExpr);
----------------
Indent looks off?


================
Comment at: lib/Analysis/ScalarEvolution.cpp:2860
         }
-      return getMulExpr(Ops);
+      return getMulExpr(Ops, SCEV::FlagAnyWrap, Depth + 1);
     }
----------------
Something worth considering (no need to change in this patch) -- should we be incrementing `Depth` on tail calls like these where there is no real recursion?


https://reviews.llvm.org/D33984





More information about the llvm-commits mailing list