public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Zdenek Dvorak <rakdver@kam.mff.cuni.cz>
To: Andrew_Pinski@PlayStation.Sony.Com
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] Fix IV-opts so it no longer produces MEM[index:]
Date: Wed, 01 Aug 2007 09:52:00 -0000	[thread overview]
Message-ID: <20070801095236.GA13479@kam.mff.cuni.cz> (raw)
In-Reply-To: <OF212ACADE.9EC69DC4-ON8825732A.000CA8E7-8825732A.000E577D@playstation.sony.com>

Hello,

> Index: tree-ssa-loop-manip.c
> ===================================================================
> --- tree-ssa-loop-manip.c	(revision 127066)
> +++ tree-ssa-loop-manip.c	(working copy)
> @@ -56,12 +56,15 @@ create_iv (tree base, tree step, tree va
>    tree vb, va;
>    enum tree_code incr_op = PLUS_EXPR;
>    edge pe = loop_preheader_edge (loop);
> +  tree var1;
>  
>    if (!var)
>      {
>        var = create_tmp_var (TREE_TYPE (base), "ivtmp");
>        add_referenced_var (var);
>      }
> +  var1 = create_tmp_var (TREE_TYPE (step), "ivtmp");
> +  add_referenced_var (var1);
>  
>    vb = make_ssa_name (var, NULL_TREE);
>    if (var_before)
> @@ -104,7 +107,7 @@ create_iv (tree base, tree step, tree va
>      }
>    /* Gimplify the step if necessary.  We put the computations in front of the
>       loop (i.e. the step should be loop invariant).  */
> -  step = force_gimple_operand (step, &stmts, true, var);
> +  step = force_gimple_operand (step, &stmts, true, var1);

just change this to
step = force_gimple_operand (step, &stmts, true, NULL_TREE);

> @@ -1934,7 +1939,7 @@ add_candidate_1 (struct ivopts_data *dat
>      {
>        orig_type = TREE_TYPE (base);
>        type = generic_type_for (orig_type);
> -      if (type != orig_type)
> +      if (type != orig_type && !POINTER_TYPE_P (orig_type))
>  	{
>  	  base = fold_convert (type, base);
>  	  step = fold_convert (type, step);

You still need to convert base to type.

> Index: tree-affine.c
> ===================================================================
> --- tree-affine.c	(revision 127066)
> +++ tree-affine.c	(working copy)
> @@ -350,29 +349,40 @@ add_elt_to_tree (tree expr, tree type, t
>  		 aff_tree *comb)
>  {
>    enum tree_code code;
> +  tree type1 = type;
> +  if (POINTER_TYPE_P (type))
> +    type1 = sizetype;
>  
>    scale = double_int_ext_for_comb (scale, comb);
> -  elt = fold_convert (type, elt);
> +  elt = fold_convert (type1, elt);
>  
>    if (double_int_one_p (scale))
>      {
>        if (!expr)
> -	return elt;
> +	return fold_convert (type, elt);

These changes look wrong; for example, if aff_combination_to_tree is
called with combination with elements i and p (where type of p = int *
and type of i is sizetype), this would end up producing
(int *) i PPLUS (sizetype) p.  I think aff_combination_to_tree needs
to be rewritten to deal with the pointer type elements of the combination
separately.

Zdenek

  reply	other threads:[~2007-08-01  9:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-01  2:36 Andrew_Pinski
2007-08-01  9:52 ` Zdenek Dvorak [this message]
2007-08-01 21:18   ` Andrew_Pinski
2007-08-07 12:26     ` Andrew Pinski
2007-08-08 10:18       ` Zdenek Dvorak
2007-08-10 21:21   ` Andrew Pinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070801095236.GA13479@kam.mff.cuni.cz \
    --to=rakdver@kam.mff.cuni.cz \
    --cc=Andrew_Pinski@PlayStation.Sony.Com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).