Implement xor.ll:test22

llvm-svn: 21713
This commit is contained in:
Chris Lattner 2005-05-06 02:07:39 +00:00
parent 4c2d3781aa
commit 7208616ec0
1 changed files with 9 additions and 0 deletions

View File

@ -3550,6 +3550,15 @@ Instruction *InstCombiner::visitCastInst(CastInst &CI) {
->getOpcode(), Op0c, Op1c);
}
}
// cast (xor bool X, true) to int --> xor (cast bool X to int), 1
if (SrcBitSize == 1 && SrcI->getOpcode() == Instruction::Xor &&
Op1 == ConstantBool::True &&
(!Op0->hasOneUse() || !isa<SetCondInst>(Op0))) {
Value *New = InsertOperandCastBefore(Op0, DestTy, &CI);
return BinaryOperator::createXor(New,
ConstantInt::get(CI.getType(), 1));
}
break;
case Instruction::Shl:
// Allow changing the sign of the source operand. Do not allow changing