[PATCH] D46739: [DebugInfo] Only handle DBG_VALUE in InlineSpiller

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 10 20:06:40 PDT 2018


HsiangKai created this revision.
HsiangKai added reviewers: aprantl, bjope.
Herald added subscribers: llvm-commits, JDevlieghere, eraman, qcolombet.

The instructions using registers should be DBG_VALUE and normal
instructions. Use isDebugValue() to filter out DBG_VALUE and add
an assert to ensure there is no other kind of debug instructions
using the registers.

Related differential revision: https://reviews.llvm.org/D45342


Repository:
  rL LLVM

https://reviews.llvm.org/D46739

Files:
  lib/CodeGen/InlineSpiller.cpp


Index: lib/CodeGen/InlineSpiller.cpp
===================================================================
--- lib/CodeGen/InlineSpiller.cpp
+++ lib/CodeGen/InlineSpiller.cpp
@@ -617,9 +617,12 @@
       MachineInstr &MI = *RegI++;
 
       // Debug values are not allowed to affect codegen.
-      if (MI.isDebugInstr())
+      if (MI.isDebugValue())
         continue;
 
+      assert(!MI.isDebugInstr() && "Did not expect to find a use in debug "
+             "instruction that isn't a DBG_VALUE");
+
       anyRemat |= reMaterializeFor(LI, MI);
     }
   }
@@ -932,15 +935,18 @@
     MachineInstr *MI = &*(RegI++);
 
     // Debug values are not allowed to affect codegen.
-    if (MI->isDebugInstr()) {
+    if (MI->isDebugValue()) {
       // Modify DBG_VALUE now that the value is in a spill slot.
       MachineBasicBlock *MBB = MI->getParent();
       DEBUG(dbgs() << "Modifying debug info due to spill:\t" << *MI);
       buildDbgValueForSpill(*MBB, MI, *MI, StackSlot);
       MBB->erase(MI);
       continue;
     }
 
+    assert(!MI->isDebugInstr() && "Did not expect to find a use in debug "
+           "instruction that isn't a DBG_VALUE");
+
     // Ignore copies to/from snippets. We'll delete them.
     if (SnippetCopies.count(MI))
       continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46739.146272.patch
Type: text/x-patch
Size: 1267 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180511/10e525c4/attachment.bin>


More information about the llvm-commits mailing list