Frankly, my recommendation to you is to ignore that stuff. You need like 3 or 4 years of school to reach that level. You should have studied easier graph optimization problems (ex: Finite Automatia) first, before dealing with code-optimization.
The school curriculum is typically Programming 101 -> Data Structures -> Algorithms -> Finite Automata (aka: Regex) -> Pushdown Automata (aka: context-free grammars) -> Turing Machines (aka: general purpose code) -> Compilers (which use Finite Automata, Pushdown Automata, and Turing Machines simultaneously).
Basic Blocks are the graph structure that compilers use to think about code. Its a lot of graph-theory built up on a lot of language theory.
------
That being said: if you're actually interested in this stuff, then feel free to explore. But just beware, you've stumbled upon a very complex subject that is easily 4th year undergrad or even graduate-school level.
With enough effort, you'll understand things. But this is no subject for beginners to go around exploring by themselves.
-------
That being said, I want to encourage you to explore the subject anyway. Just explore the subject with awareness that there's a lot to understand here.
If you want to skip the 3ish years of elementary data-structures / comp. sci theory... I suggest starting with Static Single Assignment and working forward from here.
Perhaps they're talking about what ends up in a single basic block after the conversion to cmov? Still an odd way to describe it.
void swap_if(bool c, int& a, int& b) {
int ta = a, tb = b;
a = c ? tb : ta;
b = c ? ta : tb;
}
is very slow, under Gcc, when c is poorly predicted, as is typical when e.g. partitioning for quicksort. But how well it will be predicted depends on input data.Edit: compiling your code without modifications, but with `-Os` also gives two cmov's: https://godbolt.org/z/r86azb7be
I need to use inline assembly because of this.