diff mbox

Fix virtual call to __builtin_unreachable folding

Message ID alpine.LSU.2.11.1410151437380.20733@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Oct. 15, 2014, 12:38 p.m. UTC
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  <rguenther@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.
diff mbox

Patch

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;
 		}
 	    }