diff mbox

[mem-ref2] Fix typo in SRA conversion

Message ID alpine.LNX.2.00.1006141500250.1429@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener June 14, 2010, 1:02 p.m. UTC
This fixes a typo in disqualify_base_of_expr.  It also removes
a strage folding in sra_ipa_modify_expr - also latent on the trunk
as

  if (cand->by_ref)
    {
      tree folded;
      src = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (cand->reduction)),
                    cand->reduction);
      folded = gimple_fold_indirect_ref (src);
      if (folded)
        src = folded;

this first builds *cand->reduction and then tries to simplify
**cand->reduction, only doing the double-indirection if it
simplified.

That can't be right ... I have just removed this folding on the
branch.  Likely it never triggers, as gimple_fold_indirect_ref
can't simplify an INDIRECT_REF argument.

Committed to the branch.

Richard.

2010-06-14  Richard Guenther  <rguenther@suse.de>

	* tree-sra.c (disqualify_base_of_expr): Fix typo.
	(sra_ipa_modify_expr): Remove bogus folding.
diff mbox

Patch

Index: gcc/tree-sra.c
===================================================================
--- gcc/tree-sra.c	(revision 160604)
+++ gcc/tree-sra.c	(working copy)
@@ -887,7 +887,7 @@  disqualify_base_of_expr (tree t, const c
   t = get_base_address (t);
   if (sra_mode == SRA_MODE_EARLY_IPA
       && TREE_CODE (t) == MEM_REF)
-    t = get_ssa_base_param (t);
+    t = get_ssa_base_param (TREE_OPERAND (t, 0));
 
   if (t && DECL_P (t))
     disqualify_candidate (t, reason);
@@ -3952,13 +3952,7 @@  sra_ipa_modify_expr (tree *expr, bool co
     return false;
 
   if (cand->by_ref)
-    {
-      tree folded;
-      src = build_simple_mem_ref (cand->reduction);
-      folded = gimple_fold_indirect_ref (src);
-      if (folded)
-        src = folded;
-    }
+    src = build_simple_mem_ref (cand->reduction);
   else
     src = cand->reduction;