award The short answer is - yes, you should avoid branching. Doesn't matter which language/platform you use because it's a matter of hardware architecture.
The primary reason in shader code is that your GPU runs the same shader code for large number of input pixels/vertices in parallel. If some of those parallel "instances" need to run different branches you'll lose optimal performance.
But this is not all. The machine code instructions on modern hardware are typically run in a multi-stage pipeline. This allows for overlap of consecutive instruction execution, practically running several instructions in parallel. When a branching instruction is pushed down the pipeline, the processing unit has to fetch the next instruction before the branching condition is evaluated. So it will guess which branch to continue pushing into the pipeline. If it predicts wrong, it'll have to flush the pipeline, losing all of the work done on a wrong branch, and start over with the right one. This diminishes the performance boost gained from instruction-level parallelism.
Note that the instruction pipeline thing is also relevant for CPUs. If you're after high performance code, you should minimize branching in general (for example using ifs inside long loops).
As for which high level language instructions are "dangerous", just look at it from perspective of execution paths. If your code can potentially run through multiple execution paths it's a sign that is should be "refactored" so there is only one path. This will, beside if and switch also include for and while loops with non-constant number of iterations. So you need to watch out for basically all flow control instructions.