This is an archive of the discontinued LLVM Phabricator instance.

[MachineVerifier][GlobalISel] Checking that generic instrs have LLTs on all vregs
ClosedPublic

Authored by rtereshin on May 4 2018, 1:45 PM.

Details

Summary

Every generic machine instruction must have generic virtual registers
only, that is, have a low-level type attached to each operand.

Previously MachineVerifier would catch a type missing on an operand
only if the previous operand for the the same type index exists and
have a type attached to it and it will report it as a type mismatch.
This is incosistent behaviour and a misleading error message.

This commit makes sure MachineVerifier explicitly checks that the
types are there for every operand and if not provides a
straightforward error message.

Diff Detail

Repository
rL LLVM

Event Timeline

rtereshin created this revision.May 4 2018, 1:45 PM

The patch relies on an NFC not included in the diff:

[MachineVerifier][GlobalISel] NFC, Improving MO printing and refactoring visitMachineInstrBefore

This is an NFC pre-commit for the following "Checking that generic
instrs have LLTs on all vregs" commit.

This overloads MachineOperand::print to make it possible to print LLTs
with standalone machine operands.

This also overloads MachineVerifier::print(...MachineOperand...) with
an optional LLT using the newly introduced MachineOperand::print
variant; no actual calls added.

This also refactors MachineVerifier::visitMachineInstrBefore in the
parts dealing with all generic instructions (checking Selected
property, LLTs, and phys regs).
rtereshin updated this revision to Diff 145295.May 4 2018, 2:15 PM

Splitting up tests between the NFC and the main commit in a better way.

rtereshin updated this revision to Diff 145325.May 4 2018, 4:44 PM

Cleaning up NFC a bit.

This revision is now accepted and ready to land.May 7 2018, 12:54 PM
This revision was automatically updated to reflect the committed changes.