summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-08-21 19:17:00 +0000
committerCraig Topper <craig.topper@intel.com>2018-08-21 19:17:00 +0000
commit3d8fe39ca7360b8fcb3558cf5625ad7525933256 (patch)
tree98bff46986602f4bf815912f748e294da21338b3 /llvm/lib/Transforms
parent9583d4fa03e8010ba6f80302940b548084d8c477 (diff)
downloadbcm5719-llvm-3d8fe39ca7360b8fcb3558cf5625ad7525933256.tar.gz
bcm5719-llvm-3d8fe39ca7360b8fcb3558cf5625ad7525933256.zip
[InstCombine] Pull simple checks above a more complicated one. NFCI
I'm assuming its easier to make sure the RHS of an XOR is all ones than it is to check for the many select patterns we have. So lets check that first. Same with the one use check. llvm-svn: 340321
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index a2dea10c565..e631e7396b1 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -2919,12 +2919,10 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
// %res = select i1 %cmp2, i32 %x, i32 %noty
//
// Same is applicable for smin/umax/umin.
- {
+ if (match(Op1, m_AllOnes()) && Op0->hasOneUse()) {
Value *LHS, *RHS;
SelectPatternFlavor SPF = matchSelectPattern(Op0, LHS, RHS).Flavor;
- if (Op0->hasOneUse() && SelectPatternResult::isMinOrMax(SPF) &&
- match(Op1, m_AllOnes())) {
-
+ if (SelectPatternResult::isMinOrMax(SPF)) {
Value *X;
if (match(RHS, m_Not(m_Value(X))))
std::swap(RHS, LHS);
OpenPOWER on IntegriCloud