This is an archive of the discontinued LLVM Phabricator instance.

[LoopUnrolling] Try harder to avoid rebuilding LCSSA when possible.
ClosedPublic

Authored by mzolotukhin on Feb 2 2016, 7:49 PM.

Details

Summary

In r255133 (reapplied r253126) we started to avoid redundant recomputation of LCSSA after loop-unrolling. This patch moves one step further in this direction - now we can avoid it for much wider range of loops, as we start to look at IR and try to figure out if the transformation actually breaks LCSSA phis or makes it necessary to insert new ones.

In future we might go even further and try to fix LCSSA in-place rather than rebuilding it, but I'm not quite sure yet that it's always possible (and computationally cheaper). Anyway, this patch seems to be aligned with that direction.

One of the most important use-cases that previous implementation didn't handle is loops with calls that might throw an exception. Such loops have exits from entire loop nest, but we still don't need to recompute LCSSA after unrolling, as such exits usually don't contain LCSSA phis.

The patch was tested on LNT testsuite + SPECS, neither failures nor significant compile time changes were spotted.

Diff Detail

Event Timeline

mzolotukhin updated this revision to Diff 46734.Feb 2 2016, 7:49 PM
mzolotukhin retitled this revision from to [LoopUnrolling] Try harder to avoid rebuilding LCSSA when possible..
mzolotukhin updated this object.
mzolotukhin added a subscriber: llvm-commits.

The previous patch: D14526.

mzolotukhin updated this revision to Diff 46842.Feb 3 2016, 2:40 PM
  • Address Justin's remarks.
mehdi_amini added inline comments.Feb 3 2016, 3:08 PM
lib/Transforms/Utils/LoopUnroll.cpp
516

A one-line comment may be welcome :)

mzolotukhin updated this revision to Diff 46858.Feb 3 2016, 5:43 PM
  • Add a comment per Mehdi's request.
mzolotukhin marked an inline comment as done.Feb 3 2016, 5:45 PM
This revision was automatically updated to reflect the committed changes.