diff options
author | Richard Biener <rguenther@suse.de> | 2019-03-12 16:15:47 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-03-12 16:15:47 +0000 |
commit | b4f40cbff0207fe854a8f0eb36524b30a95e69cc (patch) | |
tree | 36c594767dc34f220d6b8b1a868135818782d38c | |
parent | 36c4067807a4dc7cb337bf8ea35b329b98e8bd66 (diff) | |
download | gcc-b4f40cbff0207fe854a8f0eb36524b30a95e69cc.zip gcc-b4f40cbff0207fe854a8f0eb36524b30a95e69cc.tar.gz gcc-b4f40cbff0207fe854a8f0eb36524b30a95e69cc.tar.bz2 |
re PR tree-optimization/89664 (ICE in free_bb, at tree-ssa-math-opts.c:522)
2019-03-12 Richard Biener <rguenther@suse.de>
PR tree-optimization/89664
* tree-ssa-math-opts.c (execute_cse_reciprocals_1): Properly
free the occurance tree after the early out.
* gfortran.dg/pr89664.f90: New testcase.
From-SVN: r269618
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr89664.f90 | 24 | ||||
-rw-r--r-- | gcc/tree-ssa-math-opts.c | 3 |
4 files changed, 37 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3de25eb..217c3a2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-03-12 Richard Biener <rguenther@suse.de> + + PR tree-optimization/89664 + * tree-ssa-math-opts.c (execute_cse_reciprocals_1): Properly + free the occurance tree after the early out. + 2019-03-12 Andre Vieira <andre.simoesdiasvieira@arm.com> Backport from mainline diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c6574c8..52711b3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-03-12 Richard Biener <rguenther@suse.de> + + PR tree-optimization/89664 + * gfortran.dg/pr89664.f90: New testcase. + 2019-03-12 Andre Vieira <andre.simoesdiasvieira@arm.com> Backport from mainline diff --git a/gcc/testsuite/gfortran.dg/pr89664.f90 b/gcc/testsuite/gfortran.dg/pr89664.f90 new file mode 100644 index 0000000..5557806 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr89664.f90 @@ -0,0 +1,24 @@ +! { dg-do compile } +! { dg-options "-Ofast" } + +subroutine s (x) + real :: x + call sub (x) +end +subroutine sub (x) + real :: x, y + logical :: a, b + real :: f1, f2, f3, f4 + y = f1() + a = .false. + if ( f2() > f3() ) a = .true. + b = .false. + if ( f2() > f4() ) b = .true. + if ( a ) then + x = 1.0 + else if ( b ) then + x = 1.0/y**2 + else + x = 1.0/y - y**2 + end if +end diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c index 8463979..a8f275b 100644 --- a/gcc/tree-ssa-math-opts.c +++ b/gcc/tree-ssa-math-opts.c @@ -603,7 +603,7 @@ execute_cse_reciprocals_1 (gimple_stmt_iterator *def_gsi, tree def) /* If it is more profitable to optimize 1 / x, don't optimize 1 / (x * x). */ if (sqrt_recip_count > square_recip_count) - return; + goto out; /* Do the expensive part only if we can hope to optimize something. */ if (count + square_recip_count >= threshold && count >= 1) @@ -646,6 +646,7 @@ execute_cse_reciprocals_1 (gimple_stmt_iterator *def_gsi, tree def) } } +out: for (occ = occ_head; occ; ) occ = free_bb (occ); |