[PATCH] D84108: [SimplifyCFG][LoopRotate] SimplifyCFG: disable common instruction hoisting by default, enable late in pipeline

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 05:29:56 PDT 2020


lebedev.ri added subscribers: ebrevnov, asbirlea, Prazek.
lebedev.ri added a comment.

In D84108#2160881 <https://reviews.llvm.org/D84108#2160881>, @lebedev.ri wrote:

> In D84108#2160869 <https://reviews.llvm.org/D84108#2160869>, @lebedev.ri wrote:
>
> > In D84108#2160496 <https://reviews.llvm.org/D84108#2160496>, @lebedev.ri wrote:
> >
> > > In D84108#2160494 <https://reviews.llvm.org/D84108#2160494>, @nikic wrote:
> > >
> > > > > this does regress compile-time by +0.5% geomean (unsurprizingly)
> > > >
> > > > FWIW, a large part of the regressions seems to come down to a single file that regresses big time:
> > > >
> > > > > CMakeFiles/lencod.dir/context_ini.c.o 	3917M 	7067M (+80.41%)
> > > >
> > > > Probably worth taking a look whether that can be mitigated.
> > >
> > >
> > > Thanks, i will take a look, just really wanted to finally post this after two dry-runs due to the rG0fdcca07ad2c0bdc2cdd40ba638109926f4f513b <https://reviews.llvm.org/rG0fdcca07ad2c0bdc2cdd40ba638109926f4f513b>/rG8d487668d09fb0e4e54f36207f07c1480ffabbfd <https://reviews.llvm.org/rG8d487668d09fb0e4e54f36207f07c1480ffabbfd> :)
> >
> >
> > I presently don't know what is actually going on, but [old] GVN is to blame there, it goes from
>
>
> It appears that `IsValueFullyAvailableInBlock()` is at fault here, which is only called from `PerformLoadPRE()`, which is only called from `processNonLocalLoad()`.
>  Not yet sure what specifically is going wrong yet.


Rewrote it (D84181 <https://reviews.llvm.org/D84181>), sadly that wasn't it.
Here's the IR before GVN, without/with this patch: F12379909: lencod-context_ini-pre-gvn-old.ll.xz <https://reviews.llvm.org/F12379909> F12379911: lencod-context_ini-pre-gvn-new.ll.xz <https://reviews.llvm.org/F12379911>
The slowdown of `-gvn` on that input is observable:

  $ /builddirs/llvm-project/build-Clang10-Release/bin/opt -gvn -time-passes /tmp/lencod-context_ini-pre-gvn-old.bc -o /dev/null 2>&1 | grep "Global Value Numbering"
     0.0911 ( 87.0%)   0.0008 ( 77.1%)   0.0920 ( 86.9%)   0.0920 ( 86.9%)  Global Value Numbering
  $ /builddirs/llvm-project/build-Clang10-Release/bin/opt -gvn -time-passes /tmp/lencod-context_ini-pre-gvn-new.bc -o /dev/null 2>&1 | grep "Global Value Numbering"
     0.7440 ( 98.1%)   0.0001 ( 90.3%)   0.7441 ( 98.1%)   0.7441 ( 98.1%)  Global Value Numbering

As it can be observed via various means, we were originally doing 54 `lvm::GVN::PerformLoadPRE()`,
and now do 286, i.e. 5.2x, which is not that far off from 8x time regression..
We seem to be spending all the time in `llvm::MemoryDependenceResults::getNonLocalPointerDepFromBB()`.
Nothing really immediately stands out to me there i'm afraid..
Maybe someone more familiar with that analysis can spot the (preexisting) issue, if there is one.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84108/new/

https://reviews.llvm.org/D84108





More information about the llvm-commits mailing list