[InstCombine] Support (X | C1) & C2 --> (X & C2^(C1&C2)) | (C1&C2) for vector splats
authorCraig Topper <craig.topper@intel.com>
Mon, 7 Aug 2017 18:10:39 +0000 (18:10 +0000)
committerCraig Topper <craig.topper@intel.com>
Mon, 7 Aug 2017 18:10:39 +0000 (18:10 +0000)
commit7091a743b41d531ffcce207cca2439b3567271a2
tree63cfaec53fbcaa29d2fc5f1ec72defb85205426b
parentb0d208a0abdfedf12dd981453620a7a01d3e076f
[InstCombine] Support (X | C1) & C2 --> (X & C2^(C1&C2)) | (C1&C2) for vector splats

Note the original code I deleted incorrectly listed this as (X | C1) & C2 --> (X & C2^(C1&C2)) | C1 Which is only valid if C1 is a subset of C2. This relied on SimplifyDemandedBits to remove any extra bits from C1 before we got to that code.

My new implementation avoids relying on that behavior so that it can be naively verified with alive.

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

llvm-svn: 310272
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/test/Transforms/InstCombine/or.ll