[PATCH] D81852: [DebugInfo] Update MachineInstr interface to better support variadic DBG_VALUE instructions

Stephen Tozer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 19 10:19:18 PDT 2020


StephenTozer marked an inline comment as done.
StephenTozer added inline comments.


================
Comment at: llvm/test/CodeGen/MIR/Generic/dbg-value-missing-loc.mir:41
   bb.0.entry:
-    DBG_VALUE 1, 2, 3, 4
+    DBG_VALUE 0, $noreg, !12, !DIExpression()
+    $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, debug-location !14
----------------
vsk wrote:
> StephenTozer wrote:
> > vsk wrote:
> > > What necessitates this change?
> > Some of the previous code dealing specifically with debug values had some statements along the lines of `if (MI.isDebugValue() && MI.getOperand(2).isMetadata()) {...}`. As of this patch we're now using specific functions, i.e. `getDebugVariable()`, that assert that the operand is the right type and then cast to it. AFAIUI this shouldn't be a breaking change as we never produce DBG_VALUEs without the "right" operands, like this test had.
> I see that specific check in LiveDebugVariables, but I'm not sure why it would apply here since we're just running the verifier.
> 
> It's fairly common for backend authors to write tests with incomplete/malformed DBG_VALUEs as it's vastly more convenient than wiring up actual debug info metadata (see e.g. X86/branchfolding-debug-invariant.mir). It'd be great if we could keep that feature.
The tolerance here might be dependent on exactly which passes we go through; in some cases it might not be reasonable to assume malformed DBG_VALUEs. This test breakage specifically came from MachineInstr::print however, so it shouldn't be a problem to fix this case (all other tests pass currently).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81852





More information about the llvm-commits mailing list