Why does the compiler need the intermediate representations for link time optimization?

111 Views Asked by At

My professor mentioned that gcc can be run with -flto. I am wondering why the intermediary (GIMPLE in GCC case) are needed.

Why is the assembly not sufficient?

He mentioned that this allows the compiler to (at link time) see from what the code was generated, rather than just looking at the code itself, and generate new code if necessary.

If this is the only reason, why would this be necessary? Is the code not already optimized (under the assumption you are using -flto correctly and passing the same flags)?

0

There are 0 best solutions below