aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/Module.cpp
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-02-20 22:42:42 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-02-27 18:45:59 +0100
commit4ef272ec9c5f737b8d63a3cc8870d8d63bf0385e (patch)
tree0b5418043a8fef9f8c02069bedcf182d1b6fce0b /clang/lib/Basic/Module.cpp
parent75d4d4bd028f6a5f24ef41dbbc45bed65b2305cf (diff)
downloadllvm-4ef272ec9c5f737b8d63a3cc8870d8d63bf0385e.zip
llvm-4ef272ec9c5f737b8d63a3cc8870d8d63bf0385e.tar.gz
llvm-4ef272ec9c5f737b8d63a3cc8870d8d63bf0385e.tar.bz2
[InstCombine] DCE instructions earlier
When InstCombine initially populates the worklist, it already performs constant folding and DCE. However, as the instructions are initially visited in program order, this DCE can pick up only the last instruction of a dead chain, the rest would only get picked up in the main InstCombine run. To avoid this, we instead perform the DCE in separate pass over the collected instructions in reverse order, which will allow us to pick up full dead instruction chains. We already need to do this reverse iteration anyway to populate the worklist, so this shouldn't add extra cost. This by itself only fixes a small part of the problem though: The same basic issue also applies during the main InstCombine loop. We generally always want DCE to occur as early as possible, because it will allow one-use folds to happen. Address this by also performing DCE while adding deferred instructions to the main worklist. This drops the number of tests that perform more than 2 InstCombine iterations from ~80 to ~40. There's some spurious test changes due to operand order / icmp toggling. Differential Revision: https://reviews.llvm.org/D75008
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
0 files changed, 0 insertions, 0 deletions