[SimplifyCFG] Rerun PHI deduplication after common code sinkinkg (PR51092)
authorRoman Lebedev <lebedev.ri@gmail.com>
Thu, 15 Jul 2021 13:25:36 +0000 (16:25 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Thu, 15 Jul 2021 13:34:34 +0000 (16:34 +0300)
commit3e6c383dc63685a6248fd6f1ffabad0b42af99a0
treee87b8952aaefec5f5160e5f3eb3634dde45c353b
parent74b88807ae761da3ae1d5eb947d242a3492e23d0
[SimplifyCFG] Rerun PHI deduplication after common code sinkinkg (PR51092)

`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.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D106010
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/PGOProfile/cspgo_profile_summary.ll
llvm/test/Transforms/PhaseOrdering/X86/earlycse-after-simplifycfg-two-entry-phi-node-folding.ll
llvm/test/Transforms/SimplifyCFG/X86/sink-common-code.ll