<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><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><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>