Hi, the combine pass sometimes gets confused by already dead compares which are remains of the if conversion pass. This e.g. happens in gcc.dg/builtin-bswap-7.c. Compiling with -march=z196 the if blocks are modified to make use of load on condition. This duplicates the compare insn but unfortunately ifcvt fails to clean it up and the additional compare survives until the second ifcvt pass. Combine fails to do the simplification of the bswap since the bswapped value appears to be used in the second compare as well.
ifcvt runs df_analyze in a loop until nothing changes anymore. So this loop is always left with all df solutions being clean. However, dce is only run once, before the first iteration. The attached patch fixes the builtin-bswap-7.c testcase for s390x (-march=z196) but is probably helpful in other situations as well. Ok? Bye, -Andreas- 2015-03-10 Andreas Krebbel <kreb...@linux.vnet.ibm.com> * gcc/ifcvt.c (if_convert): diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c index a3e3e5c..d2040af 100644 --- a/gcc/ifcvt.c +++ b/gcc/ifcvt.c @@ -4626,6 +4626,13 @@ if_convert (bool after_combine) num_true_changes); } + if (num_true_changes > 0) + { + df_set_flags (DF_LR_RUN_DCE); + df_mark_solutions_dirty (); + df_analyze (); + } + if (optimize == 1) df_remove_problem (df_live);