Skip to content

[DAG] SDPatternMatch - add matchers for reassociatable binops #118847

@RKSimon

Description

@RKSimon

For binop opcodes that are commutable + reassociatable (ISD::AND/OR/OR/ADD/MUL etc.) we need support for variable args matchers that can match operands that might be in different locations in a dependency chain:

e.g.

(add X, (add Y, Z))
(add (add X, Y), (add Z, W))
(add X, (add Y, (add Z, W)))

SDValue X, Y, Z, W;
m_Add(m_Value(X), m_Value(Y), m_Value(Z))
m_Add(m_Value(X), m_Value(Y), m_Value(Z), m_Value(W))

We probably only need the 3 and 4 argument patterns for this initial ticket.

Metadata

Metadata

Assignees

Labels

good first issuehttps://github.com/llvm/llvm-project/contributellvm:SelectionDAGSelectionDAGISel as well

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions