>>105724552>An optimizing compiler IS an optimizing assembler.No it is not.
>C is converted to assemblyNo, it's converted to an IR, which is then converted to machine code. It never touches an assembly language.
Assembly isn't the same thing as machine code, you know. You only make the mistake because there are no transformations applied to an assembly language other than choosing the shortest encoding for an instruction. It's not even a real 1:1 mapping because of that.
Why doesn't nasm rewrite my subroutines, erase unused code paths and stores, perform tail-call optimization, optimize my register usage, etc.?
gcc can track things like unaliased pointers and perform code transformations that erases huge chunks of code and makes it go faster. Why can't assemblers do that?