Use more efficient test for one value in a ConstantInt.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34859 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer
2007-03-02 23:35:28 +00:00
parent 4e69f48a0a
commit a5dae0cac0
2 changed files with 14 additions and 13 deletions
+2 -2
View File
@@ -1048,7 +1048,7 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist) {
cast<BinaryOperator>(I)->swapOperands();
if (ConstantInt *CB = dyn_cast<ConstantInt>(I->getOperand(1)))
if (CB->getType() == Type::Int1Ty) {
if (CB->getZExtValue()) // X & 1 -> X
if (CB->isOne()) // X & 1 -> X
ReplaceUsesOfWith(I, I->getOperand(0), Worklist);
else // X & 0 -> 0
ReplaceUsesOfWith(I, I->getOperand(1), Worklist);
@@ -1061,7 +1061,7 @@ void LoopUnswitch::SimplifyCode(std::vector<Instruction*> &Worklist) {
cast<BinaryOperator>(I)->swapOperands();
if (ConstantInt *CB = dyn_cast<ConstantInt>(I->getOperand(1)))
if (CB->getType() == Type::Int1Ty) {
if (CB->getZExtValue()) // X | 1 -> 1
if (CB->isOne()) // X | 1 -> 1
ReplaceUsesOfWith(I, I->getOperand(1), Worklist);
else // X | 0 -> X
ReplaceUsesOfWith(I, I->getOperand(0), Worklist);