diff options
-rw-r--r-- | llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h | 3 | ||||
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h b/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h index d075d7ab10a..77c0a8cb48e 100644 --- a/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h +++ b/llvm/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h @@ -193,7 +193,8 @@ public: class OperandsMapper { /// The OpIdx-th cell contains the index in NewVRegs where the VRegs of the /// OpIdx-th operand starts. -1 means we do not have such mapping yet. - std::unique_ptr<int[]> OpToNewVRegIdx; + /// Note: We use a SmallVector to avoid heap allocation for most cases. + SmallVector<int, 8> OpToNewVRegIdx; /// Hold the registers that will be used to map MI with InstrMapping. SmallVector<unsigned, 8> NewVRegs; /// Current MachineRegisterInfo, used to create new virtual registers. diff --git a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp index 91681fb7a40..ca9e8e61552 100644 --- a/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp +++ b/llvm/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp @@ -513,7 +513,7 @@ RegisterBankInfo::OperandsMapper::OperandsMapper( MachineRegisterInfo &MRI) : MRI(MRI), MI(MI), InstrMapping(InstrMapping) { unsigned NumOpds = MI.getNumOperands(); - OpToNewVRegIdx.reset(new int[NumOpds]); + OpToNewVRegIdx.resize(NumOpds); std::fill(&OpToNewVRegIdx[0], &OpToNewVRegIdx[NumOpds], OperandsMapper::DontKnowIdx); assert(InstrMapping.verify(MI) && "Invalid mapping for MI"); |