[llvm] r340321 - [InstCombine] Pull simple checks above a more complicated one. NFCI
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 21 12:17:00 PDT 2018
Author: ctopper
Date: Tue Aug 21 12:17:00 2018
New Revision: 340321
URL: http://llvm.org/viewvc/llvm-project?rev=340321&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=340321&r1=340320&r2=340321&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Tue Aug 21 12:17:00 2018
@@ -2919,12 +2919,10 @@ Instruction *InstCombiner::visitXor(Bina
// %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);
More information about the llvm-commits
mailing list