From: Sebastian Pop <sebpop@gmail.com>
To: tobias@grosser.es
Cc: gcc-patches@gcc.gnu.org, Richard Guenther <rguenther@suse.de>
Subject: Re: [PATCH 0/3] Fix PR47654 and PR49649
Date: Fri, 15 Jul 2011 23:08:00 -0000 [thread overview]
Message-ID: <CAFk3UF_bNAktDxvbpkUCZUFGZN=eoaKD5-Pj_zFVFHVKh_V3sw@mail.gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1107081032140.810@zhemvz.fhfr.qr>
On Fri, Jul 8, 2011 at 03:32, Richard Guenther <rguenther@suse.de> wrote:
> On Thu, 7 Jul 2011, Sebastian Pop wrote:
>
>> Hi,
>>
>> First there are two cleanup patches independent of the fix:
>>
>> Start counting nesting level from 0.
>> Do not compute twice type, lb, and ub.
>>
>> Then the patch that fixes PR47654:
>>
>> Fix PR47654: Compute LB and UB of a CLAST expression.
>>
>> One of the reasons we cannot determine the IV type only from the
>> polyhedral representation is that as in the testcase of PR47654, we
>> are asked to generate an induction variable going from 0 to 127. That
>> could be represented with a "char". However the upper bound
>> expression of the loop generated by CLOOG is min (127, 51*scat_1 + 50)
>> and that would overflow if we use a "char" type. To evaluate a type
>> in which the expression 51*scat_1 + 50 does not overflow, we have to
>> compute an upper and lower bound for the expression.
>>
>> To fix the problem exposed by Tobias:
>>
>> > for (i = 0 ; i < 2; i++)
>> > for (j = i ; j < i + 1; j++)
>> > for (k = j ; k < j + 1; k++)
>> > for (m = k ; m < k + 1; m++)
>> > for (n = m ; n < m + 1; n++)
>> > A[0] += A[n];
>> >
>> > I am a little bit afraid that we will increase the type size by an
>> > order of magnitude (or at least one bit) for each nesting level.
>>
>> instead of computing the lb and ub of scat_1 in "51*scat_1 + 50" based
>> on the type of scat_1 (that we already code generated when building
>> the outer loop), we use the polyhedral representation to get an
>> accurate lb and ub for scat_1.
>>
>> When translating the substitutions of a user statement using this
>> precise method, like for example S5 in vect-pr43423.c:
>>
>> for (scat_1=0;scat_1<=min(T_3-1,T_4-1);scat_1++) {
>> S5(scat_1);
>>
>> we get a type that is too precise: based on the interval [0,99] we get
>> the type "unsigned char" when the type of scat_1 is "int", misleading
>> the vectorizer due to the insertion of spurious casts:
>>
>> # Access function 0: (int) {(<unnamed-unsigned:8>) graphite_IV.7_56, +, 1}_3;
>> #)
>> affine dependence test not usable: access function not affine or constant.
>>
>> So we have to keep around the previous code gcc_type_for_clast_* that
>> computes the type of an expression as the max precision of the
>> components of that expression, and use that when computing the types
>> of substitution expressions.
>>
>> The patches passed together a full bootstrap and test on amd64-linux.
>> Ok for trunk?
>
> The idea sounds good to me and the middle-end-like looking pieces
> look good. I'd appreciate a 2nd look from Tobias.
>
Tobias, could you please have a look at these patches as well?
Thanks,
Sebastian
next prev parent reply other threads:[~2011-07-15 22:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-07 18:07 Sebastian Pop
2011-07-07 18:07 ` [PATCH 1/3] Start counting nesting level from 0 and use the standard "Polyhedral SCattering Transformed" psct_* interface Sebastian Pop
2011-07-07 18:08 ` [PATCH 2/3] Do not compute twice type, lb, and ub Sebastian Pop
2011-07-07 18:15 ` [PATCH 3/3] Fix PR47654: Compute LB and UB of a CLAST expression Sebastian Pop
2011-07-08 8:38 ` [PATCH 0/3] Fix PR47654 and PR49649 Richard Guenther
2011-07-15 23:08 ` Sebastian Pop [this message]
2011-07-17 7:54 ` Tobias Grosser
2011-07-17 11:31 ` Sebastian Pop
2011-07-18 7:04 ` Tobias Grosser
2011-07-18 16:12 ` Sebastian Pop
2011-07-18 16:48 ` Tobias Grosser
2011-07-18 17:48 ` Sebastian Pop
2011-07-18 22:43 ` Tobias Grosser
2011-07-18 23:24 ` Sebastian Pop
2011-07-18 23:36 ` Tobias Grosser
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='CAFk3UF_bNAktDxvbpkUCZUFGZN=eoaKD5-Pj_zFVFHVKh_V3sw@mail.gmail.com' \
--to=sebpop@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
--cc=tobias@grosser.es \
/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).