[PATCH] D76129: Fix possible assertion when using PBQP with debug info

Danila Malyutin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 13 06:22:10 PDT 2020


danilaml created this revision.
Herald added subscribers: llvm-commits, hiraditya, aprantl, qcolombet.
Herald added a project: LLVM.
danilaml edited the summary of this revision.
danilaml added reviewers: myatsina, qcolombet, uweigand, stoklund.

SlotIndex si = LIS.getInstructionIndex(*mi) could trigger assert(!BundleNonDebug.isDebugInstr() && "Could not use a debug instruction to query mi2iMap.");
when mi was a debug instruction while the check against DebugInstr happened after that call.
I could only reproduce it with PBQP regalloc because others either use LiveDebugVariables analysis that removes DBG_VALUEs before regalloc, or don't use calculateSpillWeightsAndHints.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76129

Files:
  llvm/lib/CodeGen/CalcSpillWeights.cpp


Index: llvm/lib/CodeGen/CalcSpillWeights.cpp
===================================================================
--- llvm/lib/CodeGen/CalcSpillWeights.cpp
+++ llvm/lib/CodeGen/CalcSpillWeights.cpp
@@ -203,8 +203,8 @@
   };
   std::set<CopyHint> CopyHints;
 
-  for (MachineRegisterInfo::reg_instr_iterator
-       I = mri.reg_instr_begin(li.reg), E = mri.reg_instr_end();
+  for (MachineRegisterInfo::reg_instr_nodbg_iterator
+       I = mri.reg_instr_nodbg_begin(li.reg), E = mri.reg_instr_nodbg_end();
        I != E; ) {
     MachineInstr *mi = &*(I++);
 
@@ -215,7 +215,7 @@
       continue;
 
     numInstr++;
-    if (mi->isIdentityCopy() || mi->isImplicitDef() || mi->isDebugInstr())
+    if (mi->isIdentityCopy() || mi->isImplicitDef())
       continue;
     if (!visited.insert(mi).second)
       continue;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76129.250188.patch
Type: text/x-patch
Size: 816 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200313/d17ee3a5/attachment.bin>


More information about the llvm-commits mailing list