<div dir="ltr"><div>Looks good with a small change. I'm surprised we previously only did this for named variables.</div><div><br></div><div>+namespace {</div><div>+/// A cleanup to call @llvm.lifetime.end.</div><div>+class CallLifetimeEndForUnnamed : public EHScopeStack::Cleanup {</div>
<div>+ llvm::Value *Addr;</div><div>+ llvm::Value *Size;</div><div>+</div><div>+public:</div><div>+ CallLifetimeEndForUnnamed(llvm::Value *addr, llvm::Value *size)</div><div>+ : Addr(addr), Size(size) {}</div><div>
+</div><div>+ void Emit(CodeGenFunction &CGF, Flags flags) override {</div><div>+ CGF.EmitLifetimeEnd(Size, Addr);</div><div>+ }</div><div>+};</div><div>+}</div><div><br></div><div>Can we avoid this duplication by adding and using CGF::pushLifetimeEndCleanup?</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 17, 2014 at 2:14 PM, Arnaud A. de Grandmaison <span dir="ltr"><<a href="mailto:arnaud.degrandmaison@arm.com" target="_blank">arnaud.degrandmaison@arm.com</a>></span> wrote:<br>
<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">This will improve stack slot reuse in the LLVM optimizers, especially with C++ where it is so easy to have lots of those unnamed temporaries, with small live ranges.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">The lifetime markers are only inserted if the temporaries are big enough, using the same value than for named objects (32 bytes). In a second step, I plan to play with this value to see where we stand with respect to performances & compile time.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">Could someone familiar with CodeGen have a look at this patch ?<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-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>