This is an archive of the discontinued LLVM Phabricator instance.

[SimplifyCFG] Rerun PHI deduplication after common code sinkinkg (PR51092)
ClosedPublic

Authored by lebedev.ri on Jul 14 2021, 1:13 PM.

Details

Summary

SinkCommonCodeFromPredecessors() doesn't itself ensure that duplicate PHI nodes aren't created.
I suppose, we could teach it to do that on-the-fly (& account for the already-existing PHI nodes,
& adjust costmodel), the diff will be bigger than this.

The alternative is to schedule a new EarlyCSE pass invocation somewhere later in the pipeline.
Clearly, we don't have any EarlyCSE runs in module optimization passline, so this pattern isn't cleaned up...
That would perhaps better, but it will again have some compile time impact.

Diff Detail

Event Timeline

lebedev.ri created this revision.Jul 14 2021, 1:13 PM
lebedev.ri requested review of this revision.Jul 14 2021, 1:13 PM
lebedev.ri edited the summary of this revision. (Show Details)Jul 14 2021, 1:17 PM
xbolva00 added a subscriber: xbolva00.EditedJul 14 2021, 1:18 PM

The alternative is to schedule a new EarlyCSE pass invocation somewhere later in the pipeline.
Clearly, we don't have any EarlyCSE runs in module optimization passline, so this pattern isn't cleaned up...

Maybe slowly we gather more and more motivation cases to justify another run of CSE? As https://reviews.llvm.org/rG57bb4787d72f1ae64f877b05c98d506602ac5958 pointed out, 0.26% CT regression is not so bad, I think it is OK.

I remember this PR where another CSE run would help as well.
https://bugs.llvm.org/show_bug.cgi?id=42755

Adjust checklines in one more test.

RKSimon accepted this revision.Jul 15 2021, 1:02 AM

LGTM as a stopgap until we can decide what to do about additional CSE runs - cheers

llvm/lib/Transforms/Utils/SimplifyCFG.cpp
6735

Add comment to explain why the early out?

llvm/test/Transforms/PhaseOrdering/X86/earlycse-after-simplifycfg-two-entry-phi-node-folding.ll
7–9

Please can you mention PR51092 in a comment here? It helps with quick triage without git log/blame trawling.

This revision is now accepted and ready to land.Jul 15 2021, 1:02 AM

LGTM as a stopgap until we can decide what to do about additional CSE runs - cheers

Thank you for the review!

This revision was landed with ongoing or failed builds.Jul 15 2021, 6:35 AM
This revision was automatically updated to reflect the committed changes.