diff options
author | Sanjay Patel <spatel@rotateright.com> | 2016-07-08 17:01:15 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2016-07-08 17:01:15 +0000 |
commit | cbfca9e8efcfd468af6047f0dd772dac53f2a59e (patch) | |
tree | 7f57d808e8bd37afa9b50cf85c1df3fc80b772de /llvm/lib/Transforms | |
parent | bc3b1f3b7b8bfe42f9031e016df334048954b169 (diff) | |
download | bcm5719-llvm-cbfca9e8efcfd468af6047f0dd772dac53f2a59e.tar.gz bcm5719-llvm-cbfca9e8efcfd468af6047f0dd772dac53f2a59e.zip |
[InstCombine] allow or(sext(A), B) --> A ? -1 : B transform for vectors
llvm-svn: 274883
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index b5b320f29c5..f6ec03b9721 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -2393,11 +2393,12 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) { if (Instruction *CastedOr = foldCastedBitwiseLogic(I)) return CastedOr; - // or(sext(A), B) -> A ? -1 : B where A is an i1 - // or(A, sext(B)) -> B ? -1 : A where B is an i1 - if (match(Op0, m_SExt(m_Value(A))) && A->getType()->isIntegerTy(1)) + // or(sext(A), B) / or(B, sext(A)) --> A ? -1 : B, where A is i1 or <N x i1>. + if (match(Op0, m_SExt(m_Value(A))) && + A->getType()->getScalarType()->isIntegerTy(1)) return SelectInst::Create(A, ConstantInt::getSigned(I.getType(), -1), Op1); - if (match(Op1, m_SExt(m_Value(A))) && A->getType()->isIntegerTy(1)) + if (match(Op1, m_SExt(m_Value(A))) && + A->getType()->getScalarType()->isIntegerTy(1)) return SelectInst::Create(A, ConstantInt::getSigned(I.getType(), -1), Op0); // Note: If we've gotten to the point of visiting the outer OR, then the |