'How to determine if a `PHINode` is affected by a `if` branch

In llvm, a PHINode occurs when a variable assignment can not be determined statically. When PHINode occurs, I want to if the assignment in the PHINode is determined by a given if branch. For the three example below, the value of x in the first two is control-dependence on the value of config, but the third example does not.

enter image description here

Extended question

using PHINode->getIncomingBlock(i) can get the ith incoming basic block of the PHINode. The question is: does the edge imply by "incoming" must be an edge in CFG? or it may be a pure new edge.

Thanks!



Solution 1:[1]

My current version of rule:

there exist a successor of “if(config)” that dominate 
at least one but not all predecessors of PHI-instruction

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tim He