diff options
author | Craig Topper <craig.topper@intel.com> | 2018-08-13 00:38:27 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@intel.com> | 2018-08-13 00:38:27 +0000 |
commit | 8bb49218bc9d8db373890df3c07f871e5b20f83b (patch) | |
tree | c16804b296f92b3d504931556296a87e3d362584 /llvm/lib | |
parent | 3b2a17bd1d9cbd7e433a570ba44182710474b0d0 (diff) | |
download | bcm5719-llvm-8bb49218bc9d8db373890df3c07f871e5b20f83b.tar.gz bcm5719-llvm-8bb49218bc9d8db373890df3c07f871e5b20f83b.zip |
[InstCombine] Replace call to haveNoCommonBitsSet in visitXor with just the special case that doesn't use computeKnownBits.
Summary: computeKnownBits is expensive. The cases that would be detected by the computeKnownBits portion of haveNoCommonBitsSet were already handled by the earlier call to SimplifyDemandedInstructionBits.
Reviewers: spatel, lebedev.ri
Reviewed By: lebedev.ri
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D50604
llvm-svn: 339531
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index 8bca658ce43..e36057907c1 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -2507,9 +2507,15 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) { if (Value *V = SimplifyBSwap(I, Builder)) return replaceInstUsesWith(I, V); - // A^B --> A|B iff A and B have no bits set in common. Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1); - if (haveNoCommonBitsSet(Op0, Op1, DL, &AC, &I, &DT)) + + // Fold (X & M) ^ (Y & ~M) -> (X & M) | (Y & ~M) + // This it a special case in haveNoCommonBitsSet, but the commputeKnownBits + // calls in there are unnecessary as SimplifyDemandedInstructionBits should + // have already taken care of those cases. + Value *M; + if (match(&I, m_c_Xor(m_c_And(m_Not(m_Value(M)), m_Value()), + m_c_And(m_Deferred(M), m_Value())))) return BinaryOperator::CreateOr(Op0, Op1); // Apply DeMorgan's Law for 'nand' / 'nor' logic with an inverted operand. |