[LoopUnroll] Directly update DT instead of DTU.
authorFlorian Hahn <flo@fhahn.com>
Thu, 19 Jan 2023 18:10:51 +0000 (18:10 +0000)
committerFlorian Hahn <flo@fhahn.com>
Thu, 19 Jan 2023 18:11:54 +0000 (18:11 +0000)
commitd0907ce7ed9f159562ca3f4cfd8d87e89e93febe
treed035d381ae35f5c04a28f30de7250f9e59284d8b
parent1d98861a7896236895d467f7e7ab4eadf7dffd82
[LoopUnroll] Directly update DT instead of DTU.

The scope of DT updates are very limited when unrolling loops: the DT
should only need updating for
* new blocks added
* exiting blocks we simplified branches

This can be done manually without too much extra work.
MergeBlockIntoPredecessor also needs to be updated to support direct
DT updates.

This fixes excessive time spent in DTU for same cases. In an internal
example, time spent in LoopUnroll with this patch goes from ~200s to 2s.

It also is slightly positive for CTMark:
* NewPM-O3: -0.13%
* NewPM-ReleaseThinLTO: -0.11%
* NewPM-ReleaseLTO-g: -0.13%

Notable improvements are mafft (~ -0.50%) and lencod (~ -0.30%), with no
workload regressed.

https://llvm-compile-time-tracker.com/compare.php?from=78a9ee7834331fb4360457cc565fa36f5452f7e0&to=687e08d011b0dc6d3edd223612761e44225c7537&stat=instructions:u

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D141487
llvm/include/llvm/Transforms/Utils/BasicBlockUtils.h
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
llvm/lib/Transforms/Utils/LoopUnroll.cpp