Backports to 6.x
Hi! I've backported a bunch of patches to 6.x, after bootstrapping/regtesting them on x86_64-linux and i686-linux: Jakub 2016-09-16 Jakub Jelinek Backported from mainline 2016-09-05 Jakub Jelinek PR sanitizer/77396 * asan/asan_globals.cc: Cherry-pick upstream r280657. * g++.dg/asan/pr77396-2.C: New test. 2016-09-02 Jakub Jelinek PR sanitizer/77396 * g++.dg/asan/pr77396.C: New test. --- libsanitizer/asan/asan_globals.cc (revision 239997) +++ libsanitizer/asan/asan_globals.cc (revision 239998) @@ -248,10 +248,10 @@ void __asan_unregister_globals(__asan_gl // initializer can only touch global variables in the same TU. void __asan_before_dynamic_init(const char *module_name) { if (!flags()->check_initialization_order || - !CanPoisonMemory()) + !CanPoisonMemory() || + !dynamic_init_globals) return; bool strict_init_order = flags()->strict_init_order; - CHECK(dynamic_init_globals); CHECK(module_name); CHECK(asan_inited); BlockingMutexLock lock(&mu_for_globals); @@ -274,7 +274,8 @@ void __asan_before_dynamic_init(const ch // TU are poisoned. It simply unpoisons all dynamically initialized globals. void __asan_after_dynamic_init() { if (!flags()->check_initialization_order || - !CanPoisonMemory()) + !CanPoisonMemory() || + !dynamic_init_globals) return; CHECK(asan_inited); BlockingMutexLock lock(&mu_for_globals); --- gcc/testsuite/g++.dg/asan/pr77396.C (revision 0) +++ gcc/testsuite/g++.dg/asan/pr77396.C (revision 239961) @@ -0,0 +1,12 @@ +// PR sanitizer/77396 +// { dg-do run } +// { dg-set-target-env-var ASAN_OPTIONS "check_initialization_order=true" } + +static int a = 0; +static int b = a; + +int +main () +{ + return 0; +} --- gcc/testsuite/g++.dg/asan/pr77396-2.C (revision 0) +++ gcc/testsuite/g++.dg/asan/pr77396-2.C (revision 239998) @@ -0,0 +1,12 @@ +// PR sanitizer/77396 +// { dg-do run } +// { dg-set-target-env-var ASAN_OPTIONS "check_initialization_order=true" } + +struct S { S () { asm volatile ("" : : : "memory"); } }; +static S c; + +int +main () +{ + return 0; +} 2016-09-16 Jakub Jelinek Backported from mainline 2016-09-06 Jakub Jelinek PR target/69255 * config/i386/i386.c (ix86_expand_builtin): For builtin with unsupported or unknown ISA, use expand_call. * gcc.target/i386/pr69255-1.c: New test. * gcc.target/i386/pr69255-2.c: New test. * gcc.target/i386/pr69255-3.c: New test. --- gcc/config/i386/i386.c (revision 240013) +++ gcc/config/i386/i386.c (revision 240014) @@ -36107,7 +36107,7 @@ ix86_expand_builtin (tree exp, rtx targe error ("%qE needs isa option %s", fndecl, opts); free (opts); } - return const0_rtx; + return expand_call (exp, target, ignore); } switch (fcode) --- gcc/testsuite/gcc.target/i386/pr69255-1.c (revision 0) +++ gcc/testsuite/gcc.target/i386/pr69255-1.c (revision 240014) @@ -0,0 +1,17 @@ +/* PR target/69255 */ +/* { dg-do compile } */ +/* { dg-options "-msse4 -mno-avx" } */ + +#pragma GCC target "avx512vl" +#pragma GCC target "no-avx512vl" +__attribute__ ((__vector_size__ (32))) long long a; +__attribute__ ((__vector_size__ (16))) int b; + +void +foo (const long long *p) +{ + a = __builtin_ia32_gather3siv4di (a, p, b, 1, 1);/* { dg-error "needs isa option -m32 -mavx512vl" } */ +} + +/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ +/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ --- gcc/testsuite/gcc.target/i386/pr69255-2.c (revision 0) +++ gcc/testsuite/gcc.target/i386/pr69255-2.c (revision 240014) @@ -0,0 +1,17 @@ +/* PR target/69255 */ +/* { dg-do compile } */ +/* { dg-options "-msse4 -mno-avx" } */ + +#pragma GCC target "avx512vl" +#pragma GCC target "" +__attribute__ ((__vector_size__ (32))) long long a; +__attribute__ ((__vector_size__ (16))) int b; + +void +foo (const long long *p) +{ + __builtin_ia32_gather3siv4di (a, p, b, 1, 1);/* { dg-error "needs isa option -m32 -mavx512vl" } */ +} + +/* { dg-warning "AVX vector return without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ +/* { dg-warning "AVX vector argument without AVX enabled changes the ABI" "" { target *-*-* } 13 } */ --- gcc/testsuite/gcc.target/i386/pr69255-3.c (revision 0) +++ gcc/testsuite/gcc.target/i386/pr69255-3.c (revision 240014) @@ -0,0 +1,17 @@ +/* PR target/69255 */ +/* { dg-do compile } */ +/* { dg-options "-msse4 -mno-avx" } */ + +#pragma GCC target "avx512vl" +#pragma GCC target "" +__attribute__ ((__vector_size__ (32))) long long a; +__attribute__ ((__vector_size__ (16))) int b; + +void +foo (const long long *p, __attribute__ ((__vector_size__ (32))) long long *q) +{ + *q = __builtin_ia32_gather3siv4di (a, p, b, 1, 1); /* { dg-error "n
Backports to 6.x
As release managers are planning to release next version of GCC 6. I would like to do backport revisions attached. The only complicated one is the one for PR69953 where I decided to backport also refactoring patches applied by Nathan (244529, 244156). I would appreciate another pair of eyes to look at backports. Thanks, Martin >From 3d06a155b652468dae32382aae8abc9d6da10b77 Mon Sep 17 00:00:00 2001 From: marxin Date: Wed, 31 May 2017 11:40:13 + Subject: [PATCH 15/15] Backport r248729 gcc/ChangeLog: 2017-05-31 Martin Liska PR target/79155 * config/i386/cpuid.h: Fix typo in a comment in cpuid.h. --- gcc/config/i386/cpuid.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/i386/cpuid.h b/gcc/config/i386/cpuid.h index d67eeae75ce..89e260c62eb 100644 --- a/gcc/config/i386/cpuid.h +++ b/gcc/config/i386/cpuid.h @@ -172,7 +172,7 @@ /* Return highest supported input value for cpuid instruction. ext can - be either 0x0 or 0x800 to return highest supported value for + be either 0x0 or 0x8000 to return highest supported value for basic or extended cpuid information. Function returns 0 if cpuid is not supported or whatever cpuid returns in eax register. If sig pointer is non-null, then first four bytes of the signature -- 2.13.1 >From b921b54246135959a6fe9d4f6534299b3cc152fc Mon Sep 17 00:00:00 2001 From: marxin Date: Tue, 30 May 2017 08:02:03 + Subject: [PATCH 14/15] Backport r248647 gcc/ChangeLog: 2017-05-30 Martin Liska PR other/80909 * auto-profile.c (get_function_decl_from_block): Fix parenthesis. --- gcc/auto-profile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c index 94afe6fd2d9..2bf5e07ab25 100644 --- a/gcc/auto-profile.c +++ b/gcc/auto-profile.c @@ -353,7 +353,7 @@ get_function_decl_from_block (tree block) { tree decl; - if (LOCATION_LOCUS (BLOCK_SOURCE_LOCATION (block) == UNKNOWN_LOCATION)) + if (LOCATION_LOCUS (BLOCK_SOURCE_LOCATION (block)) == UNKNOWN_LOCATION) return NULL_TREE; for (decl = BLOCK_ABSTRACT_ORIGIN (block); -- 2.13.1 >From eec428d554a565ae1d73e6c5824474a5751bc7ce Mon Sep 17 00:00:00 2001 From: marxin Date: Fri, 26 May 2017 11:05:52 + Subject: [PATCH 13/15] Backport r248489 gcc/ChangeLog: 2017-05-26 Martin Liska PR ipa/80663 * params.def: Bound partial-inlining-entry-probability param. gcc/testsuite/ChangeLog: 2017-05-26 Martin Liska PR ipa/80663 * g++.dg/ipa/pr80212.C: Remove the test as it does not longer split at the problematic spot. * gcc.dg/ipa/pr48195.c: Change 101 to 100 as 101 is no longer a valid value of the param. --- gcc/params.def | 2 +- gcc/testsuite/g++.dg/ipa/pr80212.C | 18 -- gcc/testsuite/gcc.dg/ipa/pr48195.c | 2 +- 3 files changed, 2 insertions(+), 20 deletions(-) delete mode 100644 gcc/testsuite/g++.dg/ipa/pr80212.C diff --git a/gcc/params.def b/gcc/params.def index 76308cdfcdb..ce83aa71e6d 100644 --- a/gcc/params.def +++ b/gcc/params.def @@ -126,7 +126,7 @@ DEFPARAM (PARAM_COMDAT_SHARING_PROBABILITY, DEFPARAM (PARAM_PARTIAL_INLINING_ENTRY_PROBABILITY, "partial-inlining-entry-probability", "Maximum probability of the entry BB of split region (in percent relative to entry BB of the function) to make partial inlining happen.", - 70, 0, 0) + 70, 0, 100) /* Limit the number of expansions created by the variable expansion optimization to avoid register pressure. */ diff --git a/gcc/testsuite/g++.dg/ipa/pr80212.C b/gcc/testsuite/g++.dg/ipa/pr80212.C deleted file mode 100644 index 60d3b613035..000 --- a/gcc/testsuite/g++.dg/ipa/pr80212.C +++ /dev/null @@ -1,18 +0,0 @@ -// PR ipa/80212 -// { dg-options "-O2 --param partial-inlining-entry-probability=403796683 -fno-early-inlining" } - -struct b -{ - virtual b *c () const; -}; -struct d : virtual b -{ -}; -struct e : d -{ - e * - c () const - { - } -}; -main () { e a; } diff --git a/gcc/testsuite/gcc.dg/ipa/pr48195.c b/gcc/testsuite/gcc.dg/ipa/pr48195.c index 2e38452d598..25e80bab8f8 100644 --- a/gcc/testsuite/gcc.dg/ipa/pr48195.c +++ b/gcc/testsuite/gcc.dg/ipa/pr48195.c @@ -1,5 +1,5 @@ /* { dg-do link } */ -/* { dg-options "-O2 -flto --param partial-inlining-entry-probability=101" } */ +/* { dg-options "-O2 -flto --param partial-inlining-entry-probability=100" } */ /* { dg-require-effective-target lto } */ extern void abort(void); -- 2.13.1 >From 59383db2594cfaf380ce6e91a14b4b11f977f497 Mon Sep 17 00:00:00 2001 From: marxin Date: Tue, 16 May 2017 08:57:05 + Subject: [PATCH 12/15] Backport r248089 gcc/ChangeLog: 2017-05-16 Martin Liska PR ipa/79849. PR ipa/79850. * ipa-devirt.c (warn_types_mismatch): Fix typo. (odr_types_equivalent_p): Likewise. --- gcc/ipa-devirt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 0332b3ec616..9853c4a499c 100644 --- a/gcc/ipa-devirt.c ++
Backports to 6.x
Hi! I've backported a couple of patches to gcc-6-branch after bootstrapping/regtesting them on x86_64-linux and i686-linux. Jakub 2017-01-17 Jakub Jelinek Backported from mainline 2016-12-21 Jakub Jelinek PR fortran/78866 * openmp.c (resolve_omp_clauses): Diagnose assumed size arrays in OpenMP map, to and from clauses. * trans-openmp.c: Include diagnostic-core.h, temporarily redefining GCC_DIAG_STYLE to __gcc_tdiag__. (gfc_omp_finish_clause): Diagnose implicitly mapped assumed size arrays. * gfortran.dg/gomp/map-1.f90: Add expected error. * gfortran.dg/gomp/pr78866-1.f90: New test. * gfortran.dg/gomp/pr78866-2.f90: New test. --- gcc/fortran/openmp.c(revision 243859) +++ gcc/fortran/openmp.c(revision 243860) @@ -3530,6 +3530,11 @@ resolve_omp_clauses (gfc_code *code, gfc else resolve_oacc_data_clauses (n->sym, n->where, name); } + else if (list != OMP_CLAUSE_DEPEND +&& n->sym->as +&& n->sym->as->type == AS_ASSUMED_SIZE) + gfc_error ("Assumed size array %qs in %s clause at %L", +n->sym->name, name, &n->where); } if (list != OMP_LIST_DEPEND) --- gcc/fortran/trans-openmp.c (revision 243859) +++ gcc/fortran/trans-openmp.c (revision 243860) @@ -37,6 +37,11 @@ along with GCC; see the file COPYING3. #include "arith.h" #include "omp-low.h" #include "gomp-constants.h" +#undef GCC_DIAG_STYLE +#define GCC_DIAG_STYLE __gcc_tdiag__ +#include "diagnostic-core.h" +#undef GCC_DIAG_STYLE +#define GCC_DIAG_STYLE __gcc_gfc__ int ompws_flags; @@ -1028,6 +1033,21 @@ gfc_omp_finish_clause (tree c, gimple_se return; tree decl = OMP_CLAUSE_DECL (c); + + /* Assumed-size arrays can't be mapped implicitly, they have to be + mapped explicitly using array sections. */ + if (TREE_CODE (decl) == PARM_DECL + && GFC_ARRAY_TYPE_P (TREE_TYPE (decl)) + && GFC_TYPE_ARRAY_AKIND (TREE_TYPE (decl)) == GFC_ARRAY_UNKNOWN + && GFC_TYPE_ARRAY_UBOUND (TREE_TYPE (decl), + GFC_TYPE_ARRAY_RANK (TREE_TYPE (decl)) - 1) +== NULL) +{ + error_at (OMP_CLAUSE_LOCATION (c), + "implicit mapping of assumed size array %qD", decl); + return; +} + tree c2 = NULL_TREE, c3 = NULL_TREE, c4 = NULL_TREE; if (POINTER_TYPE_P (TREE_TYPE (decl))) { --- gcc/testsuite/gfortran.dg/gomp/pr78866-1.f90(nonexistent) +++ gcc/testsuite/gfortran.dg/gomp/pr78866-1.f90(revision 243860) @@ -0,0 +1,19 @@ +! PR fortran/78866 +! { dg-do compile } + +subroutine pr78866(x) + integer :: x(*) +!$omp target map(x)! { dg-error "Assumed size array" } + x(1) = 1 +!$omp end target +!$omp target data map(tofrom: x) ! { dg-error "Assumed size array" } +!$omp target update to(x) ! { dg-error "Assumed size array" } +!$omp target update from(x)! { dg-error "Assumed size array" } +!$omp end target data +!$omp target map(x(:23)) ! { dg-bogus "Assumed size array" } + x(1) = 1 +!$omp end target +!$omp target map(x(:)) ! { dg-error "upper bound of assumed size array section" } + x(1) = 1 ! { dg-error "not a proper array section" "" { target *-*-* } .-1 } +!$omp end target +end --- gcc/testsuite/gfortran.dg/gomp/pr78866-2.f90(nonexistent) +++ gcc/testsuite/gfortran.dg/gomp/pr78866-2.f90(revision 243860) @@ -0,0 +1,9 @@ +! PR fortran/78866 +! { dg-do compile } + +subroutine pr78866(x) + integer :: x(*) +!$omp target ! { dg-error "implicit mapping of assumed size array" } + x(1) = 1 +!$omp end target +end --- gcc/testsuite/gfortran.dg/gomp/map-1.f90(revision 243859) +++ gcc/testsuite/gfortran.dg/gomp/map-1.f90(revision 243860) @@ -70,7 +70,7 @@ subroutine test(aas) ! { dg-error "Rightmost upper bound of assumed size array section not specified" "" { target *-*-* } 68 } ! { dg-error "'aas' in MAP clause at \\\(1\\\) is not a proper array section" "" { target *-*-* } 68 } - !$omp target map(aas) ! { dg-error "The upper bound in the last dimension must appear" "" { xfail *-*-* } } + !$omp target map(aas) ! { dg-error "Assumed size array" } !$omp end target !$omp target map(aas(5:7)) 2017-01-17 Jakub Jelinek Backported from mainline 2017-01-04 Jakub Jelinek PR c++/71182 * parser.c (cp_lexer_previous_token): Use vec_safe_address in the assertion, as lexer->buffer may be NULL. * g++.dg/cpp0x/pr71182.C: New test. --- gcc/cp/parser.c (revision 244069) +++ gcc/cp/parser.c (revision 244070) @@ -766,7 +766,7 @@ cp_lexer_previous_token (cp_lexer *lexer /* Skip past purged tokens. */ while (tp->purged_p) { - gcc_assert
Backports to 6.x
Hi! I've backported 13 commits of mine and one from Richard. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to gcc-6-branch. Jakub 2017-09-15 Jakub Jelinek Backported from mainline 2017-06-30 Jakub Jelinek PR target/81225 * config/i386/sse.md (vec_extract_lo_): For V8FI, V16FI and VI8F_256 iterators, use instead of nonimmediate_operand and instead of m for the input operand. For V8FI iterator, always split if input is a MEM. For V16FI and V8SF_256 iterators, don't test if both operands are MEM if . For VI4F_256 iterator, use instead of register_operand and instead of v for the input operand. Make sure both operands aren't MEMs for if not . * gcc.target/i386/pr81225.c: New test. --- gcc/config/i386/sse.md (revision 250284) +++ gcc/config/i386/sse.md (revision 250285) @@ -7230,12 +7230,13 @@ (define_insn "vec_extract_lo__mask (define_insn "vec_extract_lo_" [(set (match_operand: 0 "" "=,v") (vec_select: - (match_operand:V8FI 1 "nonimmediate_operand" "v,m") + (match_operand:V8FI 1 "" "v,") (parallel [(const_int 0) (const_int 1) (const_int 2) (const_int 3)])))] - "TARGET_AVX512F && !(MEM_P (operands[0]) && MEM_P (operands[1]))" + "TARGET_AVX512F + && ( || !(MEM_P (operands[0]) && MEM_P (operands[1])))" { - if ( || !TARGET_AVX512VL) + if ( || (!TARGET_AVX512VL && !MEM_P (operands[1]))) return "vextract64x4\t{$0x0, %1, %0|%0, %1, 0x0}"; else return "#"; @@ -7374,14 +7375,15 @@ (define_expand "avx_vextractf128" (define_insn "vec_extract_lo_" [(set (match_operand: 0 "nonimmediate_operand" "=v,m") (vec_select: - (match_operand:V16FI 1 "nonimmediate_operand" "vm,v") + (match_operand:V16FI 1 "" +",v") (parallel [(const_int 0) (const_int 1) (const_int 2) (const_int 3) (const_int 4) (const_int 5) (const_int 6) (const_int 7)])))] "TARGET_AVX512F && - && !(MEM_P (operands[0]) && MEM_P (operands[1]))" + && ( || !(MEM_P (operands[0]) && MEM_P (operands[1])))" { if () return "vextract32x8\t{$0x0, %1, %0|%0, %1, 0x0}"; @@ -7413,11 +7415,12 @@ (define_split (define_insn "vec_extract_lo_" [(set (match_operand: 0 "" "=v,m") (vec_select: - (match_operand:VI8F_256 1 "nonimmediate_operand" "vm,v") + (match_operand:VI8F_256 1 "" + ",v") (parallel [(const_int 0) (const_int 1)])))] "TARGET_AVX && && - && !(MEM_P (operands[0]) && MEM_P (operands[1]))" + && ( || !(MEM_P (operands[0]) && MEM_P (operands[1])))" { if () return "vextract64x2\t{$0x0, %1, %0%{%3%}|%0%{%3%}, %1, 0x0}"; @@ -7493,12 +7496,16 @@ (define_split (define_insn "vec_extract_lo_" - [(set (match_operand: 0 "" "=") + [(set (match_operand: 0 "" + "=,v") (vec_select: - (match_operand:VI4F_256 1 "register_operand" "v") + (match_operand:VI4F_256 1 "" + "v,") (parallel [(const_int 0) (const_int 1) (const_int 2) (const_int 3)])))] - "TARGET_AVX && && " + "TARGET_AVX + && && + && ( || !(MEM_P (operands[0]) && MEM_P (operands[1])))" { if () return "vextract32x4\t{$0x0, %1, %0|%0, %1, 0x0}"; --- gcc/testsuite/gcc.target/i386/pr81225.c (nonexistent) +++ gcc/testsuite/gcc.target/i386/pr81225.c (revision 250285) @@ -0,0 +1,14 @@ +/* PR target/81225 */ +/* { dg-do compile } */ +/* { dg-options "-mavx512ifma -O3 -ffloat-store" } */ + +long a[24]; +float b[4], c[24]; +int d; + +void +foo () +{ + for (d = 0; d < 24; d++) +c[d] = (float) d ? : b[a[d]]; +} 2017-09-15 Jakub Jelinek PR libquadmath/65757 * math/roundq.c: Cherry-pick upstream glibc 2015-04-28 change. --- libquadmath/math/roundq.c (revision 250378) +++ libquadmath/math/roundq.c (revision 250379) @@ -1,5 +1,5 @@ /* Round __float128 to integer away from zero. - Copyright (C) 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1997-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997 and Jakub Jelinek , 1999. @@ -32,7 +32,7 @@ roundq (__float128 x) GET_FLT128_WORDS64 (i0, i1, x); j0 = ((i0 >> 48) & 0x7fff) - 0x3fff; - if (j0 < 31) + if (j0 < 48) { if (j0 < 0) { 2017-09-15 Jakub Jelinek Backported from mainline 2017-08-08 Richard Biener PR middle-end/81766 * function.c (thread_prologue_and_epilogue_insns): Restore behavior of always calling find_many_sub_basic_blocks on the inserted prologue. * gcc.target/i386/pr81766.c: New testcase. 2017-08-02 Jakub Jelinek
Backports to 6.x
Hi! I've bootstrapped/regtested following patches on x86_64-linux and i686-linux on gcc-6-branch and committed them to 6.x. Jakub 2017-02-15 Jakub Jelinek Backported from mainline 2017-01-17 Kito Cheng Kuan-Lin Chen PR target/79079 * internal-fn.c (expand_mul_overflow): Use convert_modes instead of gen_lowpart. --- gcc/internal-fn.c (revision 244538) +++ gcc/internal-fn.c (revision 244539) @@ -1483,8 +1483,8 @@ expand_mul_overflow (location_t loc, tre res = expand_expr_real_2 (&ops, NULL_RTX, wmode, EXPAND_NORMAL); rtx hipart = expand_shift (RSHIFT_EXPR, wmode, res, prec, NULL_RTX, uns); - hipart = gen_lowpart (mode, hipart); - res = gen_lowpart (mode, res); + hipart = convert_modes (mode, wmode, hipart, uns); + res = convert_modes (mode, wmode, res, uns); if (uns) /* For the unsigned multiplication, there was overflow if HIPART is non-zero. */ @@ -1517,16 +1517,16 @@ expand_mul_overflow (location_t loc, tre unsigned int hprec = GET_MODE_PRECISION (hmode); rtx hipart0 = expand_shift (RSHIFT_EXPR, mode, op0, hprec, NULL_RTX, uns); - hipart0 = gen_lowpart (hmode, hipart0); - rtx lopart0 = gen_lowpart (hmode, op0); + hipart0 = convert_modes (hmode, mode, hipart0, uns); + rtx lopart0 = convert_modes (hmode, mode, op0, uns); rtx signbit0 = const0_rtx; if (!uns) signbit0 = expand_shift (RSHIFT_EXPR, hmode, lopart0, hprec - 1, NULL_RTX, 0); rtx hipart1 = expand_shift (RSHIFT_EXPR, mode, op1, hprec, NULL_RTX, uns); - hipart1 = gen_lowpart (hmode, hipart1); - rtx lopart1 = gen_lowpart (hmode, op1); + hipart1 = convert_modes (hmode, mode, hipart1, uns); + rtx lopart1 = convert_modes (hmode, mode, op1, uns); rtx signbit1 = const0_rtx; if (!uns) signbit1 = expand_shift (RSHIFT_EXPR, hmode, lopart1, hprec - 1, @@ -1717,11 +1717,12 @@ expand_mul_overflow (location_t loc, tre if (loxhi >> (bitsize / 2) == 0 (if uns). */ rtx hipartloxhi = expand_shift (RSHIFT_EXPR, mode, loxhi, hprec, NULL_RTX, 0); - hipartloxhi = gen_lowpart (hmode, hipartloxhi); + hipartloxhi = convert_modes (hmode, mode, hipartloxhi, 0); rtx signbitloxhi = const0_rtx; if (!uns) signbitloxhi = expand_shift (RSHIFT_EXPR, hmode, -gen_lowpart (hmode, loxhi), +convert_modes (hmode, mode, + loxhi, 0), hprec - 1, NULL_RTX, 0); do_compare_rtx_and_jump (signbitloxhi, hipartloxhi, NE, true, hmode, @@ -1731,7 +1732,8 @@ expand_mul_overflow (location_t loc, tre /* res = (loxhi << (bitsize / 2)) | (hmode) lo0xlo1; */ rtx loxhishifted = expand_shift (LSHIFT_EXPR, mode, loxhi, hprec, NULL_RTX, 1); - tem = convert_modes (mode, hmode, gen_lowpart (hmode, lo0xlo1), 1); + tem = convert_modes (mode, hmode, + convert_modes (hmode, mode, lo0xlo1, 1), 1); tem = expand_simple_binop (mode, IOR, loxhishifted, tem, res, 1, OPTAB_DIRECT); 2017-02-15 Jakub Jelinek Backported from mainline 2017-01-31 Jakub Jelinek PR tree-optimization/79267 * value-prof.c (gimple_ic): Only drop lhs for noreturn calls if should_remove_lhs_p is true. * g++.dg/opt/pr79267.C: New test. --- gcc/value-prof.c(revision 245052) +++ gcc/value-prof.c(revision 245053) @@ -1376,7 +1376,13 @@ gimple_ic (gcall *icall_stmt, struct cgr gimple_call_set_fndecl (dcall_stmt, direct_call->decl); dflags = flags_from_decl_or_type (direct_call->decl); if ((dflags & ECF_NORETURN) != 0) -gimple_call_set_lhs (dcall_stmt, NULL_TREE); +{ + tree lhs = gimple_call_lhs (dcall_stmt); + if (lhs + && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (lhs))) == INTEGER_CST + && !TREE_ADDRESSABLE (TREE_TYPE (lhs))) + gimple_call_set_lhs (dcall_stmt, NULL_TREE); +} gsi_insert_before (&gsi, dcall_stmt, GSI_SAME_STMT); /* Fix CFG. */ --- gcc/testsuite/g++.dg/opt/pr79267.C (nonexistent) +++ gcc/testsuite/g++.dg/opt/pr79267.C (revision 245053) @@ -0,0 +1,69 @@ +// PR tree-optimization/79267 +// { dg-do compile } +// { dg-options "-O3" } + +struct A { A (int); }; +struct B +{ + virtual void av () = 0; + void aw (); + void h () { av (); aw (); } +}; +template struct G : B +{ + T ba; +
Re: Backports to 6.x
On 06/21/2017 04:14 AM, Martin Liška wrote: As release managers are planning to release next version of GCC 6. I would like to do backport revisions attached. The only complicated one is the one for PR69953 where I decided to backport also refactoring patches applied by Nathan (244529, 244156). I would appreciate another pair of eyes to look at backports. Looks good to me. nathan -- Nathan Sidwell
Re: Backports to 6.x
On Wed, Jun 21, 2017 at 1:17 PM, Nathan Sidwell wrote: > On 06/21/2017 04:14 AM, Martin Liška wrote: >> >> As release managers are planning to release next version of GCC 6. I would >> like to >> do backport revisions attached. >> >> The only complicated one is the one for PR69953 where I decided to >> backport >> also refactoring patches applied by Nathan (244529, 244156). >> >> I would appreciate another pair of eyes to look at backports. > > > Looks good to me. Yep. Ok. Richard. > nathan > > -- > Nathan Sidwell
[committed] Backports to 6.x branch
Hi! I've committed following backports of some trunk fixes, after bootstrapping/regtesting them on x86_64-linux and i686-linux. Jakub 2016-09-01 Jakub Jelinek Backported from mainline 2016-08-16 Jakub Jelinek PR target/71910 * tree-cfg.c (execute_fixup_cfg): Add node variable, use it. Before inlining, add cgraph edge for the added __builtin_unreachable call. * g++.dg/gomp/pr71910.C: New test. --- gcc/tree-cfg.c (revision 239507) +++ gcc/tree-cfg.c (revision 239508) @@ -8987,16 +8987,14 @@ execute_fixup_cfg (void) gcov_type count_scale; edge e; edge_iterator ei; + cgraph_node *node = cgraph_node::get (current_function_decl); count_scale - = GCOV_COMPUTE_SCALE (cgraph_node::get (current_function_decl)->count, - ENTRY_BLOCK_PTR_FOR_FN (cfun)->count); += GCOV_COMPUTE_SCALE (node->count, ENTRY_BLOCK_PTR_FOR_FN (cfun)->count); - ENTRY_BLOCK_PTR_FOR_FN (cfun)->count = - cgraph_node::get (current_function_decl)->count; - EXIT_BLOCK_PTR_FOR_FN (cfun)->count = - apply_scale (EXIT_BLOCK_PTR_FOR_FN (cfun)->count, - count_scale); + ENTRY_BLOCK_PTR_FOR_FN (cfun)->count = node->count; + EXIT_BLOCK_PTR_FOR_FN (cfun)->count += apply_scale (EXIT_BLOCK_PTR_FOR_FN (cfun)->count, count_scale); FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs) e->count = apply_scale (e->count, count_scale); @@ -9089,10 +9087,19 @@ execute_fixup_cfg (void) { if (stmt && is_gimple_call (stmt)) gimple_call_set_ctrl_altering (stmt, false); - stmt = gimple_build_call - (builtin_decl_implicit (BUILT_IN_UNREACHABLE), 0); + tree fndecl = builtin_decl_implicit (BUILT_IN_UNREACHABLE); + stmt = gimple_build_call (fndecl, 0); gimple_stmt_iterator gsi = gsi_last_bb (bb); gsi_insert_after (&gsi, stmt, GSI_NEW_STMT); + if (!cfun->after_inlining) + { + gcall *call_stmt = dyn_cast (stmt); + int freq + = compute_call_stmt_bb_frequency (current_function_decl, + bb); + node->create_edge (cgraph_node::get_create (fndecl), +call_stmt, bb->count, freq); + } } } } --- gcc/testsuite/g++.dg/gomp/pr71910.C (revision 0) +++ gcc/testsuite/g++.dg/gomp/pr71910.C (revision 239508) @@ -0,0 +1,13 @@ +// PR target/71910 +// { dg-do compile } +// { dg-additional-options "-O2" } + +#include + +int +main () +{ + std::vector vec(10); +#pragma omp parallel + __builtin_exit (0); +} 2016-09-01 Jakub Jelinek Backported from mainline 2016-08-17 Jakub Jelinek PR middle-end/77259 * tree-ssa-pre.c (eliminate_dom_walker::before_dom_children): If turning a call into __builtin_unreachable-like noreturn call, adjust gimple_call_set_fntype. * tree-cfgcleanup.c (fixup_noreturn_call): Remove lhs also if gimple_call_fntype has void return type. * g++.dg/ipa/devirt-52.C: New test. --- gcc/tree-cfgcleanup.c (revision 239536) +++ gcc/tree-cfgcleanup.c (revision 239537) @@ -602,10 +602,15 @@ fixup_noreturn_call (gimple *stmt) /* If there is an LHS, remove it, but only if its type has fixed size. The LHS will need to be recreated during RTL expansion and creating temporaries of variable-sized types is not supported. Also don't - do this with TREE_ADDRESSABLE types, as assign_temp will abort. */ + do this with TREE_ADDRESSABLE types, as assign_temp will abort. + Drop LHS regardless of TREE_ADDRESSABLE, if the function call + has been changed into a call that does not return a value, like + __builtin_unreachable or __cxa_pure_virtual. */ tree lhs = gimple_call_lhs (stmt); - if (lhs && TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (lhs))) == INTEGER_CST - && !TREE_ADDRESSABLE (TREE_TYPE (lhs))) + if (lhs + && ((TREE_CODE (TYPE_SIZE_UNIT (TREE_TYPE (lhs))) == INTEGER_CST + && !TREE_ADDRESSABLE (TREE_TYPE (lhs))) + || VOID_TYPE_P (TREE_TYPE (gimple_call_fntype (stmt) { gimple_call_set_lhs (stmt, NULL_TREE); --- gcc/tree-ssa-pre.c (revision 239536) +++ gcc/tree-ssa-pre.c (revision 239537) @@ -4543,6 +4543,15 @@ eliminate_dom_walker::before_dom_childre lang_hooks.decl_printable_name (fn, 2)); } gimple_call_set_fndecl (call_stmt, fn); + /* If changing the call to __builtin_unreachable +or similar noreturn function, adjust gimple_call_fntype +too. */ + if (gimple_call_noreturn_p (call_stmt) +