optimization/3436: severe code quality regression when compiling gforth

Denys Duchier Denys.Duchier@ps.uni-sb.de
Wed Jun 27 03:08:00 GMT 2001


anton@mips.complang.tuwien.ac.at writes:

> That's quite close to optimal.  And here's what gcc-3.0 produces:
> 
> .L574:
> 	movl	4(%esi), %eax
> 	movl	__ctype_toupper, %ecx
> 	addl	$4, %esi
> 	leal	(%ebx,%eax), %ebx
> 	movl	-1476(%ebp), %eax
> 	addl	$4, %eax
> 	movl	%eax, -1476(%ebp)
> 	movl	-1476(%ebp), %eax
> 	jmp	*-4(%eax)
> 
> There are the following suboptimalities here:
> 
> 1) The "movl __ctype_toupper, %ecx" is not needed here; it is present
> in most of the primitives; maybe overly eager code motion?

This looks very much like a problem I had a while ago (in a bytecode
emulator).  GCC somehow gets it in its head to maintain a totally
useless invariant.  Brad Lucier suggested -fno-gcse and that worked
fine for me.

Cheers,

-- 
Dr. Denys Duchier			Denys.Duchier@ps.uni-sb.de
Forschungsbereich Programmiersysteme	(Programming Systems Lab)
Universitaet des Saarlandes, Geb. 45	http://www.ps.uni-sb.de/~duchier
Postfach 15 11 50			Phone: +49 681 302 5618
66041 Saarbruecken, Germany		Fax:   +49 681 302 5615



More information about the Gcc-bugs mailing list