aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgcleanup.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-07-18 08:24:16 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-07-18 08:24:16 +0000
commitf1f10541903b082d27114db38947fb31f5364bcc (patch)
tree81b40e730cc48482b0a65592b9ea5e4372ae654b /gcc/cfgcleanup.c
parentd119bf79862015d4ba3c7f8774835c216c9a26ed (diff)
downloadgcc-f1f10541903b082d27114db38947fb31f5364bcc.zip
gcc-f1f10541903b082d27114db38947fb31f5364bcc.tar.gz
gcc-f1f10541903b082d27114db38947fb31f5364bcc.tar.bz2
Make ifcvt clean up dead comparisons
This change is needed to avoid a regression in gcc.dg/ifcvt-3.c for a later patch. Without it, we enter CSE with a dead comparison left by if-conversion and then eliminate the second (live) comparison in favour of the dead one. That's functionally correct in itself, but it meant that we'd combine the subtraction and comparison into a SUBS before we have a chance to fold away the subtraction. 2019-07-18 Richard Sandiford <richard.sandiford@arm.com> gcc/ * basic-block.h (CLEANUP_FORCE_FAST_DCE): New macro. * cfgcleanup.c (cleanup_cfg): Call run_fast_dce if CLEANUP_FORCE_FAST_DCE is set. * ifcvt.c (rest_of_handle_if_conversion): Pass CLEANUP_FORCE_FAST_DCE to the final cleanup_cfg call if if-conversion succeeded. From-SVN: r273569
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r--gcc/cfgcleanup.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index fca3a08..b930763 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -3193,7 +3193,10 @@ cleanup_cfg (int mode)
&& !delete_trivially_dead_insns (get_insns (), max_reg_num ()))
break;
if ((mode & CLEANUP_CROSSJUMP) && crossjumps_occurred)
- run_fast_dce ();
+ {
+ run_fast_dce ();
+ mode &= ~CLEANUP_FORCE_FAST_DCE;
+ }
}
else
break;
@@ -3202,6 +3205,9 @@ cleanup_cfg (int mode)
if (mode & CLEANUP_CROSSJUMP)
remove_fake_exit_edges ();
+ if (mode & CLEANUP_FORCE_FAST_DCE)
+ run_fast_dce ();
+
/* Don't call delete_dead_jumptables in cfglayout mode, because
that function assumes that jump tables are in the insns stream.
But we also don't _have_ to delete dead jumptables in cfglayout