This is an archive of the discontinued LLVM Phabricator instance.

[LoopLoadElim] Form simplify form by demand
AbandonedPublic

Authored by mkazantsev on Apr 8 2020, 5:57 AM.

Details

Summary

The LoopLoadElim pass effectively didn't work in the new PM,
because unlike the old pass manager, it never bothered to simplify loops
before it starts working. As result, at some point it tried to get a loop
preheader, and it might not exist, which lead to crash (fixed as D77775).
Old pass manager, on other hand, was requesting simplification of all
loops before the run, potentially doing redundant work.

This patch unifies operation in both pass managers. Now neither of them
requests simplification of all loops before the run. Instead, it simplifies
loop by itself when it thinks it's necessary.

It also enables all tests run in both pipelines and makes sure they
produce equivalent results.

Diff Detail

Event Timeline

mkazantsev created this revision.Apr 8 2020, 5:57 AM
mkazantsev retitled this revision from [LoopLoadElim] Fix null preheader bug in new pipeline to [LoopLoadElim] Fix null preheader bug in new pass manager.Apr 8 2020, 5:59 AM
mkazantsev edited the summary of this revision. (Show Details)
mkazantsev edited the summary of this revision. (Show Details)

Looks good to me, though I would like somebody else to check if running loopSimplify instead of simply bailing out is appropriate here.

mkazantsev marked an inline comment as done.Apr 8 2020, 8:56 PM

I'm not sure either. I can make 1st patch that just fixes the crash with bailout and then rebase this one on top of it.

I made conservative fix D77775. Let's merge it and then consider this one as improvement.

mkazantsev retitled this revision from [LoopLoadElim] Fix null preheader bug in new pass manager to [LoopLoadElim] Form simplify form by demand.Apr 9 2020, 7:48 PM
mkazantsev edited the summary of this revision. (Show Details)
mkazantsev abandoned this revision.Sep 24 2020, 3:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 24 2020, 3:01 AM