Heads-up: object size threshold for lifetime markers insertion will go away

Arnaud A. de Grandmaison arnaud.degrandmaison at arm.com
Tue Oct 7 10:03:05 PDT 2014


[Sorry for the cross-posting, but this future change in clang can affect
llvm optimization passes]

 

Language frontends can insert lifetime.start / lifetime.end markers for
objects allocated on the stack, providing the optimization passes in LLVM
with lifetime information so that they can share stack slots and reduce
stack usage of the generated code. Today, those lifetime markers are only
inserted for objects > 32 bytes. This threshold was set to prevent
impacting compile time. Lifetime markers have been in use for a long time
now, and some passes got fixed to deal gracefully with them.

 

I intend to commit soon a patch removing this threshold, unless someone
objects or raise concerns. Removing the threshold can only improve stack
size usage of the generated code, but there is a risk that some specific
code base trigger some corner case bugs, thus this heads-up.

 

I checked that compile time was not impacted by building llvm+clang+lldb
with a clang with various thresholds, and here are the results (user time in
seconds for a build from scratch, averaged over 5 builds). Note that the
reported  threshold is inclusive: 33 (the current threshold) means all
object whose size >= 33 bytes will be marked for example.

 


Threshold

Average

Variance


33

4652.67

4.51


32

4677.02

2.71


16

4681.50

11.06


8

4660.23

12.47


0

4667.47

8.63

 

There are some minor fluctuations that I cannot explain, but we just have no
compromise to make there: always insert the lifetime markers .

 

Thanks for your attention,

--

Arnaud A. de Grandmaison

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20141007/5b16bfb2/attachment.html>


More information about the cfe-commits mailing list