This is an archive of the discontinued LLVM Phabricator instance.

Fix LCSSA increased compile time
ClosedPublic

Authored by xur on Aug 9 2016, 11:58 PM.

Details

Summary

We are seeing r276077 drastically increasing compiler time for our larger benchmarks in PGO profile generation build (both clang based and IR based mode) -- it can be 20x slower than without the patch (like from 30 secs to 780 secs)

The increased time are all in pass LCSSA. The problematic code is about PostProcessPHIs after use-rewrite. Note that the InsertedPhis from ssa_updater is accumulating (never been cleared). Since the inserted PHIs are added to the candidate for each rewrite, The earlier ones will be repeatedly added. Later when adding the new PHIs to the work-list, we don't check the duplication either. This can result in extremely long work-list that containing tons of duplicated PHIs.

This attached patch fixes the issue by hoisting the code out of the loop.

Diff Detail

Repository
rL LLVM

Event Timeline

xur updated this revision to Diff 67466.Aug 9 2016, 11:58 PM
xur retitled this revision from to Fix LCSSA increased compile time.
xur updated this object.
xur added a reviewer: mzolotukhin.
xur added subscribers: xur, davidxl, llvm-commits.
mzolotukhin accepted this revision.Aug 10 2016, 12:48 AM
mzolotukhin edited edge metadata.

Looks good to me, thanks!

This revision is now accepted and ready to land.Aug 10 2016, 12:48 AM
This revision was automatically updated to reflect the committed changes.