This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/21712] New: inconsistent loop optimization


gcc -v
Lecture des spécification à partir de /usr/lib/gcc-lib/powerpc-linux/3.3.6/specs
Configuré avec: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared
--enable-__cxa_atexit --with-system-zlib --enable-nls --without-included-gettext
--enable-clocale=gnu --enable-debug --enable-java-gc=boehm
--enable-java-awt=xlib --enable-objc-gc --disable-multilib powerpc-linux
Modèle de thread: posix
version gcc 3.3.6 (Debian 1:3.3.6-5)


BEGIN_CODE
#define CONST __attribute__((const))

int get_type1(void) CONST;
int get_type2(void) CONST;

void* cast(void*, int) CONST;

void do_something(void*);

void baz(void* p)
{
	while(1)
	{
		do_something(cast(p, get_type1()));
		do_something(cast(p, get_type2()));
	}
}
END_CODE


gcc-4.0 -Wall -O3 -S

BEGIN_ASM
baz:
        mflr 0
        stwu 1,-16(1)
        stw 30,8(1)
        mr 30,3
        stw 31,12(1)
        stw 0,20(1)
        bl get_type1
        mr 4,3
        mr 3,30
        bl cast
        mr 31,3
.L3:
        mr 3,31
        bl do_something
        bl get_type2
        mr 4,3
        mr 3,30
        bl cast
        bl do_something
        b .L3
END_ASM


why the call to get_type2() and cast() are not moved outside the loop just like
get_type1() and the first call to cast() ?
Thanks.

-- 
           Summary: inconsistent loop optimization
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: TazForEver at dlfp dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21712


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]