gcc-2.95.2 non-optimal inlining

Mark Mitchell mark@codesourcery.com
Tue Apr 18 21:15:00 GMT 2000


>>>>> "Thomas" == Thomas Peterson <tompeterson@mn.mediaone.net> writes:

    Thomas> class Tester { public: int value1() { return value2(); }

    Thomas>   int value2 () { return 3; }

    Thomas>   int value3(); };

    Thomas> int Tester::value3() { return value1(); }

    Thomas> Shouldn't gcc be capable of producing the
    Thomas> optimal code without rearrangement of the functions?

Yes.  So we fixed it:

  value3__6Tester:
  .LFB1:
	  pushl	%ebp
  .LCFI0:
	  movl	$3, %eax
	  movl	%esp, %ebp
  .LCFI1:
	  popl	%ebp
	  ret

See http://gcc.gnu.org/news/inlining.html for details.

The next release of GCC will contain this functionality.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com


More information about the Gcc-bugs mailing list