This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by spatel on Jul 22 2015, 12:29 PM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

spatel updated this revision to Diff 30381.Jul 22 2015, 12:29 PM
spatel retitled this revision from to fix crash in machine trace metrics due to processing dbg_value instructions (PR24199).
spatel updated this object.
spatel added reviewers: Gerolf, stoklund, hfinkel.
spatel added a subscriber: llvm-commits.
Gerolf edited edge metadata.Jul 23 2015, 12:06 PM

Thanks for fixing this. LGTM.
Is there a similar problem in getPHIDeps?

Thanks for fixing this. LGTM.

Thanks for the review!

Is there a similar problem in getPHIDeps?

I thought that one was ok because we assert that the instruction is actually a PHI, so we know it's not a DBG_VALUE.

This revision was automatically updated to reflect the committed changes.