summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commit18f49ce2d39f828ba7a82018566bb7edb66a9289 (patch)
treed662e25e8b02bd7b2af1e6a62bcf6d53d0b62f92 /llvm/lib
parentc1d2fa5d48b885ab448f34f1145dbc1ab889d794 (diff)
downloadbcm5719-llvm-18f49ce2d39f828ba7a82018566bb7edb66a9289.tar.gz
bcm5719-llvm-18f49ce2d39f828ba7a82018566bb7edb66a9289.zip
optimize ~(~X >>s Y) --> (X >>s Y), patch by Edmund Grimley
Evans! llvm-svn: 93884
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index af300fc3577..fa7bb12ff21 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/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));
}
}
}
OpenPOWER on IntegriCloud