+++ title = "Phi-predication" author = "Yann Herklotz" tags = [] categories = [] backlinks = ["2b1d1", "2b1"] forwardlinks = ["2b1b"] zettelid = "2b1a" +++ Phi-predication \[1\] is a lightweight predication implementation where phi nodes are inserted in optimal positions instead of having predicated instructions. This makes it much better for out-of-order processors with deep pipelines, as there will be less pipeline stalls. This is because the predicate only needs to be evaluated at the time the phi-instruction is executed and not when the individual instructions are executed. For example, if there are two `mov` that are in two separate branches of a conditional statement, then the compare can first be executed, followed by the two `mov`, and then finally a phi instruction is executed which assigns the right value to the register.