[llvm-branch-commits] [llvm-branch] r243662 - Merging r243057:

Hans Wennborg hans at hanshq.net
Thu Jul 30 10:17:48 PDT 2015


Author: hans
Date: Thu Jul 30 12:17:47 2015
New Revision: 243662

URL: http://llvm.org/viewvc/llvm-project?rev=243662&view=rev
Log:
Merging r243057:
------------------------------------------------------------------------
r243057 | spatel | 2015-07-23 15:56:53 -0700 (Thu, 23 Jul 2015) | 16 lines

fix crash in machine trace metrics due to processing dbg_value instructions (PR24199)

The test in PR24199 ( https://llvm.org/bugs/show_bug.cgi?id=24199 ) crashes because machine
trace metrics was not ignoring dbg_value instructions when calculating data dependencies.

The machine-combiner pass asks machine trace metrics to calculate an instruction trace, 
does some reassociations, and calls MachineInstr::eraseFromParentAndMarkDBGValuesForRemoval()
along with MachineTraceMetrics::invalidate(). The dbg_value instructions have their operands
invalidated, but the instructions are not expected to be deleted.

On a subsequent loop iteration of the machine-combiner pass, machine trace metrics would be
called again and die while accessing the invalid debug instructions.

Differential Revision: http://reviews.llvm.org/D11423


------------------------------------------------------------------------

Added:
    llvm/branches/release_37/test/CodeGen/X86/machine-trace-metrics-crash.ll
      - copied unchanged from r243057, llvm/trunk/test/CodeGen/X86/machine-trace-metrics-crash.ll
Modified:
    llvm/branches/release_37/   (props changed)
    llvm/branches/release_37/lib/CodeGen/MachineTraceMetrics.cpp

Propchange: llvm/branches/release_37/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jul 30 12:17:47 2015
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,242236,242239,242281,242288,242296,242331,242341,242410,242412,242433-242434,242442,242543,242673,242680,242706,242721-242722,242733-242735,242742,242869,242919,242993,243001,243116,243263,243294,243361,243469,243485,243500,243519,243531,243589,243609,243636,243638,243640
+/llvm/trunk:155241,242236,242239,242281,242288,242296,242331,242341,242410,242412,242433-242434,242442,242543,242673,242680,242706,242721-242722,242733-242735,242742,242869,242919,242993,243001,243057,243116,243263,243294,243361,243469,243485,243500,243519,243531,243589,243609,243636,243638,243640

Modified: llvm/branches/release_37/lib/CodeGen/MachineTraceMetrics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/lib/CodeGen/MachineTraceMetrics.cpp?rev=243662&r1=243661&r2=243662&view=diff
==============================================================================
--- llvm/branches/release_37/lib/CodeGen/MachineTraceMetrics.cpp (original)
+++ llvm/branches/release_37/lib/CodeGen/MachineTraceMetrics.cpp Thu Jul 30 12:17:47 2015
@@ -624,6 +624,10 @@ struct DataDep {
 static bool getDataDeps(const MachineInstr *UseMI,
                         SmallVectorImpl<DataDep> &Deps,
                         const MachineRegisterInfo *MRI) {
+  // Debug values should not be included in any calculations.
+  if (UseMI->isDebugValue())
+    return false;
+  
   bool HasPhysRegs = false;
   for (MachineInstr::const_mop_iterator I = UseMI->operands_begin(),
        E = UseMI->operands_end(); I != E; ++I) {





More information about the llvm-branch-commits mailing list