<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Thanks Nick!<div><br></div><div>Michael</div><div><br><div><div>On Jul 5, 2013, at 6:58 PM, Nick Lewycky <<a href="mailto:nicholas@mxc.ca">nicholas@mxc.ca</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Michael Gottesman wrote:<br><blockquote type="cite">Hello llvm-commits!<br><br>This patch teaches TRE how to understand/handle no capture allocas in order<br>to allow for more call sites to have the tail marker placed on them by the TRE pass.<br></blockquote><br>Also relevant, this is the second time this patch has been picked up and continued. Here's a link to the first time:<br><a href="http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130204/165122.html">http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130204/165122.html</a><br> continued<span class="Apple-converted-space"> </span><a href="http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130211/165176.html">http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130211/165176.html</a><br><br>Nick<br><br><blockquote type="cite">Without the changes introduced into this patch, if TRE saw any allocas at all,<br>TRE would not perform TRE *or* mark callsites with the tail marker.<br><br>Because TRE runs after mem2reg, this inadequacy is not a death sentence. But<br>given a callsite A without escaping alloca argument, A may not be able to have<br>the tail marker placed on it due to a separate callsite B having a write-back<br>parameter passed in via an argument with the nocapture attribute.<br><br>Assume that B is the only other callsite besides A and B only has nocapture<br>escaping alloca arguments (*NOTE* B may have other arguments that are not passed<br>allocas). In this case not marking A with the tail marker is unnecessarily<br>conservative since:<br><br> 1. By assumption A has no escaping alloca arguments itself so it can not<br> access the caller's stack via its arguments.<br><br> 2. Since all of B's escaping alloca arguments are passed as parameters with<br> the nocapture attribute, we know that B does not stash said escaping<br> allocas in a manner that outlives B itself and thus could be accessed<br> indirectly by A.<br><br>With the changes introduced by this patch:<br><br> 1. If we see any escaping allocas passed as a capturing argument, we do<br> nothing and bail early.<br><br> 2. If we do not see any escaping allocas passed as captured arguments but we<br> do see escaping allocas passed as nocapture arguments:<br><br> i. We do not perform TRE to avoid PR962 since the code generator produces<br> significantly worse code for the dynamic allocas that would be created<br> by the TRE algorithm.<br><br> ii. If we do not return twice, mark call sites without escaping allocas<br> with the tail marker. *NOTE* This excludes functions with escaping<br> nocapture allocas.<br><br> 3. If we do not see any escaping allocas at all (whether captured or not):<br><br> i. If we do not have usage of setjmp, mark all callsites with the tail<br> marker.<br><br> ii. If there are no dynamic/variable sized allocas in the function,<br> attempt to perform TRE on all callsites in the function.<br><br>Please Review,<br>Michael<br><br><br><br><br><br><br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></blockquote></div></blockquote></div><br></div></body></html>