aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-19 18:16:19 +0000
committerChris Lattner <sabre@nondot.org>2010-01-19 18:16:19 +0000
commitc0404b3715151d020dda074740bbdaa794f9328a (patch)
tree7cd4b513d43274c70b7ba5d7b145873856cf70ae /lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
parent9201b10daac2660f2f45534f12b52e3ee3501e88 (diff)
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
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineAndOrXor.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstCombineAndOrXor.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index af300fc357..fa7bb12ff2 100644
--- a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -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));
}
}
}