<p dir="ltr">Hi Arnaud, </p>
<p dir="ltr">Can't this affect debugging as well?</p>
<p dir="ltr">I mean, if you run this on O1 or less, you'll have a lot more variables optimised away, especially at the end of the function, and at higher optimisation levels you'll have a lot less variables to care about. </p>

<p dir="ltr">Cheers, <br>
Renato </p>
<div class="gmail_quote">On 23 Jul 2014 01:23, "Arnaud A. de Grandmaison" <<a href="mailto:arnaud.degrandmaison@arm.com">arnaud.degrandmaison@arm.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-GB" link="blue" vlink="purple"><div><p class="MsoNormal">I am trying to implement the lifetime marker insertion for unnamed temporaries in order to reduce stack consumption.<u></u><u></u></p><p class="MsoNormal">
<u></u> <u></u></p><p class="MsoNormal">Inserting the lifetime.begin marker is the easy part; on the other hand,  inserting the lifetime.end gets a bit more complicated, as it involves scoping , exception handling and lifetime extension.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Ideally, the lifetime.end marker should be inserted when the scope is exited, after the cleanups have been run. The problem is that in some cases, an object with a  trivial destructor for example, there is … no cleanup.  The existence of cleanups appears in the AST with the ExpWithCleanups, which wraps the underlying MaterializeTemporaryExpr.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">This is used in CodeGenFunction::EmitLValue to start a new RunCleanupsScope when visiting an ExpWithCleanups. My problem is how can I add a RunCleanupScope for MaterializeTemporaryExpr that are not part of an ExpWithCleanups. I can not always add a new scope, because it would mess-up the cleanup ordering --- when there are cleanups, the lifetime.end marker should be emitted after the destructor.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Is there anything obvious I am missing ?<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Any hints would be welcome. <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Cheers,<u></u><u></u></p><p class="MsoNormal"><span>--<u></u><u></u></span></p><p class="MsoNormal"><span>Arnaud A. de Grandmaison<u></u><u></u></span></p><p class="MsoNormal">
<u></u> <u></u></p></div></div><br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div>