forked from OSchip/llvm-project
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:
parent
67addbcacf
commit
7f3ad2e07b
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue