[PATCH] D50433: A New Divergence Analysis for LLVM

Alexander via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 30 06:50:07 PDT 2018


alex-t added a comment.

In https://reviews.llvm.org/D50433#1214912, @simoll wrote:

> In https://reviews.llvm.org/D50433#1214724, @alex-t wrote:
>
> > > Sorry, i am struggeling to follow.
> > >  Do you take the union of the PDF(P) for each immediate predecessor P of X? (where X is a potential join point).
> > >  That gives you invalid results.
> > > 
> > >         A
> > >       /   \
> > >      B     C
> > >    /  \   /  \
> > >   D     E     F
> > >    \  /   \  /
> > >      G     H
> > >      \    /
> > >         I
> > >    
> > >    
> > > 
> > > PDF(G) = {E, B}
> > >  PDF(H) = {E, C}
> > > 
> > > PDF(G) join PDF(H) =  {E, B, C}   (where join is set union).
> > >  Yet, there are two disjoint paths from A to I. But A is in none of these sets.
> >
> > You approach to the Control Dependence Analysis considering CFG only. You operate in terms ob BBs and branches.
> >  I start from the PHI. The idea is simple: each point where 2 values converge has already been found while building SSA and is annotated with the PHI node.
> >  I consider not PHI parent block predecessors PDF but PHI incoming values parent blocks PDFs.
>
>
> Let's say the phi node in block I reads `%x = phi double [ 0.0, %G ], [ 1.0, %H ]`. How do you detect the divergence in `%x`?


If A is divergent but E, B, C are uniform? Yes. A is not in PDF(G) because G does not post dominates B.
Although, such kind of CFG is a kind of corner case. Nevertheless, here we need DF+(I) that makes the algorithm much more complicated.


Repository:
  rL LLVM

https://reviews.llvm.org/D50433





More information about the llvm-commits mailing list