[PATCH] D14481: [SCEV] Simplify adds to a canonical sum of product

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 7 12:57:18 PST 2015


sanjoy created this revision.
sanjoy added reviewers: hfinkel, atrick.
sanjoy added a subscriber: llvm-commits.
Herald added a subscriber: sanjoy.

This change teaches SCEV to simplify add expressions that contain
multiplications to a sum of products representation, and use the
resulting simplified expression if that simplifies to a constant.

This was motivated by PR25170, but I think simplifying to a canonical
form is a good idea in general for consistency.  However, I'm not a 100%
sure that this is a good idea with respect to compile time -- the core
recursive simplification logic has exponential complexity in the number
of SCEVMulExpr's it creates.  Perhaps we should cap the depth (or some
other metric) to avoid the truly bad cases here?

In the future this can probably be extended to contruction of
multiplication expressions as well.

http://reviews.llvm.org/D14481

Files:
  lib/Analysis/ScalarEvolution.cpp
  test/CodeGen/PowerPC/pr25170.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14481.39642.patch
Type: text/x-patch
Size: 9273 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151107/7efdace4/attachment.bin>


More information about the llvm-commits mailing list