I think you missed my point. It’s educational, but its in no way applicable to optimizing on a source code level.
If a compiler does something weird with your source code, it is because it did static analysis on it and determined that the two operations were equivalent. It only does it if is faster and if it is equivalent. If you use it in your source code its either a) slower, b) not what you intended, or c) identical in effect and speed to more straightforward, cross platform, and future proof code. It can only hurt you to take inspiration from it for your high level source code.
I know it is unintuitive that optimization would not be unintuitive. It should be complicated. Right? It should be extra work. Right? Here is a shocking truth: If a compiler performs optimizations on your code, it does not mean your code is deficient and needs to be mucked around with until you confuse the compiler. It means your code is optimal.
Optimization and readability is also not a tradeoff. If it is, then you are using optimization techniques from the 80s and 90s that don’t work on modern computers. (Back when a several kilobytes was a lot of memory and all instructions took approximately the same long amount of time.) Desktop and mobile computers today are now literal super computers. Super computers are absolutely common place now, so a different programming style is required. They have a different architecture; it’s not that they’re just faster versions of old machines. I was not kidding that certain brute force methods are better than things liked linked list and quad trees.
Optimal code nowadays is code that can run on fast hardware (either in series or in parallel) without being interrupted. Complicated code uses complicated features which usually stalls the CPU or GPU; so, complicated high level code is the opposite of optimal. Also: The opposite of complicated code is not optimal. Conflating optimized/unoptimized with unreadable/readable is long outdated. It’s pretty great because you can use another programmer’s optimized code without even noticing. It’s also why making small changes like iterating over an array backwards may hurt performance even though it doesn’t seem more complex and it used to be a recommended optimization when C was still young.