From: Richard Biener <richard.guenther@gmail.com>
To: Erick Ochoa <erick.ochoa@theobroma-systems.com>
Cc: "GCC Development" <gcc@gcc.gnu.org>,
"Philipp Tomsich" <philipp.tomsich@theobroma-systems.com>,
"Christoph Müllner" <christoph.muellner@theobroma-systems.com>
Subject: Re: Question about exporting omputing alias sets
Date: Wed, 2 Sep 2020 11:14:59 +0200 [thread overview]
Message-ID: <CAFiYyc36w8at8haSmZ4TaRv0txaWYNTLNJzzoST1sscNVqegxg@mail.gmail.com> (raw)
In-Reply-To: <d9bd8279-db65-2925-d6c9-57476f016a73@theobroma-systems.com>
On Wed, Sep 2, 2020 at 10:04 AM Erick Ochoa
<erick.ochoa@theobroma-systems.com> wrote:
>
> Hello,
>
> I am trying to find out all pointers which alias a pointer and place
> them in a set.
>
> I am using `ptr_derefs_may_alias_p` to find out if two pointers may
> point to the same memory location. I think this yields conservative
> results (i.e., when it cannot be proven that to pointers may alias, it
> will give the result "true"). This is what I need.
>
> To collect all pointers which alias pointer "p", this means is that I
> have to collect all pointer variables and all pointer expressions in the
> program and then call `ptr_derefs_may_alias_p` O(n) times to find the
> set of pointers which alias pointer "p". If I have to do this for all
> pointers in the program, that would mean O(n^2).
>
> This also implies that in order for my sets to be correct I need to
> collect all pointer variables and all pointer expressions. I think that
> a better idea would be to have a list of all bitmap solutions and for
> every variable with a bitmap if position j is set, assigned to alias set
> j. In pseudocode:
>
> compute_alias_sets(bitmap set)
> {
> // create array of sets of same length as varmap
> // call it alias_map
> for (i = 0; i < varmap.length (); i++)
> {
> bitmap set = get_varinfo(i)->solution;
> EXECUTE_IF_SET_IN_BITMAP (set, 0, j, bi)
> {
> varinfo_t v = get_varinfo (j);
> alias_map[j].insert(v);
> }
> }
> }
>
> I think this is a better implementation. I don't need to worry about
> collecting all pointer expressions and I think varmap also contains
> declarations. (I think IPA-PTA already has "collected" all pointer
> expressions/declarations in varmap and created constraint variables for
> them.) *Would there be an issue with exporting varmap and delaying its
> deletion to this pass I'm working on?* This pass is intended to be run
> immediately after IPA-PTA. After this, I think I would still need to do
> some refining on the "alias_map" since (I think) there are more
> constraint variables than gimple variables in the partition, but the
> information I look for should be able to be derived from here.
I think you should add the code to compute your "alias sets" to
IPA-PTA if struct-reorg is enabled and export those like
we "export" the IPA escaped set (ipa_escaped_pt) to later
passes.
I agree that you want to work on the points-to solutions rather
than start from pointers and expressions in GIMPLE.
Richard.
> Thanks!
prev parent reply other threads:[~2020-09-02 9:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-02 8:03 Erick Ochoa
2020-09-02 9:14 ` Richard Biener [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=CAFiYyc36w8at8haSmZ4TaRv0txaWYNTLNJzzoST1sscNVqegxg@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=christoph.muellner@theobroma-systems.com \
--cc=erick.ochoa@theobroma-systems.com \
--cc=gcc@gcc.gnu.org \
--cc=philipp.tomsich@theobroma-systems.com \
/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).