[PATCH] D29759: [SCEV] Cache results during GetMinTrailingZeros query

Igor Laevsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 9 06:56:42 PST 2017


igor-laevsky created this revision.
Herald added a subscriber: mzolotukhin.

This fixes bug 18606.

In certain cases we may get exponentially sized SCEV's in the form of:
S0 = InitialValue
S1 = mul S0 S0
S2 = mul S1 S1
S3 = mul S2 S2

Naively visiting every expression will result in the exponential complexity. However by adding caching layer we can simplify this and achieve linear complexity.

Note that caching doesn't protect us from other forms of the exponentially sized SCEV's. In order to not run infinite compiles in those cases I will add separate threshold in the follow up change.


https://reviews.llvm.org/D29759

Files:
  lib/Analysis/ScalarEvolution.cpp
  test/Analysis/ScalarEvolution/pr18606_min_zeroes.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29759.87798.patch
Type: text/x-patch
Size: 8883 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170209/d983e431/attachment.bin>


More information about the llvm-commits mailing list