[PATCH] D110105: [MachineInstr] Move MIParser's DBG_VALUE RegState::Debug invariant into MachineInstr::addOperand

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 5 17:21:01 PDT 2021


MatzeB added a comment.

Thanks, great work cleaning all up all the use sites! I have some comments on the verifier changes, then this will be good to go.



================
Comment at: llvm/lib/CodeGen/MachineVerifier.cpp:1894-1895
+    // reg0 indicates an undefined debug value.
+    if (MI->isDebugValue() && !MO->isDebug())
+      report("DBG_VALUE register operands must be debug", MO, MONum);
+
----------------
- Use isDebugInstr() here as well and tweak message.
- Also check the reverse: non-debug instructions must not use the debug flag.
- Also test for `isUse()` for good measure (even though it should not be possible for debug instruction to ever define regs).


================
Comment at: llvm/lib/CodeGen/MachineVerifier.cpp:1963-1966
       if (MI->isDebugValue() && MO->isUse() && !MO->isDebug()) {
         report("Use-reg is not IsDebug in a DBG_VALUE", MO, MONum);
         return;
       }
----------------
It seems a similar check already existed but was incorrectly only put into the `isPhysicalRegister()` branch... We can drop it now I guess.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110105/new/

https://reviews.llvm.org/D110105



More information about the llvm-commits mailing list