mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-26 18:20:39 +00:00
InstCombine: Clean up foldLogOpOfMaskedICmps
No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222229 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -766,18 +766,16 @@ static Value* foldLogOpOfMaskedICmps(ICmpInst *LHS, ICmpInst *RHS, bool IsAnd,
|
|||||||
// with B and D, having a single bit set
|
// with B and D, having a single bit set
|
||||||
ConstantInt *CCst = dyn_cast<ConstantInt>(C);
|
ConstantInt *CCst = dyn_cast<ConstantInt>(C);
|
||||||
if (!CCst) return nullptr;
|
if (!CCst) return nullptr;
|
||||||
if (LHSCC != NEWCC)
|
|
||||||
CCst = dyn_cast<ConstantInt>( ConstantExpr::getXor(BCst, CCst) );
|
|
||||||
ConstantInt *ECst = dyn_cast<ConstantInt>(E);
|
ConstantInt *ECst = dyn_cast<ConstantInt>(E);
|
||||||
if (!ECst) return nullptr;
|
if (!ECst) return nullptr;
|
||||||
|
if (LHSCC != NEWCC)
|
||||||
|
CCst = cast<ConstantInt>(ConstantExpr::getXor(BCst, CCst));
|
||||||
if (RHSCC != NEWCC)
|
if (RHSCC != NEWCC)
|
||||||
ECst = dyn_cast<ConstantInt>( ConstantExpr::getXor(DCst, ECst) );
|
ECst = cast<ConstantInt>(ConstantExpr::getXor(DCst, ECst));
|
||||||
ConstantInt* MCst = dyn_cast<ConstantInt>(
|
|
||||||
ConstantExpr::getAnd(ConstantExpr::getAnd(BCst, DCst),
|
|
||||||
ConstantExpr::getXor(CCst, ECst)) );
|
|
||||||
// if there is a conflict we should actually return a false for the
|
// if there is a conflict we should actually return a false for the
|
||||||
// whole construct
|
// whole construct
|
||||||
if (!MCst->isZero())
|
if (((BCst->getValue() & DCst->getValue()) &
|
||||||
|
(CCst->getValue() ^ ECst->getValue())) != 0)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
Value *newOr1 = Builder->CreateOr(B, D);
|
Value *newOr1 = Builder->CreateOr(B, D);
|
||||||
Value *newOr2 = ConstantExpr::getOr(CCst, ECst);
|
Value *newOr2 = ConstantExpr::getOr(CCst, ECst);
|
||||||
|
|||||||
Reference in New Issue
Block a user