<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Philip,<div><br></div><div>I've attached two simplified examples: does_optimize.ll and does_not_optimize.ll.</div><div><br></div><div>In both examples, the load/store of %STACK_BASEVAL and %STACK_LIMITVAL should be removed, since the values are never used. The difference is that in does_optimize.ll, the store is in the same block as the load, and in does_not_optimize.dll, the store is in a different block. </div><div><br></div><div>When optimizing does_optimize.ll, the DeadStoreElimination pass removes the store as as "Remove Store of Load from same pointer" (<a href="http://llvm.org/docs/doxygen/html/DeadStoreElimination_8cpp_source.html#l00510">http://llvm.org/docs/doxygen/html/DeadStoreElimination_8cpp_source.html#l00510</a>). </div><div><br></div><div>When optimizing does_not_optimize.ll, the store is not removed, because the corresponding load is in a different block. </div><div><br></div><div>In both cases, we load a value and then store in back into the same location, so both load and store should be optimized out.</div><div><br></div><div>Thanks,</div><div>Artem Dinaburg</div><div><br><div><div>On Nov 5, 2014, at 7:48 PM, Philip Reames <<a href="mailto:listmail@philipreames.com">listmail@philipreames.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta content="text/html; charset=windows-1252" http-equiv="Content-Type">
<div bgcolor="#FFFFFF" text="#000000">
<br>
<div class="moz-cite-prefix">On 10/24/2014 01:17 PM, Artem Dinaburg
wrote:<br>
</div>
<blockquote cite="mid:1E303223-D403-4FEA-90E2-FAD0D95092F3@trailofbits.com" type="cite">
<pre wrap="">Hi,
It looks like the DeadStoreElimination optimization doesn't work across BasicBlock boundaries. The project I'm working on (<a class="moz-txt-link-freetext" href="https://github.com/trailofbits/mcsema">https://github.com/trailofbits/mcsema</a>), would tremendously benefit from even simple cross-block DSE. </pre>
</blockquote>
If you have specific small examples which aren't getting caught, I'd
be interested in seeing test cases (as bugs.)
<blockquote cite="mid:1E303223-D403-4FEA-90E2-FAD0D95092F3@trailofbits.com" type="cite">
<pre wrap="">There was a patch to do non-local DSE few years ago (<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-January/028751.html">http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-January/028751.html</a>), but seems that the patch was never merged.
Is there an existing way to do cross-block DSE?</pre>
</blockquote>
EarlyCSE handles limited cases here. GVN probably could, but
doesn't seem to. (Which surprises me.)<br>
<blockquote cite="mid:1E303223-D403-4FEA-90E2-FAD0D95092F3@trailofbits.com" type="cite">
<pre wrap="">Was there something wrong with the original non-local DSE patch that it wasn't merged?</pre>
</blockquote>
I suspect it got lost in review. It looks like there were some
quality issues with the original implementation and the cycle never
got closed.<br>
<blockquote cite="mid:1E303223-D403-4FEA-90E2-FAD0D95092F3@trailofbits.com" type="cite">
<pre wrap="">
Thanks,
Artem
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu/">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
</div>
</blockquote></div></div></body></html>