[PATCH] D50433: A New Divergence Analysis for LLVM

Alexander via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 20 08:14:54 PDT 2018


alex-t added a comment.
Herald added a subscriber: jvesely.



> How do you deal with terminators that have more than two successors? Example:
> 
>   switch (divInt) {
>     case 0:
>      v = 1.0; break;
>     case 1:
>      v = 20.0; break;
>     default:
>     // do stuff (block D)
>     return;
>   }
>   // do other stuff, using 'v' (J)
>   
>   +----A----+
>   |    |    |
>   C0  C1    D
>   \   |    [..]
>    \  |
>      J
> 
> 
> J is control-dependent on A. Therefore, you will erase A from the PDT sets of C0 and C1. However, there exist two disjoint paths from A to J through C0 and C1, which make PHI nodes in J divergent.

This is correct. In fact, I was wrong. I had a look in my old code (it all was done in 2013) and appeared that I really use post-dominance of the join upon the PHI source block instead :)
So my approach is similar to your but in opposite direction.


Repository:
  rL LLVM

https://reviews.llvm.org/D50433





More information about the llvm-commits mailing list