You are here: HSA Programmer's Reference Manual Version 1.0.1 > Chapter 2. HSAIL Programming Model > Divergent Control Flow > (Post-)Dominator and Immediate (Post-)Dominator

(Post-)Dominator and Immediate (Post-)Dominator

The dominator of an instruction o is defined as a point p in the program such that every path from the start of the function or kernel that reaches o must go through p. No matter which path is taken from the start of the function or kernel to reach o, control will always pass through p. The immediate dominator is the unique point that does not dominate any other dominator of o.

The post-dominator of a branch instruction b is defined as a point p in the program such that every path from the instruction b that reaches the end of the function or kernel must go through p. No matter which path is taken out of b, control will eventually reach p. The immediate post-dominator is the unique point that does not post-dominate any other post-dominator of b.

For example:

cbr_b1 $c1, @x; // a conditional branch
// ...
@x:             // all code that leaves the cbr must eventually reach @x
// ...
@y:             // and that code must reach @y

In this example, both @x and @y are post-dominators of the branch, but only x is the immediate post-dominator.