optimize ~(~X >>s Y) --> (X >>s Y), patch by Edmund Grimley

Evans!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93884 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-01-19 18:16:19 +00:00
parent 9201b10daa
commit c0404b3715
3 changed files with 47 additions and 0 deletions

View File

@@ -1751,6 +1751,11 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
return BinaryOperator::CreateOr(NotX, NotY);
return BinaryOperator::CreateAnd(NotX, NotY);
}
} else if (Op0I->getOpcode() == Instruction::AShr) {
// ~(~X >>s Y) --> (X >>s Y)
if (Value *Op0NotVal = dyn_castNotVal(Op0I->getOperand(0)))
return BinaryOperator::CreateAShr(Op0NotVal, Op0I->getOperand(1));
}
}
}