diff options
| author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-09 11:42:34 +0000 |
|---|---|---|
| committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-09-09 11:42:34 +0000 |
| commit | 8d34eb9f4675726c83fc27efad979b6bb9a13da7 (patch) | |
| tree | 65b282afeda4c8830edaa6cd81b95aafe694f061 | |
| parent | b0b984fb72d62492a4133564fc3e3cd93977b6f7 (diff) | |
| download | ppe42-gcc-8d34eb9f4675726c83fc27efad979b6bb9a13da7.tar.gz ppe42-gcc-8d34eb9f4675726c83fc27efad979b6bb9a13da7.zip | |
2014-09-09 Richard Biener <rguenther@suse.de>
Backport from mainline
2014-08-05 Richard Biener <rguenther@suse.de>
PR rtl-optimization/61672
* emit-rtl.h (mem_attrs_eq_p): Declare.
* emit-rtl.c (mem_attrs_eq_p): Export. Handle NULL mem-attrs.
* cse.c (exp_equiv_p): Use mem_attrs_eq_p.
* cfgcleanup.c (merge_memattrs): Likewise.
Include emit-rtl.h.
2014-08-11 Richard Biener <rguenther@suse.de>
PR tree-optimization/62075
* tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Properly
handle uses in patterns.
* gcc.dg/vect/pr62075.c: New testcase.
2014-08-14 Richard Biener <rguenther@suse.de>
PR rtl-optimization/62079
* recog.c (peephole2_optimize): If peep2_do_cleanup_cfg
run cleanup_cfg.
* g++.dg/pr62079.C: New testcase.
2014-08-26 Richard Biener <rguenther@suse.de>
PR tree-optimization/62175
* tree-ssa-loop-niter.c (expand_simple_operations): Do not
expand possibly trapping operations.
* g++.dg/torture/pr62175.C: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@215059 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 30 | ||||
| -rw-r--r-- | gcc/cfgcleanup.c | 3 | ||||
| -rw-r--r-- | gcc/cse.c | 2 | ||||
| -rw-r--r-- | gcc/emit-rtl.c | 4 | ||||
| -rw-r--r-- | gcc/recog.c | 2 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 18 | ||||
| -rw-r--r-- | gcc/testsuite/g++.dg/pr62079.C | 78 | ||||
| -rw-r--r-- | gcc/testsuite/g++.dg/torture/pr62175.C | 36 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr62075.c | 22 | ||||
| -rw-r--r-- | gcc/tree-ssa-loop-niter.c | 3 | ||||
| -rw-r--r-- | gcc/tree-vect-slp.c | 5 |
11 files changed, 200 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 19bb3605c90..2ba64615a82 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,33 @@ +2014-09-09 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2014-08-05 Richard Biener <rguenther@suse.de> + + PR rtl-optimization/61672 + * emit-rtl.h (mem_attrs_eq_p): Declare. + * emit-rtl.c (mem_attrs_eq_p): Export. Handle NULL mem-attrs. + * cse.c (exp_equiv_p): Use mem_attrs_eq_p. + * cfgcleanup.c (merge_memattrs): Likewise. + Include emit-rtl.h. + + 2014-08-11 Richard Biener <rguenther@suse.de> + + PR tree-optimization/62075 + * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Properly + handle uses in patterns. + + 2014-08-14 Richard Biener <rguenther@suse.de> + + PR rtl-optimization/62079 + * recog.c (peephole2_optimize): If peep2_do_cleanup_cfg + run cleanup_cfg. + + 2014-08-26 Richard Biener <rguenther@suse.de> + + PR tree-optimization/62175 + * tree-ssa-loop-niter.c (expand_simple_operations): Do not + expand possibly trapping operations. + 2014-09-08 DJ Delorie <dj@redhat.com> * doc/invoke.texi (MSP430 Options): Add -minrt. diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 77196ee6bf7..de307da542c 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see #include "df.h" #include "dce.h" #include "dbgcnt.h" +#include "emit-rtl.h" #define FORWARDER_BLOCK_P(BB) ((BB)->flags & BB_FORWARDER_BLOCK) @@ -882,7 +883,7 @@ merge_memattrs (rtx x, rtx y) if (GET_MODE (x) != GET_MODE (y)) return; - if (code == MEM && MEM_ATTRS (x) != MEM_ATTRS (y)) + if (code == MEM && !mem_attrs_eq_p (MEM_ATTRS (x), MEM_ATTRS (y))) { if (! MEM_ATTRS (x)) MEM_ATTRS (y) = 0; diff --git a/gcc/cse.c b/gcc/cse.c index b8223f7a35e..ec9aff4195a 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -2680,7 +2680,7 @@ exp_equiv_p (const_rtx x, const_rtx y, int validate, bool for_gcse) But because really all MEM attributes should be the same for equivalent MEMs, we just use the invariant that MEMs that have the same attributes share the same mem_attrs data structure. */ - if (MEM_ATTRS (x) != MEM_ATTRS (y)) + if (!mem_attrs_eq_p (MEM_ATTRS (x), MEM_ATTRS (y))) return 0; } break; diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 89b676837b2..3041b9e7a18 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -248,6 +248,10 @@ const_fixed_htab_eq (const void *x, const void *y) bool mem_attrs_eq_p (const struct mem_attrs *p, const struct mem_attrs *q) { + if (p == q) + return true; + if (!p || !q) + return false; return (p->alias == q->alias && p->offset_known_p == q->offset_known_p && (!p->offset_known_p || p->offset == q->offset) diff --git a/gcc/recog.c b/gcc/recog.c index f2647e39aae..0481d7dbbfd 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -3659,6 +3659,8 @@ peephole2_optimize (void) BITMAP_FREE (live); if (peep2_do_rebuild_jump_labels) rebuild_jump_labels (get_insns ()); + if (peep2_do_cleanup_cfg) + cleanup_cfg (CLEANUP_CFG_CHANGED); } #endif /* HAVE_peephole2 */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 94b2bcbba72..b847f620180 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2014-09-09 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2014-08-11 Richard Biener <rguenther@suse.de> + + PR tree-optimization/62075 + * gcc.dg/vect/pr62075.c: New testcase. + + 2014-08-14 Richard Biener <rguenther@suse.de> + + PR rtl-optimization/62079 + * g++.dg/pr62079.C: New testcase. + + 2014-08-26 Richard Biener <rguenther@suse.de> + + PR tree-optimization/62175 + * g++.dg/torture/pr62175.C: New testcase. + 2014-09-08 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/60196 diff --git a/gcc/testsuite/g++.dg/pr62079.C b/gcc/testsuite/g++.dg/pr62079.C new file mode 100644 index 00000000000..919c3e5de36 --- /dev/null +++ b/gcc/testsuite/g++.dg/pr62079.C @@ -0,0 +1,78 @@ +// { dg-do compile } +// { dg-options "-std=c++11 -O2 -fnon-call-exceptions" } + +template < typename > class allocator; + +template < class _CharT > struct char_traits; +template < typename _CharT, typename _Traits = char_traits < _CharT >, + typename _Alloc = allocator < _CharT > >class basic_string; +typedef basic_string < char >string; + +template < typename _Tp > class new_allocator +{ + template < typename _Tp1 > struct rebind + { + typedef new_allocator < _Tp1 > other; + }; +}; + +template < typename _Tp > using __allocator_base = new_allocator < _Tp >; +template < typename _Tp > class allocator:public __allocator_base < _Tp > +{ +}; + +template < typename _CharT, typename _Traits, typename _Alloc > + class basic_string +{ +public: + basic_string (const _CharT * __s, const _Alloc & __a = _Alloc ()); + ~basic_string ()noexcept; +}; + +template < typename T > struct add_reference +{ + typedef T & type; +}; + +template < typename ... Values > class tuple; +template <> class tuple <> +{ +}; + +template < typename Head, typename ... Tail > class tuple < Head, Tail ... >:private tuple < + Tail ... + > +{ + typedef tuple < Tail ... >inherited; +public: + template < typename ... VValues > + tuple (const tuple < VValues ... >&other):inherited (other.tail ()), + m_head (other.head ()) + { + } + typename add_reference < const Head >::type head () const + { + return m_head; + } + const inherited & tail () const + { + return *this; + } + Head m_head; +}; + +template < typename T > struct make_tuple_result +{ + typedef T type; +}; + +template < typename ... Values > + tuple < typename make_tuple_result < + Values >::type ... >make_tuple (const Values & ... values); + +int +main () +{ + tuple < int, float, string > t3c = + make_tuple (17, 2.718281828, string ("Fun")); +} diff --git a/gcc/testsuite/g++.dg/torture/pr62175.C b/gcc/testsuite/g++.dg/torture/pr62175.C new file mode 100644 index 00000000000..bcdea61e1bf --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr62175.C @@ -0,0 +1,36 @@ +// { dg-do compile } +// { dg-additional-options "-ftrapv" } + +struct B { + B(int = 0); +}; +int c; +int *d; +struct G { + G(); + int numProcs_; +}; +int fn1(); +B fn2() { + if (c) + return 0; + return B(); +} + +long &fn3(long &p1, long &p2) { + if (p2 < p1) + return p2; + return p1; +} + +void fn4(long p1) { + long a = fn1(); + fn2(); + int b = fn3(p1, a); + for (int i; i < b; ++i) + d[0] = 0; + for (; a < p1; ++a) + d[a] = 0; +} + +G::G() { fn4(numProcs_ + 1); } diff --git a/gcc/testsuite/gcc.dg/vect/pr62075.c b/gcc/testsuite/gcc.dg/vect/pr62075.c new file mode 100644 index 00000000000..798490e8752 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr62075.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ + +int a[16][2]; +struct A +{ + int b[16][2]; + int c[16][1]; +}; + +void +foo (struct A *x) +{ + int i; + for (i = 0; i < 16; ++i) + { + x->b[i][0] = a[i][0]; + x->c[i][0] = 0 != a[i][0]; + x->b[i][1] = a[i][1]; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 7628363cc62..897b8f51895 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -1636,6 +1636,9 @@ expand_simple_operations (tree expr) case PLUS_EXPR: case MINUS_EXPR: + if (TYPE_OVERFLOW_TRAPS (TREE_TYPE (expr))) + return expr; + /* Fallthru. */ case POINTER_PLUS_EXPR: /* And increments and decrements by a constant are simple. */ e1 = gimple_assign_rhs2 (stmt); diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 0ab267f7d8e..d48d3f571e3 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1793,7 +1793,10 @@ vect_detect_hybrid_slp_stmts (slp_tree node) && (stmt_vinfo = vinfo_for_stmt (use_stmt)) && !STMT_SLP_TYPE (stmt_vinfo) && (STMT_VINFO_RELEVANT (stmt_vinfo) - || VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_vinfo))) + || VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_vinfo)) + || (STMT_VINFO_IN_PATTERN_P (stmt_vinfo) + && STMT_VINFO_RELATED_STMT (stmt_vinfo) + && !STMT_SLP_TYPE (vinfo_for_stmt (STMT_VINFO_RELATED_STMT (stmt_vinfo))))) && !(gimple_code (use_stmt) == GIMPLE_PHI && STMT_VINFO_DEF_TYPE (stmt_vinfo) == vect_reduction_def)) |

