[PATCH] Add control dependence computation that computes control dependence equivalence classes.

Daniel Berlin dberlin at dberlin.org
Mon Mar 30 15:01:28 PDT 2015


Ah. I wouldn't try to do this kind of thing outside of polly, which
uses SCoP's (which is essentially a variant of the progarm structure
tree).
At the point you are doing loop distribution, you'd be better off
eating the cost of post-dominators or something.

The reason, as i understand it, that post-dominators is disfavored, is
that nobody preserves/updates it so it stays slow :)
If we fixed that problem, you'd get control dependence without issue.


Note that control dependence equivalence is much easier to maintain if
we wanted to, separately, (it can be maintained in sqrt(n) log n per
edge insertion/deletion) time


On Mon, Mar 30, 2015 at 2:53 PM, Adam Nemet <anemet at apple.com> wrote:
> In http://reviews.llvm.org/D8568#149015, @dberlin wrote:
>
>> Actually, I thought of a case that won't work with that formulation:
>>
>> Given
>>  int a, b;
>>  int main(void)
>>  {
>>
>>   do {
>>       do {
>>          b = a +1;
>>      }
>>           while (b);
>>   } while (a);
>>   return 0;
>>
>> }
>>
>> b = a+ 1 is control dependent on both the while test edges.
>>  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.  )
>>
>> 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.
>>  You can recover info about CONDS from it, you just don' t know what the
>>  answer is.
>>
>> That is, CDEQ(w) is exactly the set of of things {for all blocks v in CFG |
>>  CONDS(v) == CONDS(w)}
>>
>> So you know that things in the same set must have the same CONDS, you just
>>  don't know what that CONDS is.
>>
>> 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).
>>
>> I would bet you could compute this in linear time from CDEQ.
>>  From CONDS, you can get CD.
>>
>> Though I admit, i'm curious what you would want the CD sets for.
>
>
> It would be for Loop Distribution where a partition is made up of the transitive closure of the dependent (data and control) instructions of the original seeding instructions.
>
> Thanks,
> Adam
>
>> 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.
>
>>  These are all computable directly from these sets.
>
>
>
>
>
> http://reviews.llvm.org/D8568
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
>



More information about the llvm-commits mailing list