[PATCH] D41226: [LiveDebugValues] recognize spilled register that is killed in instruction after the spill

Wolfgang Pieb via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 8 17:33:12 PST 2018


wolfgangp added inline comments.


================
Comment at: lib/CodeGen/LiveDebugValues.cpp:429
 
-  // In a spill instruction generated by the InlineSpiller the spilled register
-  // has its kill flag set. Return false if we don't find such a register.
-  Reg = 0;
+  auto getRegIfKilled = [&](const MachineOperand MO, unsigned &Reg) {
+    if (!MO.isReg() || !MO.isUse()) {
----------------
I would prefer if the name of the lambda would reflect that we are returning a boolean quantity, i.e. whether the operand is a killed register or not. The register itself is returned as a side-effect, so something like 'isKilledReg()' instead of 'getKilledReg()' would sound a bit more consistent to me.


================
Comment at: lib/CodeGen/LiveDebugValues.cpp:443
+      return true;
+    else if (Reg != 0) {
+      // Check whether next instruction kills the spilled register.
----------------
I don't believe we need the 'else' now.


================
Comment at: lib/CodeGen/LiveDebugValues.cpp:451
+        continue;
+      unsigned RegNext = 0;
+      for (const MachineOperand &MONext : NextI->operands()) {
----------------
We don't need to initialize RegNext here, I think.


https://reviews.llvm.org/D41226





More information about the llvm-commits mailing list