From: Dibyendu Majumdar <mobile@majumdar.org.uk>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: sparse-llvm incorrect definition of local variables
Date: Wed, 8 Mar 2017 23:38:22 +0000 [thread overview]
Message-ID: <CACXZuxcbDJAeRBN_wpTRPRk7efOM2vLytke=k_0f4=C0dOQtrA@mail.gmail.com> (raw)
In-Reply-To: <20170308065337.vwrebdlo4poc4da4@macpro.local>
Hi Luc,
On 8 March 2017 at 06:53, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
> On Tue, Mar 07, 2017 at 07:31:34AM +0000, Dibyendu Majumdar wrote:
>> >> Here 'values' has been defined above as external global, whereas it
>> >> should be allocated on the stack.
>> >
>> > Mmmh, I'll need to look a bit further at this one.
>> >
>>
>> It appears that sparse-llvm only creates a local stack object for each
>> OP_PHI instruction. What should be the general approach for
>> identifying local stack objects in sparse linearized output?
>
> I've looked a bit at this and there is several issues at hand.
> It's also not something LLVM specific.
> So I can't answer to this for now. Hopefully, I'll be able to tell
> you more in a few days.
>
Thank you for looking into this. It would be good to know what issues
you have discovered. I was wondering if a simple solution is to check
whether the symbol is marked as toplevel / extern - and if not then
define it as a local symbol in LLVM. However we would need to handle
scope - i.e. if the same symbol occurs multiple times in a function in
different scopes then these need to be defined accordingly. Example:
extern void init(int *v);
int main(const char *argv[]) {
int n = 0;
{
int x[5];
init(x);
n += x[0];
}
{
int x[6];
init(x);
n += x[0];
}
return n;
}
Regards
Dibyendu
next prev parent reply other threads:[~2017-03-08 23:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-07 0:08 sparse-llvm incorrect definition of local variables Dibyendu Majumdar
2017-03-07 6:44 ` Luc Van Oostenryck
2017-03-07 7:31 ` Dibyendu Majumdar
2017-03-08 6:53 ` Luc Van Oostenryck
2017-03-08 23:38 ` Dibyendu Majumdar [this message]
2017-03-09 1:50 ` Dibyendu Majumdar
2017-03-09 14:35 ` Luc Van Oostenryck
2017-03-09 14:42 ` Dibyendu Majumdar
2017-03-09 23:30 ` Dibyendu Majumdar
2017-03-09 23:37 ` Dibyendu Majumdar
2017-03-09 14:42 ` Luc Van Oostenryck
2017-03-13 11:16 ` Dibyendu Majumdar
2017-03-14 15:54 ` Dibyendu Majumdar
2017-03-17 10:48 ` Dibyendu Majumdar
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='CACXZuxcbDJAeRBN_wpTRPRk7efOM2vLytke=k_0f4=C0dOQtrA@mail.gmail.com' \
--to=mobile@majumdar.org.uk \
--cc=linux-sparse@vger.kernel.org \
--cc=luc.vanoostenryck@gmail.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 NNTP newsgroup(s).