mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
[RegisterBankInfo] Fix the initialization of the map VT to RegBank.
Prior to this patch we could have read uninitialized memory. llvm-svn: 270303
This commit is contained in:
parent
d7d0f71629
commit
a48386a2aa
@ -272,9 +272,12 @@ protected:
|
||||
/// \post if Force == true then getRegBankForType(SVT) == &RegBank
|
||||
void recordRegBankForType(const RegisterBank &RegBank,
|
||||
MVT::SimpleValueType SVT, bool Force = false) {
|
||||
if (!VTToRegBank)
|
||||
if (!VTToRegBank) {
|
||||
VTToRegBank.reset(
|
||||
new const RegisterBank *[MVT::SimpleValueType::LAST_VALUETYPE]);
|
||||
std::fill(&VTToRegBank[0],
|
||||
&VTToRegBank[MVT::SimpleValueType::LAST_VALUETYPE], nullptr);
|
||||
}
|
||||
assert(SVT < MVT::SimpleValueType::LAST_VALUETYPE && "Out-of-bound access");
|
||||
// If we want to override the mapping or the mapping does not exits yet,
|
||||
// set the register bank for SVT.
|
||||
|
Loading…
Reference in New Issue
Block a user