[PATCH] D55333: VirtRegMap: Preserve LiveDebugVariables
    Matt Arsenault via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Mon May  3 11:56:42 PDT 2021
    
    
  
arsenm added inline comments.
================
Comment at: llvm/lib/CodeGen/VirtRegMap.cpp:273
+    // Write out new DBG_VALUE instructions.
+    DebugVars->emitDebugValues(VRM);
 
----------------
arsenm wrote:
> 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
Without this, the debug values end up getting emitted twice. It doesn't matter for webassembly since the allocator passes are never run
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55333/new/
https://reviews.llvm.org/D55333
    
    
More information about the llvm-commits
mailing list