[ForwardOpTree] Support synthesizable values.
commit1b7efd0a0d7f02a54959e7f631cbe59eb6afbd96
authorMichael Kruse <llvm@meinersbur.de>
Mon, 31 Jul 2017 19:46:21 +0000 (31 19:46 +0000)
committerMichael Kruse <llvm@meinersbur.de>
Mon, 31 Jul 2017 19:46:21 +0000 (31 19:46 +0000)
treedb4f31023006510961e64f8071461ccfef4d75be
parent73be624e440c2bbb11a1a5545b5a74d9358986c4
[ForwardOpTree] Support synthesizable values.

This allows -polly-optree to move instructions that depend on
synthesizable values.

The difficulty for synthesizable values is that their value depends on
the location. When it is moved over a loop header, and the SCEV
expression depends on the loop induction variable (SCEVAddRecExpr), it
would use the current induction variable instead of the last one.

At the moment we cannot forward PHI nodes such that crossing the header
of loops referenced by SCEVAddRecExpr is not possible (assuming the loop
header has at least two incoming blocks: for entering the loop and the
backedge, such any instruction to be forwarded must have a phi between
use and definition).

A remaining issue is when the forwarded value is used after the loop,
but is only synthesizable inside the loop. This happens e.g. if
ScalarEvolution is unable to determine the number of loop iterations or
the initial loop value. We do not forward in this situation.

Differential Revision: https://reviews.llvm.org/D36102

git-svn-id: https://llvm.org/svn/llvm-project/polly/trunk@309609 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transform/ForwardOpTree.cpp
test/ForwardOpTree/forward_synthesizable_definloop.ll [new file with mode: 0644]
test/ForwardOpTree/forward_synthesizable_indvar.ll [new file with mode: 0644]
test/ForwardOpTree/forward_synthesizable_useinloop.ll [new file with mode: 0644]
test/ForwardOpTree/noforward_synthesizable.ll [deleted file]
test/ForwardOpTree/noforward_synthesizable_unknownit.ll [new file with mode: 0644]