[PATCH] D106660: [DebugInfo][InstrRef] Don't break up return-sequences on debug-info instructions

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 23 06:27:36 PDT 2021


jmorse created this revision.
jmorse added reviewers: Orlando, TWeaver, StephenTozer.
Herald added a subscriber: hiraditya.
jmorse requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

When we have a terminator sequence (i.e. a tailcall or return), `MIIsInTerminatorSequence` is used to work out where the preceding ABI-setup instructions end, i.e. the parts that were glued to the terminator instruction. This allows LLVM to split blocks safely without having to worry about ABI stuff.

The function only ignores DBG_VALUE instructions, meaning that the two debug instructions I recently added can end terminator sequences early, causing various MachineVerifier errors. This patch promotes the test for debug instructions from "isDebugValue" to "isDebugInstr", thus avoiding any debug-info interfering with this function.

Unfortunately I don't have a test where I can replicate this: it would require getting ScheduleDAGSDNodes to emit debug instrs between a tail call and the instrs glued to it. This is happening on a large codebase (that I can't directly access) deep inside LTO, and this change fixes it. Hopefully everyone agrees: this is an obvious fix.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106660

Files:
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -1660,7 +1660,7 @@
     // physical registers if there is debug info associated with the terminator
     // of our mbb. We want to include said debug info in our terminator
     // sequence, so we return true in that case.
-    return MI.isDebugValue();
+    return MI.isDebugInstr();
 
   // We have left the terminator sequence if we are not doing one of the
   // following:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106660.361175.patch
Type: text/x-patch
Size: 617 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210723/5dbfe279/attachment.bin>


More information about the llvm-commits mailing list