Skip to content

[MIR] Add text spelling 'lr-split' for MachineInstr::LRSplit#1

Closed
qcolombet wants to merge 1 commit into
b0-split-from-mirfrom
b1-lr-split
Closed

[MIR] Add text spelling 'lr-split' for MachineInstr::LRSplit#1
qcolombet wants to merge 1 commit into
b0-split-from-mirfrom
b1-lr-split

Conversation

@qcolombet
Copy link
Copy Markdown
Owner

The LRSplit MachineInstr flag is set by SplitKit on copies inserted for live-range splitting, and AMDGPU's SIInstrInfo::canAddToBBProlog uses it to recognize WWM_COPY / IMPLICIT_DEF instructions as part of the basic block prologue. Until now the flag had no MIR-text representation, so MIR-based tests for prologue handling could not set it and had to rely on running the whole register allocator pipeline.

This change adds 'lr-split' as the MIR spelling, wired through:

  • MILexer: new kw_lr_split token, "lr-split" keyword
  • MIParser: accepted in the instruction-flag prefix loop, sets MachineInstr::LRSplit
  • MIRPrinter and MachineInstr::print: emit "lr-split" when set, so MIR YAML output and MI.dump() stay in sync
  • update_mir_test_checks.py: 'lr-split' added to MI_FLAGS_STR so autogenerated CHECK lines tolerate the new token

Round-trip coverage in
llvm/test/CodeGen/MIR/AMDGPU/lr-split-flag.mir.

The LRSplit MachineInstr flag is set by SplitKit on copies inserted for
live-range splitting, and AMDGPU's SIInstrInfo::canAddToBBProlog uses it
to recognize WWM_COPY / IMPLICIT_DEF instructions as part of the basic
block prologue. Until now the flag had no MIR-text representation, so
MIR-based tests for prologue handling could not set it and had to rely
on running the whole register allocator pipeline.

This change adds 'lr-split' as the MIR spelling, wired through:
  - MILexer:  new kw_lr_split token, "lr-split" keyword
  - MIParser: accepted in the instruction-flag prefix loop, sets
              MachineInstr::LRSplit
  - MIRPrinter and MachineInstr::print: emit "lr-split" when set, so
              MIR YAML output and MI.dump() stay in sync
  - update_mir_test_checks.py: 'lr-split' added to MI_FLAGS_STR so
              autogenerated CHECK lines tolerate the new token

Round-trip coverage in
llvm/test/CodeGen/MIR/AMDGPU/lr-split-flag.mir.
@qcolombet qcolombet marked this pull request as draft April 27, 2026 23:36
@qcolombet qcolombet closed this Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant