From patchwork Mon Jun 14 13:02:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [mem-ref2] Fix typo in SRA conversion X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 55528 Message-Id: To: gcc-patches@gcc.gnu.org Cc: Martin Jambor Date: Mon, 14 Jun 2010 15:02:28 +0200 (CEST) From: Richard Guenther List-Id: 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 * tree-sra.c (disqualify_base_of_expr): Fix typo. (sra_ipa_modify_expr): Remove bogus folding. 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;