diff options
author | Sanjay Patel <spatel@rotateright.com> | 2015-07-23 22:56:53 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2015-07-23 22:56:53 +0000 |
commit | f2fa58e744d5e209f2b398dbc7963813dab876c7 (patch) | |
tree | 48123bdad24f6ac17d59ebb94bda4780f45e7a9c /llvm/lib/CodeGen/MachineTraceMetrics.cpp | |
parent | 9b141ed48e2d0ae97631c39141de20191871304e (diff) | |
download | bcm5719-llvm-f2fa58e744d5e209f2b398dbc7963813dab876c7.tar.gz bcm5719-llvm-f2fa58e744d5e209f2b398dbc7963813dab876c7.zip |
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
llvm-svn: 243057
Diffstat (limited to 'llvm/lib/CodeGen/MachineTraceMetrics.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineTraceMetrics.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineTraceMetrics.cpp b/llvm/lib/CodeGen/MachineTraceMetrics.cpp index 9404c687d41..d9a6b68462e 100644 --- a/llvm/lib/CodeGen/MachineTraceMetrics.cpp +++ b/llvm/lib/CodeGen/MachineTraceMetrics.cpp @@ -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) { |