[llvm] d230442 - [DAG][NFC] Use SDPatternMatch for VScale in some instances
Michael Maitland via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 29 06:52:43 PDT 2024
Author: Michael Maitland
Date: 2024-07-29T06:50:27-07:00
New Revision: d2304427cb0270259bc083a3db27413823f56e59
URL: https://github.com/llvm/llvm-project/commit/d2304427cb0270259bc083a3db27413823f56e59
DIFF: https://github.com/llvm/llvm-project/commit/d2304427cb0270259bc083a3db27413823f56e59.diff
LOG: [DAG][NFC] Use SDPatternMatch for VScale in some instances
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 060e66175d965..b35d08b327ef3 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -1086,10 +1086,9 @@ bool DAGCombiner::reassociationCanBreakAddressingModePattern(unsigned Opc,
// (load/store (add/sub (add x, y), vscale))
// (load/store (add/sub (add x, y), (lsl vscale, C)))
// (load/store (add/sub (add x, y), (mul vscale, C)))
- if ((N1.getOpcode() == ISD::VSCALE ||
- ((N1.getOpcode() == ISD::SHL || N1.getOpcode() == ISD::MUL) &&
- N1.getOperand(0).getOpcode() == ISD::VSCALE &&
- isa<ConstantSDNode>(N1.getOperand(1)))) &&
+ if (sd_match(N1, m_AnyOf(m_VScale(m_Value()),
+ m_Shl(m_VScale(m_Value()), m_ConstInt()),
+ m_Mul(m_VScale(m_Value()), m_ConstInt()))) &&
N1.getValueType().getFixedSizeInBits() <= 64) {
int64_t ScalableOffset = N1.getOpcode() == ISD::VSCALE
? N1.getConstantOperandVal(0)
@@ -2975,8 +2974,7 @@ SDValue DAGCombiner::visitADD(SDNode *N) {
}
// fold a+vscale(c1)+vscale(c2) -> a+vscale(c1+c2)
- if (N0.getOpcode() == ISD::ADD &&
- N0.getOperand(1).getOpcode() == ISD::VSCALE &&
+ if (sd_match(N0, m_Add(m_Value(), m_VScale(m_Value()))) &&
N1.getOpcode() == ISD::VSCALE) {
const APInt &VS0 = N0.getOperand(1)->getConstantOperandAPInt(0);
const APInt &VS1 = N1->getConstantOperandAPInt(0);
More information about the llvm-commits
mailing list