diff --git a/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h b/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h index 77c0a8cb48e..f72fba20ecf 100644 --- a/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h +++ b/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h @@ -109,7 +109,8 @@ public: /// Cost of this mapping. unsigned Cost; /// Mapping of all the operands. - std::unique_ptr OperandsMapping; + /// Note: Use a SmallVector to avoid heap allocation in most cases. + SmallVector OperandsMapping; /// Number of operands. unsigned NumOperands; @@ -131,7 +132,7 @@ public: : ID(ID), Cost(Cost), NumOperands(NumOperands) { assert(getID() != InvalidMappingID && "Use the default constructor for invalid mapping"); - OperandsMapping.reset(new ValueMapping[getNumOperands()]); + OperandsMapping.resize(getNumOperands()); } /// Default constructor.