OSDN Git Service

[DebugInfo] Don't insert DEBUG_VALUE after terminators
authorStefan Maksimovic <stefan.maksimovic@mips.com>
Fri, 9 Feb 2018 14:03:26 +0000 (14:03 +0000)
committerStefan Maksimovic <stefan.maksimovic@mips.com>
Fri, 9 Feb 2018 14:03:26 +0000 (14:03 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324734 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 75e3d35..09168b6 100644 (file)
@@ -1097,7 +1097,7 @@ findNextInsertLocation(MachineBasicBlock *MBB,
   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;
index a77a59f..1c83069 100644 (file)
@@ -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 ae60f69..e4a1fcb 100644 (file)
@@ -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