[llvm] r324734 - [DebugInfo] Don't insert DEBUG_VALUE after terminators

Stefan Maksimovic via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 9 06:03:26 PST 2018


Author: smaksimovic
Date: Fri Feb  9 06:03:26 2018
New Revision: 324734

URL: http://llvm.org/viewvc/llvm-project?rev=324734&view=rev
Log:
[DebugInfo] Don't insert DEBUG_VALUE after terminators

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.

Differential Revision: https://reviews.llvm.org/D42801

Modified:
    llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp
    llvm/trunk/test/CodeGen/Mips/pr34975.ll
    llvm/trunk/test/CodeGen/Mips/pr35071.ll

Modified: llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp?rev=324734&r1=324733&r2=324734&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveDebugVariables.cpp Fri Feb  9 06:03:26 2018
@@ -1097,7 +1097,7 @@ findNextInsertLocation(MachineBasicBlock
   unsigned Reg = LocMO.getReg();
 
   // Find the next instruction in the MBB that define the register Reg.
-  while (I != MBB->end()) {
+  while (I != MBB->end() && !I->isTerminator()) {
     if (!LIS.isNotInMIMap(*I) &&
         SlotIndex::isEarlierEqualInstr(StopIdx, LIS.getInstructionIndex(*I)))
       break;

Modified: llvm/trunk/test/CodeGen/Mips/pr34975.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/pr34975.ll?rev=324734&r1=324733&r2=324734&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/pr34975.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/pr34975.ll Fri Feb  9 06:03:26 2018
@@ -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

Modified: llvm/trunk/test/CodeGen/Mips/pr35071.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Mips/pr35071.ll?rev=324734&r1=324733&r2=324734&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Mips/pr35071.ll (original)
+++ llvm/trunk/test/CodeGen/Mips/pr35071.ll Fri Feb  9 06:03:26 2018
@@ -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




More information about the llvm-commits mailing list