]> granicus.if.org Git - llvm/commit
[TargetLowering] add special-case for demanded bits analysis of 'not'
authorSanjay Patel <spatel@rotateright.com>
Mon, 5 Dec 2016 15:58:21 +0000 (15:58 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 5 Dec 2016 15:58:21 +0000 (15:58 +0000)
commitbb03f57f04083e85f64c6e65fd050f9db3272e96
tree0c20b206fd1a7749d276e435f4a72c107ae44be7
parentda70d5a32a83f370626b72c085e82908b90f1798
[TargetLowering] add special-case for demanded bits analysis of 'not'

We treat bitwise 'not' as a special operation and try not to reduce its all-ones mask.
Presumably, this is because a 'not' may be cheaper than a generic 'xor' or it may get
folded into another logic op if the target has those. However, if we can remove a logic
instruction by changing the xor's constant mask value, that should always be a win.

Note that the IR version of SimplifyDemandedBits() does not treat 'not' as a special-case
currently (although that's marked with a FIXME). So if you run this IR through -instcombine,
you should get the same end result. I'm hoping to add a different backend transform that
will expose this problem though, so I need to solve this first.

Differential Revision: https://reviews.llvm.org/D27356

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288676 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/TargetLowering.cpp
test/CodeGen/X86/not-and-simplify.ll