[PATCH] D121953: [NewPM] Don't skip SCCs not in current RefSCC

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 14:18:35 PDT 2022


aeubanks created this revision.
Herald added a subscriber: hiraditya.
Herald added a reviewer: ctetreau.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

With D107249 <https://reviews.llvm.org/D107249> I saw huge compile time regressions on a module (150s ->
5700s). This turned out to be due to a huge RefSCC in
the module. As we ran the function simplification pipeline on functions
in the SCCs in the RefSCC, some of those SCCs would be split out to
their RefSCC, a child of the current RefSCC. We'd skip the remaining
SCCs in the huge RefSCC because the current RefSCC is now the RefSCC
just split out, then revisit the original huge RefSCC from the
beginning.  This happened many times because many functions in the
RefSCC were optimizable to the point of becoming their own RefSCC.

This patch makes it so we don't skip SCCs not in the current RefSCC so
that we split out all the child RefSCCs on the first iteration of
RefSCC. We

For example, in the newly added test cgscc-refscc-mutation-order.ll,
we'd previously run instcombine in this order:
f1, f2, f1, f3, f1, f4, f1

Now it's:
f1, f2, f3, f4, f1

This can cause more runs in some specific cases, e.g. if f1<->f2 gets
optimized to f1<-f2, we'd previously run f1, f2;
now we run f1, f2, f2.

We can see that this improves kimwitu++ by a lot (12-15% for various -O3 configs):
https://llvm-compile-time-tracker.com/compare.php?from=2371c5a0e06d22b48da0427cebaf53a5e5c54635&to=00908f1d67400cab1ad7bcd7cacc7558d1672e97&stat=instructions


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121953

Files:
  llvm/include/llvm/Analysis/CGSCCPassManager.h
  llvm/lib/Analysis/CGSCCPassManager.cpp
  llvm/test/Other/cgscc-refscc-mutation-order.ll
  llvm/test/Transforms/Inline/cgscc-cycle-debug.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121953.416318.patch
Type: text/x-patch
Size: 6482 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220317/2687e5ae/attachment.bin>


More information about the llvm-commits mailing list