[PATCH] D42801: [DebugInfo] Don't insert DEBUG_VALUE after terminators

Stefan Maksimovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 08:27:40 PST 2018


smaksimovic created this revision.
smaksimovic added reviewers: Ka-Ka, sdardis.
Herald added a subscriber: JDevlieghere.

r314974 introduced insertion of DEBUG_VALUEs after
each redefinition of debug value register in the slot index range.

In case the instruction redefining the debug value register
was a terminator, machine verifier would complain since it
enforces the rule of no non-terminator instructions
following the first terminator.


https://reviews.llvm.org/D42801

Files:
  lib/CodeGen/LiveDebugVariables.cpp
  test/CodeGen/Mips/pr34975.ll
  test/CodeGen/Mips/pr35071.ll


Index: test/CodeGen/Mips/pr35071.ll
===================================================================
--- test/CodeGen/Mips/pr35071.ll
+++ test/CodeGen/Mips/pr35071.ll
@@ -1,4 +1,4 @@
-; RUN: llc -mtriple mips64-unknown-freebsd12.0 -relocation-model pic -mcpu=mips4 -target-abi n64 -O2 -o - %s
+; RUN: llc -mtriple mips64-unknown-freebsd12.0 -relocation-model pic -mcpu=mips4 -target-abi n64 -O2 -verify-machineinstrs -o - %s
 
 ; Test that the long branch pass does not crash due to the control flow
 ; optimizer producing malformed basic block operands due to the backend
Index: test/CodeGen/Mips/pr34975.ll
===================================================================
--- test/CodeGen/Mips/pr34975.ll
+++ test/CodeGen/Mips/pr34975.ll
@@ -1,4 +1,4 @@
-; RUN: llc -mtriple=mips64-unknown-freebsd -target-abi n64 -relocation-model pic -o /dev/null %s -O2
+; RUN: llc -mtriple=mips64-unknown-freebsd -target-abi n64 -relocation-model pic -verify-machineinstrs -o /dev/null %s -O2
 
 ; Test that the presence of debug information does not cause the branch folder
 ; to rewrite branches to have negative basic block ids, which would cause the
Index: lib/CodeGen/LiveDebugVariables.cpp
===================================================================
--- lib/CodeGen/LiveDebugVariables.cpp
+++ lib/CodeGen/LiveDebugVariables.cpp
@@ -1098,8 +1098,9 @@
 
   // Find the next instruction in the MBB that define the register Reg.
   while (I != MBB->end()) {
-    if (!LIS.isNotInMIMap(*I) &&
-        SlotIndex::isEarlierEqualInstr(StopIdx, LIS.getInstructionIndex(*I)))
+    if ((!LIS.isNotInMIMap(*I) && SlotIndex::isEarlierEqualInstr(
+                                      StopIdx, LIS.getInstructionIndex(*I))) ||
+        I->isTerminator())
       break;
     if (I->definesRegister(Reg, &TRI))
       // The insert location is directly after the instruction/bundle.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42801.132405.patch
Type: text/x-patch
Size: 1878 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180201/71b9cba3/attachment.bin>


More information about the llvm-commits mailing list