diff options
author | Quentin Colombet <qcolombet@apple.com> | 2016-05-21 01:41:17 +0000 |
---|---|---|
committer | Quentin Colombet <qcolombet@apple.com> | 2016-05-21 01:41:17 +0000 |
commit | 9e57bf586ce72e30039a8b226ef1aa6c310d25b5 (patch) | |
tree | 9e2db478e6aefaceff0c77ca9bdf433323c4f5f4 /include | |
parent | 521e503c8b7898baf72f13c722d63a80ebf0fc97 (diff) |
[RegisterBankInfo] Fix the initialization of the map VT to RegBank.
Prior to this patch we could have read uninitialized memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@270303 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h b/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h index b640637cdee..8f7042655cb 100644 --- a/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h +++ b/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h @@ -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. |