Avoiding gcc function prologue overhead?

后端 未结 5 1712
逝去的感伤
逝去的感伤 2021-02-13 21:57

I\'ve lately encountered a lot of functions where gcc generates really bad code on x86. They all fit a pattern of:

if (some_condition) {
    /* do something real         


        
5条回答
  •  礼貌的吻别
    2021-02-13 22:39

    Seeing as these are external calls, it might be possible the gcc is treating them as unsafe and preserving registers for the function call(hard to know without seeing the registers that it preserves, including the ones you say 'aren't used'). Out of curiousity, does this excessive register spilling still occur with all optimizations disabled?

提交回复
热议问题