🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #1419

CSE optimization opportunities missed (68k)

#1419
From: andrew morton
Date: Wed, 18 Nov 1992 17:03
46 lines
1263 bytes
A few things I have noticed in gcc2.2.2 (m68k):

The code

foo()
{
	bar(0x12345);
	bar(0x12345);
	bar(0x12345);
	bar(0x12345);
	bar(0x12345);
}

Doesn't put the constant into a register: it seems that
constant function arguments are being missed as CSE
candidates.

Also, in the code

foo(int a, int b, int c, int d)
{
	a += 0x12345;
	b += 0x12345;
	c += 0x12345;
	d += 0x12345;
	bar(a, b, c, d);
	zot(0x12345);
}

The constants used in the additions are held in a register
but that register is not used for the call to zot(): a constant
is pushed instead.

Thirdly, there seems to be a problem with -funroll-all-loops
and -frerun-cse-after-loops.  In the code

foo()
{
	int i;

	for (i = 0; i < 10; i++)
		bar();
}

The address of bar() is not held in a register after
unrolling.
Technical Details
Message-ID: <199211180103.AA11562@wampyr.cc.uow.edu.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cc.uow.EDU.AU!amorton

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cc.uow.EDU.AU!amorton
From: amorton@cc.uow.EDU.AU (andrew morton)
Subject: CSE optimization opportunities missed (68k)
Message-ID: <199211180103.AA11562@wampyr.cc.uow.edu.au>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 18 Nov 1992 17:03:01 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 48