CodeGen: Fix MachineInstr::print() for DBG_VALUE

Grab the `MDLocalVariable` from the second-to-last argument; the last
argument is an `MDExpression`, and mixing them up will crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234019 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2015-04-03 16:23:04 +00:00
parent efa23ae2a9
commit 2d2520986e
2 changed files with 58 additions and 2 deletions

View File

@@ -1711,9 +1711,9 @@ void MachineInstr::print(raw_ostream &OS, bool SkipOpers) const {
}
// Print debug location information.
if (isDebugValue() && getOperand(e - 1).isMetadata()) {
if (isDebugValue() && getOperand(e - 2).isMetadata()) {
if (!HaveSemi) OS << ";";
DIVariable DV(getOperand(e - 1).getMetadata());
DIVariable DV(getOperand(e - 2).getMetadata());
OS << " line no:" << DV.getLineNumber();
if (auto *InlinedAt = DV.getInlinedAt()) {
DebugLoc InlinedAtDL(InlinedAt);