This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

Re: GCC 4.8 and -ftree-loop-distribute-patterns.


On 02/14/2013 06:56 PM, Carlos O'Donell wrote:
> Team,
>
> In GCC 4.8 we now have -ftree-loop-distribute-patterns enabled at -O3.
> This optimization is unsafe in glibc. The optimization detects code
> patterns that match specific runtime functions and converts the code
> into a function call e.g. Call to memset for a loop that iterates over
> memory setting a value.
>
> We're already seeing the optimization breaking Fedora rawhide builds.
>
> I'm thinking we could unconditionally disable this optimization for
> elf/ and string/ subdirs?
>
> Where else are we going to need to disable this optimization?
>
> Do we need to detect GCC 4.8 and then add -fno-tree-loop-distribute-patterns?
>
> Cheers,
> Carlos.
>
I have noted this option also creating memmove calls when building some mpn
objects and memset call on wcsmbs files when building for PowerPC. I'm using
this patch to avoid such calls:

diff --git a/stdlib/Makefile b/stdlib/Makefile
index 6f98c71..dff5625 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -86,6 +86,9 @@ endif
 mpn-routines := inlines add_n addmul_1 cmp divmod_1 divrem udiv_qrnnd \
 		lshift rshift mod_1 mul mul_1 mul_n sub_n submul_1
 mpn-headers = longlong.h gmp.h gmp-impl.h gmp-mparam.h asm-syntax.h
+CFLAGS-divrem.c = -fno-tree-loop-distribute-patterns
+CFLAGS-mul.c = -fno-tree-loop-distribute-patterns
+CFLAGS-mul_n.c = -fno-tree-loop-distribute-patterns
 
 routines := $(strip $(routines) $(mpn-routines))	\
 	    dbl2mpn ldbl2mpn				\
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index 6ea2c09..214723e 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -67,6 +67,8 @@ CFLAGS-wcstoull_l.c = $(strtox-CFLAGS)
 CFLAGS-wcstod_l.c = $(strtox-CFLAGS)
 CFLAGS-wcstold_l.c = $(strtox-CFLAGS)
 CFLAGS-wcstof_l.c = $(strtox-CFLAGS)
+CFLAGS-wcpncpy.os = -fno-tree-loop-distribute-patterns
+CFLAGS-wcsncpy.os = -fno-tree-loop-distribute-patterns
 CPPFLAGS-tst-wchar-h.c = -D_FORTIFY_SOURCE=2
 
 CFLAGS-isoc99_wscanf.c += $(exceptions)


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