[PATCH] D58995: [CGP] Avoid repeatedly building DominatorTree causing long compile-time (NFC)

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 13:20:14 PST 2019


tejohnson created this revision.
tejohnson added a reviewer: spatel.
Herald added a subscriber: jdoerfert.
Herald added a project: LLVM.

In r354298 a DominatorTree construction was added via new function
combineToUSubWithOverflow, which was subsequently restructured into
replaceMathCmpWithIntrinsic in r354689. We are hitting a very long
compile time due to this repeated construction, once per math cmp in
the function.

We shouldn't need to build the DominatorTree more than once per
function, except when a transformation invalidates it. There is already
a boolean flag that is returned from these methods indicating whether
the DT has been modified. We can simply build the DT once per
Function walk in CodeGenPrepare::runOnFunction, since any time a change
is made we break out of the Function walk and restart it.

I modified the code so that both replaceMathCmpWithIntrinsic as well as
mergeSExts (which was also building a DT) use the DT constructed by the
run method.


Repository:
  rL LLVM

https://reviews.llvm.org/D58995

Files:
  lib/CodeGen/CodeGenPrepare.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58995.189395.patch
Type: text/x-patch
Size: 7116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190305/e10da981/attachment.bin>


More information about the llvm-commits mailing list