<div dir="ltr">Oops. I didn't send this to the mailing list so the summary is missing. Adding below:<div><br></div><div><div>In Memcpy lowering we had missed a dependence from the load of the operation to successor operations. This causes us to potentially construct an in initial DAG with a memory dependence not fully represented in the chain sub-DAG but rather require looking at the entire DAG breaking alias analysis by allowing incorrect repositioning of memory operations.</div><div><br></div><div>To work around this, r200033 changed DAGCombiner::GatherAllAliases to be conservative if any possible issues to happen. Unfortunately this check forbade many non-problematic situations as well. For example, it's common for incoming argument lowering to add a non-aliasing load hanging off of EntryNode. Then, if GatherAllAliases visited EntryNode, it would find that other (unvisited) use of the EntryNode chain, and just give up entirely. Furthermore, the check was incomplete: it would not actually detect all such potentially problematic DAG constructions, because GatherAllAliases did not guarantee to visit all chain nodes going up to the root EntryNode. This is in general fine -- giving up early will just miss a potential optimization, not generate incorrect results. But, for this non-chain dependency detection code, it's possible that you could have a load attached to a higher-up chain node than any which were visited. If that load aliases your store, but the only dependency is through the value operand of a non-aliasing store, it would've been missed by this code, and potentially reordered.</div><div><br></div><div>With the dependence added, this check can be removed and Alas Analysis can be much more aggressive. This fixes code quality regression in the Consecutive Store Merge cleanup (D14834).</div><div><br></div><div>Test Change:</div><div><br></div><div>ppc64-align-long-double.ll now may see multiple serializations</div><div>of its stores</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 21, 2016 at 2:25 PM, Nirav Dave <span dir="ltr"><<a href="mailto:niravd@google.com" target="_blank">niravd@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">niravd updated this revision to Diff 51196.<br>
niravd added a comment.<br>
<span class="im HOEnZb"><br>
- In visitSTORE, always use FindBetterChain, rather than only when UseAA<br>
<br>
<br>
</span><div class="HOEnZb"><div class="h5"><a href="http://reviews.llvm.org/D18062" rel="noreferrer" target="_blank">http://reviews.llvm.org/D18062</a><br>
<br>
Files:<br>
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp<br>
  lib/CodeGen/SelectionDAG/SelectionDAG.cpp<br>
  test/CodeGen/PowerPC/ppc64-align-long-double.ll<br>
<br>
</div></div></blockquote></div><br></div>