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

Daniil Fukalov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 29 07:42:29 PST 2016


dfukalov created this revision.
dfukalov added a reviewer: sanjoy.
dfukalov added a subscriber: llvm-commits.
Herald added a subscriber: mzolotukhin.

for a quite big function with source like

  %add = add nsw i32 %mul, %conv
  %mul1 = mul nsw i32 %add, %conv
  %add2 = add nsw i32 %mul1, %add
  %mul3 = mul nsw i32 %add2, %add
  ; repeat couple of thousands times

that can be produced by loop unroll, getAddExpr() tries to recursively construct SCEV and runs almost infinite time.

1. implemented recursion depth restriction parameter
2. added threshold for inlining addition operands (the same way as it's already implemented for multiplication operands inlining)


https://reviews.llvm.org/D28158

Files:
  include/llvm/Analysis/ScalarEvolution.h
  lib/Analysis/ScalarEvolution.cpp
  unittests/Analysis/ScalarEvolutionTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28158.82670.patch
Type: text/x-patch
Size: 31360 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161229/887c271b/attachment.bin>


More information about the llvm-commits mailing list