Optimizing the shader: when to replace If statements by a Lerp?

It seems that you cannot create flexible and actual dynamic branch just using material function. Maybe there should be tick box inside if node that would actually emit true branch instead of ternary. On other hand driver compiler might actually just ignore hlsl spec if there are no any side effects from not evaluating both sides.