[PATCH] D153638: [CodeGenPrepare][NFC] Update the dominator tree instead of rebuilding it

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 5 09:19:31 PDT 2023


chill added a comment.

Update:

- now we use a DT from the optimisation pipeline, instead of building a new one in the pass
- made applying DT updates even lazier - they are accumulated in a lazy `DomTreeUpdater` and applied when/if the DT is requested by a transform (and also at the end of the pass, when the updated is destructed).
- some more transforms are made to update the DT
- one extra rebuild of the DT removed

On CTMark with LTO, measuring only the final link step, wall-clock time and instruction count, I get:

|                  | Time   | Inst   |
| 7zip             | -0.32% | -0.18% |
| bullet           | 0.15%  | -0.12% |
| clamav           | -0.61% | -0.14% |
| consumer-typeset | -0.06% | -0.07% |
| kc               | -0.41% | -0.31% |
| lencod           | -0.29% | -0.05% |
| mafft            | 0.34%  | -0.06% |
| spass            | -0.08% | -0.11% |
| sqlite           | 0.06%  | -0.11% |
| tramp3d          | -0.14% | -0.14% |
|

or -0.14%/-0.13% geomean, respectively.



================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:586
   LI->releaseMemory();
-  LI->analyze(getDT(F));
+  LI->analyze(*DT);
 
----------------
nikic wrote:
> Would it be hard to also preserve the DT though the handful of transforms above? If we did that, we could directly use the DT from the pass manager, and also preserve it afterwards as well.
Done, mostly.
For `eliminateMostlyEmptyBlocks`  and `SplitIndirectBrCriticalEdges` it's not entirely apparent how to update the DT/LI, so I just rebuild it 
of those transforms made changes.


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

https://reviews.llvm.org/D153638



More information about the llvm-commits mailing list