This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.

Tested on aarch64-linux-gnu, aarch64_be-elf and x86_64-linux-gnu.
OK to install?


2019-07-11  Richard Sandiford  <>

	* ifcvt.c: Include dce.h.
	(if_convert): Call run_fast_dce if the pass changed something.

Index: gcc/ifcvt.c
--- gcc/ifcvt.c	2019-03-08 18:15:26.828777872 +0000
+++ gcc/ifcvt.c	2019-07-12 08:58:21.787403345 +0100
@@ -46,6 +46,7 @@
 #include "rtl-iter.h"
 #include "ifcvt.h"
 #include "params.h"
+#include "dce.h"
@@ -5443,6 +5444,10 @@ if_convert (bool after_combine)
+  if (num_updated_if_blocks)
+    /* Get rid of any dead CC-related instructions.  */
+    run_fast_dce ();
   if (optimize == 1)
     df_remove_problem (df_live);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]