This is an archive of the discontinued LLVM Phabricator instance.

[Polly][ForwardOpTree] Support synthesizable values.
ClosedPublic

Authored by Meinersbur on Jul 31 2017, 12:28 PM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

Meinersbur created this revision.Jul 31 2017, 12:28 PM
grosser accepted this revision.Jul 31 2017, 12:32 PM

LGTM

lib/Transform/ForwardOpTree.cpp
154 ↗(On Diff #108970)

TAKE care OF

158 ↗(On Diff #108970)

synthesisable

This revision is now accepted and ready to land.Jul 31 2017, 12:32 PM
This revision was automatically updated to reflect the committed changes.
polly/trunk/test/ForwardOpTree/forward_synthesizable_useinloop.ll