diff options
Diffstat (limited to 'gcc-4.9')
-rw-r--r-- | gcc-4.9/gcc/config/i386/i386.c | 6 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C | 26 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-12.c | 26 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-13.c | 18 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/pr64277.c | 23 | ||||
-rw-r--r-- | gcc-4.9/gcc/tree-ssa-loop-niter.c | 17 | ||||
-rw-r--r-- | gcc-4.9/gcc/tree-vrp.c | 2 | ||||
-rw-r--r-- | gcc-4.9/libgomp/config.h.in | 3 | ||||
-rwxr-xr-x | gcc-4.9/libgomp/configure | 31 | ||||
-rw-r--r-- | gcc-4.9/libgomp/configure.ac | 3 | ||||
-rw-r--r-- | gcc-4.9/libgomp/libgomp.h | 2 | ||||
-rw-r--r-- | gcc-4.9/libgomp/team.c | 6 |
12 files changed, 157 insertions, 6 deletions
diff --git a/gcc-4.9/gcc/config/i386/i386.c b/gcc-4.9/gcc/config/i386/i386.c index fcd5f0dd1..7226ee016 100644 --- a/gcc-4.9/gcc/config/i386/i386.c +++ b/gcc-4.9/gcc/config/i386/i386.c @@ -4050,6 +4050,12 @@ ix86_option_override_internal (bool main_args_p, opts->x_param_values, opts_set->x_param_values); + /* Increase full peel max insns parameter for x86. */ + maybe_set_param_value (PARAM_MAX_COMPLETELY_PEELED_INSNS, + 200, + opts->x_param_values, + opts_set->x_param_values); + /* Enable sw prefetching at -O3 for CPUS that prefetching is helpful. */ if (opts->x_flag_prefetch_loop_arrays < 0 && HAVE_prefetch diff --git a/gcc-4.9/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C b/gcc-4.9/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C new file mode 100644 index 000000000..f2e5f2f59 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/warn/Warray-bounds-6.C @@ -0,0 +1,26 @@ +// { dg-do compile } +// { dg-options "-O3 -Warray-bounds" } + +struct type { + bool a, b; + bool get_b() { return b; } +}; + +type stuff[9u]; + +void bar(); + +void foo() +{ + for(unsigned i = 0u; i < 9u; i++) + { + if(!stuff[i].a) + continue; + + bar(); + + for(unsigned j = i + 1u; j < 9u; j++) + if(stuff[j].a && stuff[j].get_b()) // { dg-bogus "above array bounds" } + return; + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-12.c b/gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-12.c new file mode 100644 index 000000000..ef26c6596 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-12.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -Warray-bounds" } */ +/* { dg-additional-options "-mssse3" { target x86_64-*-* i?86-*-* } } */ + +void foo(short a[], short m) +{ + int i, j; + int f1[10]; + short nc; + + nc = m + 1; + if (nc > 3) + { + for (i = 0; i <= nc; i++) + { + f1[i] = f1[i] + 1; + } + } + + for (i = 0, j = m; i < nc; i++, j--) + { + a[i] = f1[i]; /* { dg-bogus "above array bounds" } */ + a[j] = i; + } + return; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-13.c b/gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-13.c new file mode 100644 index 000000000..7b40a8388 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/Warray-bounds-13.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -Warray-bounds" } */ + +extern char *bar[17]; + +int foo(int argc, char **argv) +{ + int i; + int n = 0; + + for (i = 0; i < argc; i++) + n++; + + for (i = 0; i < argc; i++) + argv[i] = bar[i + n]; /* { dg-bogus "above array bounds" } */ + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr64277.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr64277.c new file mode 100644 index 000000000..c6ef33119 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr64277.c @@ -0,0 +1,23 @@ +/* PR tree-optimization/64277 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -Wall -Werror -fdump-tree-cunroll-details" } */ +/* { dg-final { scan-tree-dump "loop with 5 iterations completely unrolled" "cunroll" } } */ +/* { dg-final { scan-tree-dump "loop with 6 iterations completely unrolled" "cunroll" } } */ +/* { dg-final { cleanup-tree-dump "cunroll" } } */ + +int f1[10]; +void test1 (short a[], short m, unsigned short l) +{ + int i = l; + for (i = i + 5; i < m; i++) + f1[i] = a[i]++; +} + +void test2 (short a[], short m, short l) +{ + int i; + if (m > 5) + m = 5; + for (i = m; i > l; i--) + f1[i] = a[i]++; +} diff --git a/gcc-4.9/gcc/tree-ssa-loop-niter.c b/gcc-4.9/gcc/tree-ssa-loop-niter.c index 7628363cc..62175f344 100644 --- a/gcc-4.9/gcc/tree-ssa-loop-niter.c +++ b/gcc-4.9/gcc/tree-ssa-loop-niter.c @@ -2724,6 +2724,7 @@ record_nonwrapping_iv (struct loop *loop, tree base, tree step, gimple stmt, tree niter_bound, extreme, delta; tree type = TREE_TYPE (base), unsigned_type; double_int max; + tree orig_base = base; if (TREE_CODE (step) != INTEGER_CST || integer_zerop (step)) return; @@ -2747,7 +2748,14 @@ record_nonwrapping_iv (struct loop *loop, tree base, tree step, gimple stmt, if (tree_int_cst_sign_bit (step)) { + double_int min, max; extreme = fold_convert (unsigned_type, low); + if (TREE_CODE (orig_base) == SSA_NAME + && TREE_CODE (high) == INTEGER_CST + && INTEGRAL_TYPE_P (TREE_TYPE (orig_base)) + && get_range_info (orig_base, &min, &max) == VR_RANGE + && max.slt (TREE_INT_CST (high))) + base = double_int_to_tree (unsigned_type, max); if (TREE_CODE (base) != INTEGER_CST) base = fold_convert (unsigned_type, high); delta = fold_build2 (MINUS_EXPR, unsigned_type, base, extreme); @@ -2755,8 +2763,15 @@ record_nonwrapping_iv (struct loop *loop, tree base, tree step, gimple stmt, } else { + double_int min, max; extreme = fold_convert (unsigned_type, high); - if (TREE_CODE (base) != INTEGER_CST) + if (TREE_CODE (orig_base) == SSA_NAME + && TREE_CODE (low) == INTEGER_CST + && INTEGRAL_TYPE_P (TREE_TYPE (orig_base)) + && get_range_info (orig_base, &min, &max) == VR_RANGE + && min.sgt (TREE_INT_CST (low))) + base = double_int_to_tree (unsigned_type, min); + else if (TREE_CODE (base) != INTEGER_CST) base = fold_convert (unsigned_type, low); delta = fold_build2 (MINUS_EXPR, unsigned_type, extreme, base); } diff --git a/gcc-4.9/gcc/tree-vrp.c b/gcc-4.9/gcc/tree-vrp.c index 2c80135f9..b31194410 100644 --- a/gcc-4.9/gcc/tree-vrp.c +++ b/gcc-4.9/gcc/tree-vrp.c @@ -9728,7 +9728,7 @@ vrp_finalize (void) substitute_and_fold (op_with_constant_singleton_value_range, vrp_fold_stmt, false); - if (warn_array_bounds) + if (warn_array_bounds && first_pass_instance) check_all_array_refs (); /* We must identify jump threading opportunities before we release diff --git a/gcc-4.9/libgomp/config.h.in b/gcc-4.9/libgomp/config.h.in index 14c7e2a9a..9c26e6d98 100644 --- a/gcc-4.9/libgomp/config.h.in +++ b/gcc-4.9/libgomp/config.h.in @@ -76,6 +76,9 @@ /* Define to 1 if the target supports thread-local storage. */ #undef HAVE_TLS +/* Define to 1 if the target use emutls for thread-local storage. */ +#undef USE_EMUTLS + /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H diff --git a/gcc-4.9/libgomp/configure b/gcc-4.9/libgomp/configure index 39bb5cdee..784e69f7b 100755 --- a/gcc-4.9/libgomp/configure +++ b/gcc-4.9/libgomp/configure @@ -15535,6 +15535,37 @@ $as_echo "#define HAVE_TLS 1" >>confdefs.h fi +# See if we have emulated thread-local storage. + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the thread-local storage support is from emutls" >&5 +$as_echo_n "checking whether the thread-local storage support is from emutls... " >&6; } +if test "${gcc_cv_use_emutls+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + gcc_cv_use_emutls=no + echo '__thread int a; int b; int main() { return a = b; }' > conftest.c + if { ac_try='${CC-cc} -Werror -S -o conftest.s conftest.c 1>&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + if grep __emutls_get_address conftest.s > /dev/null; then + gcc_cv_use_emutls=yes + fi + fi + rm -f conftest.* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_use_emutls" >&5 +$as_echo "$gcc_cv_use_emutls" >&6; } + if test "$gcc_cv_use_emutls" = "yes" ; then + +$as_echo "#define USE_EMUTLS 1" >>confdefs.h + + fi + # See what sort of export controls are available. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the target supports hidden visibility" >&5 diff --git a/gcc-4.9/libgomp/configure.ac b/gcc-4.9/libgomp/configure.ac index 43632f74d..adf3177e0 100644 --- a/gcc-4.9/libgomp/configure.ac +++ b/gcc-4.9/libgomp/configure.ac @@ -245,6 +245,9 @@ fi # See if we support thread-local storage. GCC_CHECK_TLS +# See if we have emulated thread-local storage. +GCC_CHECK_EMUTLS + # See what sort of export controls are available. LIBGOMP_CHECK_ATTRIBUTE_VISIBILITY LIBGOMP_CHECK_ATTRIBUTE_DLLEXPORT diff --git a/gcc-4.9/libgomp/libgomp.h b/gcc-4.9/libgomp/libgomp.h index a1482ccfb..b694356f6 100644 --- a/gcc-4.9/libgomp/libgomp.h +++ b/gcc-4.9/libgomp/libgomp.h @@ -471,7 +471,7 @@ enum gomp_cancel_kind /* ... and here is that TLS data. */ -#ifdef HAVE_TLS +#if defined HAVE_TLS || defined USE_EMUTLS extern __thread struct gomp_thread gomp_tls_data; static inline struct gomp_thread *gomp_thread (void) { diff --git a/gcc-4.9/libgomp/team.c b/gcc-4.9/libgomp/team.c index e6a6d8ff6..594127ca1 100644 --- a/gcc-4.9/libgomp/team.c +++ b/gcc-4.9/libgomp/team.c @@ -37,7 +37,7 @@ pthread_key_t gomp_thread_destructor; /* This is the libgomp per-thread data structure. */ -#ifdef HAVE_TLS +#if defined HAVE_TLS || defined USE_EMUTLS __thread struct gomp_thread gomp_tls_data; #else pthread_key_t gomp_tls_key; @@ -70,7 +70,7 @@ gomp_thread_start (void *xdata) void (*local_fn) (void *); void *local_data; -#ifdef HAVE_TLS +#if defined HAVE_TLS || defined USE_EMUTLS thr = &gomp_tls_data; #else struct gomp_thread local_thr; @@ -916,7 +916,7 @@ gomp_team_end (void) static void __attribute__((constructor)) initialize_team (void) { -#ifndef HAVE_TLS +#if !defined HAVE_TLS && !defined USE_EMUTLS static struct gomp_thread initial_thread_tls_data; pthread_key_create (&gomp_tls_key, NULL); |