diff options
author | Chris Lattner <sabre@nondot.org> | 2003-08-12 19:11:07 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-08-12 19:11:07 +0000 |
commit | 812aab77276119d52271a99b99d4919120bcdfe5 (patch) | |
tree | 1d7c0d1da526cd04189e9adc8d00c7283b73c67f /llvm/lib/Transforms/Scalar | |
parent | 4d9385c849bf931732417f2eb9795662cb5d76d5 (diff) | |
download | bcm5719-llvm-812aab77276119d52271a99b99d4919120bcdfe5.tar.gz bcm5719-llvm-812aab77276119d52271a99b99d4919120bcdfe5.zip |
Implement testcases InstCombine/or.ll:test16/test17
llvm-svn: 7782
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 83544743ff7..bfc51db1b71 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp @@ -612,6 +612,19 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { } } + // (A & C1)|(A & C2) == A & (C1|C2) + if (BinaryOperator *BO0 = dyn_cast<BinaryOperator>(Op0)) + if (BinaryOperator *BO1 = dyn_cast<BinaryOperator>(Op1)) + if (BO0->getOperand(0) == BO1->getOperand(0) && + BO0->getOpcode() == Instruction::And && + BO1->getOpcode() == Instruction::And) + if (ConstantIntegral *C0 = + dyn_cast<ConstantIntegral>(BO0->getOperand(1))) + if (ConstantIntegral *C1 = + dyn_cast<ConstantIntegral>(BO1->getOperand(1))) + return BinaryOperator::create(Instruction::And, BO0->getOperand(0), + *C0 | *C1); + Value *Op0NotVal = dyn_castNotVal(Op0); Value *Op1NotVal = dyn_castNotVal(Op1); |