I've heard a couple of times that compiler would not optimize inline assembly or that inline assembly is sort of a blackbox for it. I was suspicious and because I haven't seen any cases when the compiler failed, I didn't care.
But today I found a page on GCC wiki titled DontUseInlineAsm. It contained the same issues that people told me before, but there are no details on why compiler wouldn't understand inline asm and therefore wouldn't optimize it. So, does anyone know reasons for compilers to not do these optimizations?
Of course, I'm putting away special cases like
asm volatile("" : : "g"(value) : "memory");
or
asm volatile("" : : : "memory");
when we are explicitly telling the compiler that this code has visible side effects and therefore it shouldn't optimize it away.