Verifying compiler optimizations in gcc/g++ by analyzing assembly listings

前端 未结 8 1934
闹比i
闹比i 2021-02-04 09:00

I just asked a question related to how the compiler optimizes certain C++ code, and I was looking around SO for any questions about how to verify that the compiler has performed

8条回答
  •  星月不相逢
    2021-02-04 09:32

    Not gcc, but when debugging in Visual Studio you have the option to intersperse assembly and source, which gives a good idea of what has been generated for what statement. But sometimes it's not quite aligned correctly.

    The output of the gcc tool chain and objdump -dS isn't at the same granularity. This article on getting gcc to output source and assembly has the same options as you are using.

提交回复
热议问题