From: "H.J. Lu" <hjl.tools@gmail.com>
To: Martin Jambor <mjambor@suse.cz>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
Richard Guenther <rguenther@suse.de>
Subject: Re: [PATCH 2/2] Reimplementation of build_ref_for_offset
Date: Wed, 18 May 2011 15:58:00 -0000 [thread overview]
Message-ID: <BANLkTikAkV0t7dxqx-OGPWm54A+exHEb=g@mail.gmail.com> (raw)
In-Reply-To: <AANLkTikaq=KNBhh9JoOVheKtU1CMrbGRyw3muCMnHmBd@mail.gmail.com>
On Sat, Oct 23, 2010 at 10:12 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Sep 8, 2010 at 9:43 AM, Martin Jambor <mjambor@suse.cz> wrote:
>> Hi,
>>
>> this patch reimplements build_ref_for_offset so that it simply creates
>> a MEM_REF rather than trying to figure out what combination of
>> component and array refs are necessary. The main advantage of this
>> approach is that this can never fail, allowing us to be more
>> aggressive and remove a number of checks.
>>
>> There were two main problems with this, though. First is that
>> MEM_REFs are not particularly readable to by users. This would be a
>> problem when we are creating a reference that might be displayed to
>> them in a warning or a debugger which is what we do with
>> DECL_DEBUG_EXPR expressions. We sometimes construct these
>> artificially when propagating accesses across assignments. So for
>> those cases I retained the old implementation and only simplified it a
>> bit - it is now called build_user_friendly_ref_for_offset.
>>
>> The other problem was bit-fields. Constructing accesses to them was
>> difficult enough but then I realized that I was not even able to
>> detect the cases when I was accessing a bit field if their offset
>> happened to be on a byte boundary. I thought I would be able to
>> figure this out from TYPE_SIZE and TYPE_PRECISION of exp_type but
>> combinations that signal a bit-field in one language may not be
>> applied in another (in C, small TYPE_PRECISION denotes bit-fields and
>> TYPE_SIZE is big, but for example Fortran booleans have the precision
>> set to one even though they are not bit-fields).
>>
>> So in the end I based the detection on the access structures that
>> represented the thing being loaded or stored which I knew had their
>> sizes correct because they are based on field sizes. Since I use the
>> access, the simplest way to actually create the reference to the bit
>> field is to re-use the last component ref of its expression - that is
>> what build_ref_for_model (meaning a model access) does. Separating
>> this from build_ref_for_offset (which cannot handle bit-fields) makes
>> the code a bit cleaner and keeps the latter function for other users
>> which know nothing about SRA access structures.
>>
>> I hope that you'll find these approaches reasonable. The patch was
>> bootstrapped and tested on x86_64-linux without any issues. I'd like
>> to commit it to trunk but I'm sure there will be comments and
>> suggestions.
>>
>> Thanks,
>>
>> Martin
>>
>>
>>
>> 2010-09-08 Martin Jambor <mjambor@suse.cz>
>>
>> PR tree-optimization/44972
>> * tree-sra.c: Include toplev.h.
>> (build_ref_for_offset): Entirely reimplemented.
>> (build_ref_for_model): New function.
>> (build_user_friendly_ref_for_offset): New function.
>> (analyze_access_subtree): Removed build_ref_for_offset check.
>> (propagate_subaccesses_across_link): Likewise.
>> (create_artificial_child_access): Use
>> build_user_friendly_ref_for_offset.
>> (propagate_subaccesses_across_link): Likewise.
>> (ref_expr_for_all_replacements_p): Removed.
>> (generate_subtree_copies): Updated comment. Use build_ref_for_model.
>> (sra_modify_expr): Use build_ref_for_model.
>> (load_assign_lhs_subreplacements): Likewise.
>> (sra_modify_assign): Removed ref_expr_for_all_replacements_p checks,
>> checks for return values of build_ref_for_offset.
>> * ipa-cp.c (ipcp_lattice_from_jfunc): No need to check return value of
>> build_ref_for_offset.
>> * ipa-prop.h: Include gimple.h
>> * ipa-prop.c (ipa_compute_jump_functions): Update to look for MEM_REFs.
>> (ipa_analyze_indirect_call_uses): Update comment.
>> * Makefile.in (tree-sra.o): Add $(GIMPLE_H) to dependencies.
>> (IPA_PROP_H): Likewise.
>
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46150
>
This also caused:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49039
--
H.J.
prev parent reply other threads:[~2011-05-18 14:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-08 17:16 [PATCH 0/2] Fix PR 44972 Martin Jambor
2010-09-08 17:16 ` [PATCH 1/2] Remove the IPA-SRA call to build_ref_for_offset Martin Jambor
2010-09-09 9:01 ` Richard Guenther
2010-09-11 2:09 ` H.J. Lu
2010-12-06 18:56 ` H.J. Lu
2011-01-13 23:59 ` H.J. Lu
2010-09-08 17:19 ` [PATCH 2/2] Reimplementation of build_ref_for_offset Martin Jambor
2010-09-09 9:31 ` Richard Guenther
2010-09-09 22:44 ` Martin Jambor
2010-10-23 19:33 ` H.J. Lu
2011-05-18 15:58 ` H.J. Lu [this message]
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='BANLkTikAkV0t7dxqx-OGPWm54A+exHEb=g@mail.gmail.com' \
--to=hjl.tools@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mjambor@suse.cz \
--cc=rguenther@suse.de \
/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).