mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
implement a TODO by teaching jump threading about "xor x, 1".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86739 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -299,8 +299,20 @@ ComputeValueKnownInPredecessors(Value *V, BasicBlock *BB,PredValueInfo &Result){
|
||||
return !Result.empty();
|
||||
}
|
||||
|
||||
// TODO: Should handle the NOT form of XOR.
|
||||
|
||||
// Handle the NOT form of XOR.
|
||||
if (I->getOpcode() == Instruction::Xor &&
|
||||
isa<ConstantInt>(I->getOperand(1)) &&
|
||||
cast<ConstantInt>(I->getOperand(1))->isOne()) {
|
||||
ComputeValueKnownInPredecessors(I->getOperand(0), BB, Result);
|
||||
if (Result.empty())
|
||||
return false;
|
||||
|
||||
// Invert the known values.
|
||||
for (unsigned i = 0, e = Result.size(); i != e; ++i)
|
||||
Result[i].first =
|
||||
cast<ConstantInt>(ConstantExpr::getNot(Result[i].first));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle compare with phi operand, where the PHI is defined in this block.
|
||||
|
||||
Reference in New Issue
Block a user