llvm with tablegen backend for capstone disassembler
Go to file
Hal Finkel 2bb61ba2fe [BDCE] Add a bit-tracking DCE pass
BDCE is a bit-tracking dead code elimination pass. It is based on ADCE (the
"aggressive DCE" pass), with the added capability to track dead bits of integer
valued instructions and remove those instructions when all of the bits are
dead.

Currently, it does not actually do this all-bits-dead removal, but rather
replaces the instruction's uses with a constant zero, and lets instcombine (and
the later run of ADCE) do the rest. Because we essentially get a run of ADCE
"for free" while tracking the dead bits, we also do what ADCE does and removes
actually-dead instructions as well (this includes instructions newly trivially
dead because all bits were dead, but not all such instructions can be removed).

The motivation for this is a case like:

int __attribute__((const)) foo(int i);
int bar(int x) {
  x |= (4 & foo(5));
  x |= (8 & foo(3));
  x |= (16 & foo(2));
  x |= (32 & foo(1));
  x |= (64 & foo(0));
  x |= (128& foo(4));
  return x >> 4;
}

As it turns out, if you order the bit-field insertions so that all of the dead
ones come last, then instcombine will remove them. However, if you pick some
other order (such as the one above), the fact that some of the calls to foo()
are useless is not locally obvious, and we don't remove them (without this
pass).

I did a quick compile-time overhead check using sqlite from the test suite
(Release+Asserts). BDCE took ~0.4% of the compilation time (making it about
twice as expensive as ADCE).

I've not looked at why yet, but we eliminate instructions due to having
all-dead bits in:
External/SPEC/CFP2006/447.dealII/447.dealII
External/SPEC/CINT2006/400.perlbench/400.perlbench
External/SPEC/CINT2006/403.gcc/403.gcc
MultiSource/Applications/ClamAV/clamscan
MultiSource/Benchmarks/7zip/7zip-benchmark

llvm-svn: 229462
2015-02-17 01:36:59 +00:00
clang [Objctive-C sema]. Do not do the unused-getter-return-value 2015-02-16 23:49:44 +00:00
clang-tools-extra Fix broken logic for include in block check. 2015-02-13 23:32:08 +00:00
compiler-rt [ASan/Win] Add an OOM test 2015-02-16 15:24:20 +00:00
debuginfo-tests New round of fixes for "Always compile debuginfo-tests for the host triple" 2014-10-18 23:47:59 +00:00
libclc Implement log10 2015-01-30 18:00:34 +00:00
libcxx Implement C++14's sized deallocation functions, since there are no longer implicitly defined by clang, as of r229241. 2015-02-15 05:18:55 +00:00
libcxxabi Do not add -fno-exceptions without -funwind-tables 2015-02-16 19:51:06 +00:00
lld [Mips] Replace a magic number by enumeration 2015-02-16 23:08:20 +00:00
lldb Handle trailing spaces on "settings set" command more correctly 2015-02-16 13:13:39 +00:00
llgo Build cgo and llgo-go 2015-02-14 01:46:01 +00:00
llvm [BDCE] Add a bit-tracking DCE pass 2015-02-17 01:36:59 +00:00
openmp Fixed memory corruption problem. 2015-02-10 20:10:21 +00:00
polly Update to isl 99d53692ba 2015-02-16 19:33:40 +00:00