[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

Jay Foad jay.foad at gmail.com
Mon Jun 20 08:43:15 PDT 2011


> 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.

OK to commit?

Thanks,
Jay.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-constantuniquemap.patch
Type: text/x-patch
Size: 5140 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110620/796bbb6f/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-constantvector.patch
Type: text/x-patch
Size: 2726 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110620/796bbb6f/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-constantarray.patch
Type: text/x-patch
Size: 8194 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110620/796bbb6f/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-constantstruct.patch
Type: text/x-patch
Size: 707 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110620/796bbb6f/attachment-0003.bin>


More information about the llvm-commits mailing list