[all-commits] [llvm/llvm-project] 259649: [RDA] Avoid full reprocessing of blocks in loops (...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Tue Apr 7 08:57:14 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 259649a51982d0ea6fdbaa62a87e802c9a8a86d2
https://github.com/llvm/llvm-project/commit/259649a51982d0ea6fdbaa62a87e802c9a8a86d2
Author: Nikita Popov <nikita.ppv at gmail.com>
Date: 2020-04-07 (Tue, 07 Apr 2020)
Changed paths:
M llvm/include/llvm/CodeGen/ReachingDefAnalysis.h
M llvm/lib/CodeGen/ReachingDefAnalysis.cpp
Log Message:
-----------
[RDA] Avoid full reprocessing of blocks in loops (NFCI)
RDA sometimes needs to visit blocks twice, to take into account
reaching defs coming in along loop back edges. Currently it handles
repeated visitation the same way as usual, which means that it will
scan through all instructions and their reg unit defs again. Not
only is this very inefficient, it also means that all reaching defs
in loops are going to be inserted twice.
We can do much better than this. The only thing we need to handle
is a new reaching def from a predecessor, which either needs to be
prepended to the reaching definitions (if there was no reaching def
from a predecessor), or needs to replace an existing predecessor
reaching def, if it is more recent. Since D77508 we only store the
most recent predecessor reaching def, so that's the only one that
may need updating.
This also has the nice side-effect that reaching definitions are
now automatically sorted and unique, so drop the llvm::sort() call
in favor of an assertion.
Differential Revision: https://reviews.llvm.org/D77511
More information about the All-commits
mailing list