[PATCH] D78106: [CSInfo][NFC] Interpret loaded parameter value separately
Djordje Todorovic via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 18 02:38:18 PDT 2020
djtodoro added inline comments.
================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:780
- // If the MI is an instruction defining one or more parameters' forwarding
- // registers, add those defines.
- auto getForwardingRegsDefinedByMI = [&](const MachineInstr &MI,
- SmallSetVector<unsigned, 4> &Defs) {
- if (MI.isDebugInstr())
- return;
-
- for (const MachineOperand &MO : MI.operands()) {
- if (MO.isReg() && MO.isDef() &&
- Register::isPhysicalRegister(MO.getReg())) {
- for (auto FwdReg : ForwardedRegWorklist)
- if (TRI->regsOverlap(FwdReg.first, MO.getReg()))
- Defs.insert(FwdReg.first);
- }
- }
- };
-
- // Search for a loading value in forwarding registers.
- for (; I != MBB->rend(); ++I) {
+ auto nextInstrInterpret = [&](const MachineInstr *CurMI,
+ FwdRegWorklist &ForwardedRegWorklist,
----------------
djtodoro wrote:
> djtodoro wrote:
> > vsk wrote:
> > > What does nextInstrInterpret need to capture via [&]?
> > Also the `getForwardingRegsDefinedByMI` does not need to capture via [&].
> https://reviews.llvm.org/D79616
Sorry for the confusion.
After the conversation from D79616, I realized that default reference capturing is recommended by the LLVM Style Guide when lambda does not escape its context.
But anyway, this lambda (`nextInstrInterpret`) captures by reference but it does not use any data from the function, so the `[&]` could be deleted. Furthermore, maybe `nextInstrInterpret` could be factored out into a static function? I am OK with either way.
@vsk WDYT?
In addition:
`nextInstrInterpret` -> `interpretNextInstr` ?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D78106/new/
https://reviews.llvm.org/D78106
More information about the llvm-commits
mailing list