diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 6af7e9e..b493dff 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -1630,6 +1630,20 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) { } } + // umin(i1 X, i1 Y) -> and i1 X, Y + // smax(i1 X, i1 Y) -> and i1 X, Y + if ((IID == Intrinsic::umin || IID == Intrinsic::smax) && + II->getType()->isIntOrIntVectorTy(1)) { + return BinaryOperator::CreateAnd(I0, I1); + } + + // umax(i1 X, i1 Y) -> or i1 X, Y + // smin(i1 X, i1 Y) -> or i1 X, Y + if ((IID == Intrinsic::umax || IID == Intrinsic::smin) && + II->getType()->isIntOrIntVectorTy(1)) { + return BinaryOperator::CreateOr(I0, I1); + } + if (IID == Intrinsic::smax || IID == Intrinsic::smin) { // smax (neg nsw X), (neg nsw Y) --> neg nsw (smin X, Y) // smin (neg nsw X), (neg nsw Y) --> neg nsw (smax X, Y) |
