diff options
author | Roman Tereshin <rtereshin@apple.com> | 2018-05-07 22:31:47 +0000 |
---|---|---|
committer | Roman Tereshin <rtereshin@apple.com> | 2018-05-07 22:31:47 +0000 |
commit | d29fc892226e9a4fbab8580533e5589b50fb0080 (patch) | |
tree | 3edbe6cc65fae3ab343ba680663f0013042d03bb /llvm/lib/CodeGen/MachineInstr.cpp | |
parent | f487edae49368e1fb620a3597c61deef4275aa86 (diff) | |
download | bcm5719-llvm-d29fc892226e9a4fbab8580533e5589b50fb0080.tar.gz bcm5719-llvm-d29fc892226e9a4fbab8580533e5589b50fb0080.zip |
[MachineVerifier][GlobalISel] Checking that generic instrs have LLTs on all vregs
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.
Reviewers: qcolombet t.p.northover bogner ab
Reviewed By: qcolombet
Subscribers: rovka, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D46455
llvm-svn: 331694
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 0f466e4b2d1..92abd84c56b 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -1224,8 +1224,12 @@ LLT MachineInstr::getTypeToPrint(unsigned OpIdx, SmallBitVector &PrintedTypes, if (PrintedTypes[OpInfo.getGenericTypeIndex()]) return LLT{}; - PrintedTypes.set(OpInfo.getGenericTypeIndex()); - return MRI.getType(Op.getReg()); + LLT TypeToPrint = MRI.getType(Op.getReg()); + // Don't mark the type index printed if it wasn't actually printed: maybe + // another operand with the same type index has an actual type attached: + if (TypeToPrint.isValid()) + PrintedTypes.set(OpInfo.getGenericTypeIndex()); + return TypeToPrint; } #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) |