llvm-project
a7dc3296 - [GlobalISel] Migrate undef-operand combines to MIR patterns (#219449)

Commit
11 hours ago
[GlobalISel] Migrate undef-operand combines to MIR patterns (#219449) Part of the ongoing effort to retire `wip_match_opcode` from the generic combiner. A whole class of combines only use it to ask "is operand N of the root undef?", delegating to `matchAnyExplicitUseIsUndef` / `matchOperandIsUndef`. That predicate is purely structural, so it belongs in the MIR pattern itself rather than in C++. It adds four `GICombinePatFrag` classes parameterized by an opcode list (`unary_undef_frag`, `binop_left_undef_frag`, `binop_right_undef_frag`, `binop_any_undef_frag`). These become the shared vocabulary for undef-operand folds and let each rule express only its match shape. All the undef-to-{zero,-1,undef} / propagate-undef rules and the two extractelement-of-undef rules are re-expressed on top of them, the latter collapsing into a single rule. It also included the fneg/fneg folds for `fmul/fdiv/fmad/fma` which are partially migrated as MIR-pattern for sub-cases. Behavioural caveats worth calling out for review: - Relocating these rules from the opcode-only bucket to the structured bucket can possibly shifts combine application order on the opcodes but it won't effect the semantics equivalence on execution level.
Author
Parents
Loading