[llvm-commits] [llvm] r133412 - in /llvm/trunk: include/llvm/Constants.h lib/Analysis/ConstantFolding.cpp lib/AsmParser/LLParser.cpp lib/Bitcode/Reader/BitcodeReader.cpp lib/CodeGen/ShadowStackGC.cpp lib/Transforms/IPO/GlobalOpt.cpp lib/Transform

Chris Lattner sabre at nondot.org
Mon Jun 20 23:00:04 PDT 2011


On Jun 20, 2011, at 8:43 AM, Jay Foad wrote:

>> It would be "really really nice" if the ConstantStruct::get and
>> ConstantVector::get methods didn't make temporary std::vectors.
> 
> How about this then?
> 
> Patch 1 extends ConstantUniqueMap with a new template parameter
> ValRefType, representing a const reference to ValType. Normally this
> would just be const ValType&, but when ValType is a std::vector, we
> want to use ArrayRef as the reference type.
> 
> I had to add a conversion operator to ArrayRef to get this to work. Is
> this reasonable? (I've only been using C++ for 15 years so I haven't
> really got the hang of it yet.) This also makes the existing
> ArrayRef::vec() somewhat redundant, but I didn't remove it.
> 
> Patches 2/3/4 tidy up the get() methods of ConstantVector/Array/Struct
> to use ArrayRef throughout.
> 
> Tested with "make all check-all", LLVM and Clang. I don't think
> llvm-gcc-4.2 or dragonegg need any changes, based on a quick grep.

Wow, looks great to me Jay, you're awesome!

-Chris



More information about the llvm-commits mailing list