Reimplement (part of) the or -> add optimization. Matching 'or' into 'add'
authorChris Lattner <sabre@nondot.org>
Thu, 7 Oct 2010 23:36:18 +0000 (23:36 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 7 Oct 2010 23:36:18 +0000 (23:36 +0000)
commit122e2ea043918c77ebdd8936875f14282503d60f
tree8fe97cc6a32d3dda896a11236dc5b8265a6e7804
parent0253df9a897ce541d56146699cedd79c464bda5e
Reimplement (part of) the or -> add optimization.  Matching 'or' into 'add'
is general goodness because it allows ORs to be converted to LEA to avoid
inserting copies.  However, this is bad because it makes the generated .s
file less obvious and gives valgrind heartburn (tons of false positives in
bitfield code).

While the general fix should be in valgrind, we can at least try to avoid
emitting ADD instructions that *don't* get promoted to LEA.  This is more
work because it requires introducing pseudo instructions to represents
"add that knows the bits are disjoint", but hey, people really love valgrind.

This fixes this testcase:
https://bugs.kde.org/show_bug.cgi?id=242137#c20

the add r/i cases are coming next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116007 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86InstrCompiler.td
lib/Target/X86/X86InstrInfo.cpp
lib/Target/X86/X86InstrInfo.td
lib/Target/X86/X86MCInstLower.cpp