[llvm-bugs] [Bug 46974] New: Add specializations of small std::tuple to reduce pre-optimization code generation
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Aug 4 00:45:05 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=46974
Bug ID: 46974
Summary: Add specializations of small std::tuple to reduce
pre-optimization code generation
Product: libc++
Version: 11.0
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: dsharlet at google.com
CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
I've noticed that if I replace std::make_tuple(a, b) with std::make_pair(a, b)
where I can, I get a few percent reduction in the size of -S -emit-llvm -O0,
and build time with -O2 appears to go down by 3-5%. I didn't change anything
else (kept using std::get<0>/std::get<1> to access these tuples).
The thing is, std::tuple(a, b) where I know there are exactly two elements is
only a very small fraction of the tuple usage in my project. There are still
many usages of std::tuple<T...> where sizeof...(T) is 2, but I don't know that
at compile time. My program makes heavy use of tuple_cat and make_tuple. The
vast majority of the tuple usage is for <= 5 tuple elements.
It seems like if there were a special case implementation of std::tuple<>,
std::tuple<T>, std::tuple<T1, T2>, ... up to some small finite number of types,
it could have a significant impact on the pre-optimization code size and build
time of tuple-using code.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200804/438c1830/attachment.html>
More information about the llvm-bugs
mailing list