[PATCH] D55333: VirtRegMap: Preserve LiveDebugVariables

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 7 16:32:25 PST 2021


arsenm added inline comments.


================
Comment at: llvm/lib/CodeGen/VirtRegMap.cpp:273
+    // Write out new DBG_VALUE instructions.
+    DebugVars->emitDebugValues(VRM);
 
----------------
qcolombet wrote:
> qcolombet wrote:
> > I think we should push the test on `DebugVars` before this block.
> > Otherwise
> > 1. we won't clear the VRM and MRI when DebugVars are not present.
> > 2. we won't emit the debug values all the time (but maybe that's ok?)
> > 
> > I.e.,
> > ```
> > if (DebugVars)
> >   DebugVars->emitDebugValues(VRM).
> > 
> > if (ClearVirtRegs) {
> >   VRM->clearAllVirt();
> >   MRI->clearAllVirt();
> > }
> > ```
> > 2. we won't emit the debug values all the time (but maybe that's ok?)
> 
> Looks like it would be okay, since you had:
> ```
>  if (!ClearVirtRegs)
>     AU.addPreserved<LiveDebugVariables>();
> ```
> 
> Still, it is okay to assume `ClearVirtRegs` will be set eventually. E.g., what happens for WebAssembly?
I think this was to avoid double-emitting the debug values, since this will be run twice


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

https://reviews.llvm.org/D55333



More information about the llvm-commits mailing list