[PATCH] D49519: [RegisterCoalescer] Delay live interval update work until the rematerialization for all the uses from the same def is done

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 18 16:30:28 PDT 2018


wmi created this revision.
wmi added reviewers: qcolombet, MatzeB.

We run into a compile time problem with flex generated code combined with `-fno-jump-tables`. The cause is that machineLICM hoists a lot of invariants outside of a big loop, and drastically increases the compile time in global register splitting and copy coalescing.  https://reviews.llvm.org/D49353 relieves the problem in global splitting. This patch is to handle the problem in copy coalescing.

About the situation where the problem in copy coalescing happens. After machineLICM, we have several defs outside of a big loop with hundreds or thousands of uses inside the loop. Rematerialization in copy coalescing happens for each use and everytime rematerialization is done, shrinkToUses will be called to update the huge live interval. Because we have 'n' uses for a def, and each live interval update will have at least 'n' complexity, the total update work is n^2.

To fix the problem, we try to do the live interval update work in a collective way. If a def has many copylike uses larger than a threshold, each time rematerialization is done for one of those uses, we won't do the live interval update in time but delay that work until rematerialization for all those uses are completed, so we only have to do the live interval update work once.

Delaying the live interval update could potentially change the copy coalescing result, so we hope to limit that change to those defs with many (like above a hundred) copylike uses.

I am running internal performance testing at the same time. I also run stress testing using clang bootstrap by setting the threshold to 0, i.e., delay all the live interval update work after rematerialization, and it passes.


Repository:
  rL LLVM

https://reviews.llvm.org/D49519

Files:
  lib/CodeGen/RegisterCoalescer.cpp
  test/CodeGen/X86/late-remat-update.mir

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49519.156173.patch
Type: text/x-patch
Size: 10892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180718/6f935202/attachment.bin>


More information about the llvm-commits mailing list