[llvm] 6a06c7a - [X86] isHorizontalBinOp - only update LHS/RHS references on success
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 5 07:10:28 PDT 2020
Author: Simon Pilgrim
Date: 2020-08-05T15:09:52+01:00
New Revision: 6a06c7a0a7688ce142865e92d879b8bece79de7a
URL: https://github.com/llvm/llvm-project/commit/6a06c7a0a7688ce142865e92d879b8bece79de7a
DIFF: https://github.com/llvm/llvm-project/commit/6a06c7a0a7688ce142865e92d879b8bece79de7a.diff
LOG: [X86] isHorizontalBinOp - only update LHS/RHS references on success
We've had issues in the past where isHorizontalBinOp calls would affect later combines as the LHS/RHS references had been commuted but still failed to match.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 82459f509668..04dde4b15514 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -44580,8 +44580,8 @@ static bool isHorizontalBinOp(SDValue &LHS, SDValue &RHS, SelectionDAG &DAG,
}
}
- LHS = A.getNode() ? A : B; // If A is 'UNDEF', use B for it.
- RHS = B.getNode() ? B : A; // If B is 'UNDEF', use A for it.
+ SDValue NewLHS = A.getNode() ? A : B; // If A is 'UNDEF', use B for it.
+ SDValue NewRHS = B.getNode() ? B : A; // If B is 'UNDEF', use A for it.
bool IsIdentityPostShuffle =
isSequentialOrUndefInRange(PostShuffleMask, 0, NumElts, 0);
@@ -44595,13 +44595,13 @@ static bool isHorizontalBinOp(SDValue &LHS, SDValue &RHS, SelectionDAG &DAG,
// Assume a SingleSource HOP if we only shuffle one input and don't need to
// shuffle the result.
- if (!shouldUseHorizontalOp(LHS == RHS &&
+ if (!shouldUseHorizontalOp(NewLHS == NewRHS &&
(NumShuffles < 2 || !IsIdentityPostShuffle),
DAG, Subtarget))
return false;
- LHS = DAG.getBitcast(VT, LHS);
- RHS = DAG.getBitcast(VT, RHS);
+ LHS = DAG.getBitcast(VT, NewLHS);
+ RHS = DAG.getBitcast(VT, NewRHS);
return true;
}
@@ -44627,8 +44627,6 @@ static SDValue combineFaddFsub(SDNode *N, SelectionDAG &DAG,
return HorizBinOp;
}
- // NOTE: isHorizontalBinOp may have changed LHS/RHS variables.
-
return SDValue();
}
More information about the llvm-commits
mailing list