<div dir="ltr">(and in particular, the definition of equivalence used by code folding to make the dags is STH like "two VNDAG expressions are equivalent if their operands come from VNDAG expressions with the same opcode")<div><br></div><div>Thus,</div><div><br></div><div>VN2 = VN0 + VN1</div><div>VN3 = VN1 + VN2<br></div><div><br></div><div>is considered equivalent to</div><div><br></div><div>VN2 = VN0 + VN5</div><div>VN3 = VN1 + VN2</div><div><br></div><div>Despite the fact that this is completely illegal for straight redundancy elimination.</div><div><br></div><div><br></div><div>But again, as I said if y'all want to make a pass that basically generates a new type of expression DAG, have fun :)</div><div><br></div><div>(I'm going to just leave this thread be now)</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 31, 2016 at 4:17 PM, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="font-family:arial,helvetica,sans-serif;font-size:10pt;color:#000000"><br>Yes, this was exactly my point. We want to recognize structurally-equivalent sequences of instructions on inequivalent operands.<br></div></blockquote><div><br></div></span><div>Yes, and my point is "none of the vn and vn-dag generating algorithms care".</div><div><br></div><div>you can define equivalent to be "structural", you can define it to be "these two variables are equivalent if they both start with "a"", you can define it however you want.</div><div>They will still give you the dags you want.</div><div><br></div><div>This is as simple as substituting a hash and equality function.</div><div><br></div><div>To whit: Actual compilers do it this way.</div><div><br></div><div>So i'm entirely unsure why there is such an argument that it hard or impossible, or even strange.</div><div><br></div><div>It is in fact quite easy, the same way GCC has had the VN pass that produces expression DAG output, and had it used to code hoisting, to do PRE, to do folding, to do whatever. It has been used for all of these thing.</div><div><br></div><div>Some of these use a more standard VN definition of equivalence that is useful for redundancy elimination.</div><div>Some of them use one that is meant for folding (and would be illegal to use for straight redundancy elimination).</div><div><br></div><div>If you want to build a pass that basically does the same thing, it seems silly, but feel free!<br></div><div><br></div><div><br></div><div><br><br></div></div></div></div>
</blockquote></div><br></div>