On match-and-simplify I notice that this folding doesn't keep
virtual operands up-to-date and leaves the caller with no chance
to see if EH edges need to be purged.

The following patch fixes that.

Bootstrap and regtest pending on x86_64-unknown-linux-gnu.

Richard.

2014-10-15  Richard Biener  <rguent...@suse.de>

        * gimple-fold.c (gimple_fold_call): Properly keep virtual
        SSA form up-to-date when devirtualizing a call to
        __builtin_unreachable and avoid fixing up EH info here.

Index: gcc/gimple-fold.c
===================================================================
--- gcc/gimple-fold.c   (revision 216245)
+++ gcc/gimple-fold.c   (working copy)
@@ -2629,7 +2629,11 @@ gimple_fold_call (gimple_stmt_iterator *
                      gsi_insert_before (gsi, new_stmt, GSI_NEW_STMT);
                    }
                  else
-                   gsi_replace (gsi, new_stmt, true);
+                   {
+                     gimple_set_vuse (new_stmt, gimple_vuse (stmt));
+                     gimple_set_vdef (new_stmt, gimple_vdef (stmt));
+                     gsi_replace (gsi, new_stmt, false);
+                   }
                  return true;
                }
            }

Reply via email to