Patchwork Fold PRE inserted statements

mail settings
Submitter Richard Guenther
Date Sept. 9, 2011, 10:11 a.m.
Message ID <alpine.LNX.2.00.1109091209480.2130@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/114043/
State New
Headers show


Richard Guenther - Sept. 9, 2011, 10:11 a.m.
This makes us fold (the last) inserted statement from PRE to avoid
MEM_REF vs. non-MEM_REF inconsistencies tripping up on un-aware
code such as data dependence analysis using operand_equal_p.  fold_stmt
makes sure to canonicalize either variant but PRE internally uses
MEM_REF for all accesses to be type agnostic.

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


2011-09-09  Richard Guenther  <>

	* tree-ssa-pre.c (create_expression_by_pieces): Fold the
	last statement.


Index: gcc/tree-ssa-pre.c
--- gcc/tree-ssa-pre.c	(revision 178719)
+++ gcc/tree-ssa-pre.c	(working copy)
@@ -3182,6 +3182,10 @@  create_expression_by_pieces (basic_block
   /* All the symbols in NEWEXPR should be put into SSA form.  */
   mark_symbols_for_renaming (newstmt);
+  /* Fold the last statement.  */
+  gsi = gsi_last (*stmts);
+  fold_stmt_inplace (&gsi);
   /* Add a value number to the temporary.
      The value may already exist in either NEW_SETS, or AVAIL_OUT, because
      we are creating the expression by pieces, and this particular piece of