<div dir="ltr">Actually, I thought of a case that won't work with that formulation:<div><br></div><div>Given </div><div>int a, b;</div><div>int main(void)</div><div>{</div><div>    do {</div><div>        do {</div><div>           b = a +1;</div><div>       }</div><div>            while (b);</div><div>    } while (a);</div><div>    return 0;</div><div>}</div><div><br></div><div><br></div><div>b = a+ 1 is control dependent on both the while test edges.</div><div>Both both loops are in the same CDEQ set (for the same reason. In fact, simplifycfg will just make one single huge loop out of this.  )</div><div><br></div><div>So when you have things that are control dependent on multiple nodes in nested loops, you won't be able to determine both of the edges it's dependent on, since the equivalence class is essentially the set that is result of an equality query.  So you can't recover CD directly from it.</div><div>You can recover info about CONDS from it, you just don' t know what the answer is.</div><div><br></div><div>That is, CDEQ(w) is exactly the set of of things {for all blocks v in CFG | CONDS(v) == CONDS(w)}</div><div><br></div><div>So you know that things in the same set must have the same CONDS, you just don't know what that CONDS is.</div><div><br></div><div>However, you do know the answer to what CONDS is limited to the edges between the CDEQ blocks, and the boundary edges of the CDEQ blocks (IE the edges to a different equivalence class).</div><div><br></div><div>I would bet you could compute this in linear time from CDEQ.</div><div>From CONDS, you can get CD.</div><div><br></div><div>Though I admit, i'm curious what you would want the CD sets for.<br></div><div><div>Most things i've seen really want control-region info (so they can treat all things equivalent as one large basic block) or things like SESE regions (which can be computed in linear time from these sets) or the program structure tree or whatever.</div><div>These are all computable directly from these sets.</div><div><br></div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 30, 2015 at 10:36 AM, 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"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Tue, Mar 24, 2015 at 10:12 AM, Adam Nemet <span dir="ltr"><<a href="mailto:anemet@apple.com" target="_blank">anemet@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">================<br>
Comment at: test/Analysis/ControlDependence/testdiamond.ll:4-14<br>
@@ +3,13 @@<br>
+target datalayout = "e-i64:64-f80:128-n8:16:32:64-S128"<br>
+define void @testdiamond() {<br>
+start:<br>
+    br i1 true, label %same, label %different<br>
+same:<br>
+    br label %returnit<br>
+different:<br>
+    br label %returnit<br>
+returnit:<br>
+    ret void<br>
+}<br>
+; CHECK: ({different},{same},{returnit,start})<br>
+<br>
----------------<br>
Hi Danny,<br>
<br>
Quick question, is this control equivalence or control dependence?</blockquote><div><br></div></span><div>They are CDEQ sets, so control dependence equivalence :)</div><div><br></div><div>We can call it whatever we want.</div><span class=""><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">  Without looking at the details, it looks more like control equiv to me.  Can this analysis also provide control dependence?<br></blockquote><div><br></div></span><div>Without thinking too hard, you should be able to calculate the other sets from where the equivalence classes change.</div><div><br></div><div>IE the edge which leads from one equivalence class to another.</div><span class=""><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Also probably a silly question, but aren't 'different' and 'same' control-equiv here?  They both seem to be control-depended on start, no?<br>
<br></blockquote><div><br></div></span><div>No, because it's not really nodes but edges (because they are CDEQ sets, which are made up of edges)</div><div><br></div><div>The edge (start, different) is a different edge than (start, same), so they are not dependent on the same edge.</div><div><br></div><div><br></div></div></div></div>
</blockquote></div><br></div>