From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4080 invoked by alias); 1 Aug 2007 09:52:44 -0000 Received: (qmail 4068 invoked by uid 22791); 1 Aug 2007 09:52:42 -0000 X-Spam-Check-By: sourceware.org Received: from nikam-dmz.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 01 Aug 2007 09:52:38 +0000 Received: from localhost (campfire.ms.mff.cuni.cz [195.113.18.99]) by nikam.ms.mff.cuni.cz (Postfix) with ESMTP id 3D94A5B80F; Wed, 1 Aug 2007 11:52:36 +0200 (CEST) Received: by localhost (Postfix, from userid 29025) id 3AFC1E3479; Wed, 1 Aug 2007 11:52:36 +0200 (CEST) Date: Wed, 01 Aug 2007 09:52:00 -0000 From: Zdenek Dvorak 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:] Message-ID: <20070801095236.GA13479@kam.mff.cuni.cz> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2007-08/txt/msg00017.txt.bz2 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