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]

[PATCH] Fix virtual call to __builtin_unreachable folding

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.


2014-10-15  Richard Biener  <>

	* 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);
-		    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;

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