GlobalISel: prevent heap use-after-free when looking up VReg.

Translating the constant can create more VRegs, which can invalidate the
reference into the DenseMap. So we have to look up the value again after all
that's happened.

llvm-svn: 292675
This commit is contained in:
Tim Northover 2017-01-20 23:25:17 +00:00
parent 67addbcacf
commit 7f3ad2e07b
1 changed files with 3 additions and 1 deletions

View File

@ -81,7 +81,9 @@ unsigned IRTranslator::getOrCreateVReg(const Value &Val) {
}
}
}
return ValReg;
// Look Val up again in case the reference has been invalidated since.
return ValToVReg[&Val];
}
int IRTranslator::getOrCreateFrameIndex(const AllocaInst &AI) {