[PATCH] D79616: [NFC][DwarfDebug] Avoid default capturing when using lambdas

Djordje Todorovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 04:15:33 PDT 2020


djtodoro updated this revision to Diff 262853.
djtodoro added a comment.

-rebasing


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

https://reviews.llvm.org/D79616

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp


Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -706,20 +706,21 @@
 
   // 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);
-      }
-    }
-  };
+  auto getForwardingRegsDefinedByMI =
+      [&TRI](const MachineInstr &MI, SmallSetVector<unsigned, 4> &Defs,
+             const FwdRegWorklist &ForwardedRegWorklist) {
+        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) {
@@ -738,7 +739,7 @@
     // Set of worklist registers that are defined by this instruction.
     SmallSetVector<unsigned, 4> FwdRegDefs;
 
-    getForwardingRegsDefinedByMI(*I, FwdRegDefs);
+    getForwardingRegsDefinedByMI(*I, FwdRegDefs, ForwardedRegWorklist);
     if (FwdRegDefs.empty())
       continue;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79616.262853.patch
Type: text/x-patch
Size: 1849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200508/1cf1165f/attachment-0001.bin>


More information about the llvm-commits mailing list