[PATCH] D50433: A New Divergence Analysis for LLVM

Alexander via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 27 10:44:08 PDT 2018


alex-t added a comment.



> 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.
In the example above:

Lets say we have 2 different definitions of value X - x1 in C and x2 in D.
There also should be x0 that flows to A from it's predecessors.

Then there must be:
 x3 = PHI(x0, A, x2, C) in E      -   we have to check DF(A) V DF(C) = {..., A}
 x4 = PHI(x2, D, x3, E) in G      -   we have to check DF(D) V DF(E) = {B, C}     
 x5 = PHI(x2, C, x3, E) in H      -   we have to check DF(C) V DF(E) = {A, B, C}

and

x6 = PHI(x4, G, x5, H) in I      -   we have to check DF(G) V DF(H) = {A, E}

Although, I could miss something :)


Repository:
  rL LLVM

https://reviews.llvm.org/D50433





More information about the llvm-commits mailing list