[PATCH] D55333: VirtRegMap: Preserve LiveDebugVariables

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 7 09:53:20 PST 2021


qcolombet added inline comments.


================
Comment at: llvm/lib/CodeGen/VirtRegMap.cpp:273
+    // Write out new DBG_VALUE instructions.
+    DebugVars->emitDebugValues(VRM);
 
----------------
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?


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

https://reviews.llvm.org/D55333



More information about the llvm-commits mailing list