[llvm] r301021 - [InstCombine] use isSubsetOf() for efficiency
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 21 12:16:53 PDT 2017
Author: spatel
Date: Fri Apr 21 14:16:52 2017
New Revision: 301021
URL: http://llvm.org/viewvc/llvm-project?rev=301021&view=rev
Log:
[InstCombine] use isSubsetOf() for efficiency
C | ~D == -1
~(C | ~D) == 0
~C & D == 0
D & ~C == 0
D.isSubsetOf(C)
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp?rev=301021&r1=301020&r2=301021&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp Fri Apr 21 14:16:52 2017
@@ -282,7 +282,7 @@ Value *InstCombiner::SimplifyDemandedUse
// combining, SCEV, and codegen.
const APInt *C;
if (match(I->getOperand(1), m_APInt(C)) && !C->isAllOnesValue()) {
- if ((*C | ~DemandedMask).isAllOnesValue()) {
+ if (DemandedMask.isSubsetOf(*C)) {
// Force bits to 1 to create a 'not' op.
I->setOperand(1, ConstantInt::getAllOnesValue(VTy));
return I;
More information about the llvm-commits
mailing list