All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Dibyendu Majumdar <mobile@majumdar.org.uk>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: Sparse-LLVM issue compiling NULL pointers
Date: Thu, 2 Mar 2017 20:34:16 +0100	[thread overview]
Message-ID: <CAExDi1S01UxR0_Kbc33NGp1RMbYT12brE=Kst8pkt51w36-Aag@mail.gmail.com> (raw)
In-Reply-To: <CACXZuxfkYqgPxE3OGdz7funUJtB6=K3TTwhzyZLJ=Kcio_7HXg@mail.gmail.com>

On Thu, Mar 2, 2017 at 7:58 PM, Dibyendu Majumdar
<mobile@majumdar.org.uk> wrote:
> On 2 March 2017 at 17:43, Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
>> On Thu, Mar 02, 2017 at 05:18:16PM +0000, Dibyendu Majumdar wrote:
>>> Hi Luc,
>>>
>>> I was looking at whether I can use the standard LLVM GEP api to access
>>> struct and array members in sparse-llvm. I noticed that the output
>>> from sparse has byte offsets of each member - but not the member's
>>> ordinal position.
>>
>> Indeed, when the offset is a compile constant otherwise the offset
>> is set to zero and there is a pair OP_MUL/OP_ADD before that does
>> the needed pointer arithmetic.
>>
>>> To use the native LLVM methods we would have to
>>> allow LLVM to work out byte offsets, and just use the struct or array
>>> definition. This would I think make the code more robust and also lead
>>> to better optimisation.
>>
>> I'm not sure to understand here: which byte offsets need to be worked out?
>
> You use the GEP API which allows you say that you want to access field
> 5 from a struct, and so on. Here 5 is the fifth field. LLVM works out
> the rest. This is better than casting the struct to char* and then
> doing pointer arithmetic.

OK. Yes.

>> Also, for the optimization, I wouldn't worry for now because:
>> - the linearized code is already optimized (nothing sophisticated but the
>>   essential is already there)
>> - you can always later call LLVM's optimization passes
>> - the code selector will also do some optimization.
>>
>
> Sure but my experience with LLVM is that it needs to have type
> metadata for each store and load instruction to properly do type based
> alias analysis. Otherwise it will miss optimisation opportunities.
> Maybe we can still provide type metadata as we do have the symbol
> definition etc.

There is certainly no reasons to not give easily available information.

> But I agree that if sparse-llvm works correctly for all inputs then
> that is a big step forward (for me) !

Indeed :)


Luc

  reply	other threads:[~2017-03-02 22:09 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-28  6:20 Sparse-LLVM issue compiling NULL pointers Dibyendu Majumdar
2017-02-28 15:09 ` Luc Van Oostenryck
2017-02-28 16:04   ` Dibyendu Majumdar
2017-02-28 16:47     ` Luc Van Oostenryck
2017-02-28 16:49     ` Dibyendu Majumdar
2017-03-02  6:48       ` Luc Van Oostenryck
2017-02-28 17:03   ` Luc Van Oostenryck
2017-02-28 17:35     ` Luc Van Oostenryck
2017-02-28 17:42       ` Dibyendu Majumdar
2017-02-28 18:08       ` Dibyendu Majumdar
2017-03-01  5:49         ` Luc Van Oostenryck
2017-03-02  7:02         ` [PATCH] llvm: fix getting type of values Luc Van Oostenryck
2017-03-01 10:58     ` Sparse-LLVM issue compiling NULL pointers Dibyendu Majumdar
2017-03-01 14:45       ` Dibyendu Majumdar
2017-03-02  5:21         ` Luc Van Oostenryck
2017-03-02  5:41           ` Dibyendu Majumdar
2017-03-02 13:56             ` Luc Van Oostenryck
2017-03-02 14:05               ` Dibyendu Majumdar
2017-03-02 16:10                 ` Luc Van Oostenryck
2017-03-02 14:33               ` Dibyendu Majumdar
2017-03-02 16:04                 ` Luc Van Oostenryck
2017-03-02 16:29                   ` Dibyendu Majumdar
2017-03-02 16:30                     ` Dibyendu Majumdar
2017-03-02 17:18                       ` Luc Van Oostenryck
2017-03-02 17:36                         ` Dibyendu Majumdar
2017-03-02 20:09                         ` Luc Van Oostenryck
2017-03-03  2:52                           ` Dibyendu Majumdar
2017-03-03  3:01                             ` Dibyendu Majumdar
2017-03-03  4:03                               ` Dibyendu Majumdar
2017-03-03  5:24                                 ` [PATCH] llvm: fix output_op_[ptr]cast() Luc Van Oostenryck
2017-03-03  7:37                                   ` Dibyendu Majumdar
2017-03-03 18:06                                     ` Dibyendu Majumdar
2017-03-03 18:30                                       ` Dibyendu Majumdar
2017-03-03 19:55                                         ` Luc Van Oostenryck
2017-03-06  1:56                                           ` Christopher Li
2017-03-03 19:50                                       ` Luc Van Oostenryck
2017-03-03 19:54                                         ` Dibyendu Majumdar
2017-03-03 20:52                                           ` [PATCH] llvm: fix: do not mix pointers and floats when doing compares Luc Van Oostenryck
2017-03-03  4:16                             ` Sparse-LLVM issue compiling NULL pointers Luc Van Oostenryck
2017-03-03  4:27                             ` Luc Van Oostenryck
2017-03-03  4:38                               ` Dibyendu Majumdar
2017-03-03  7:50                                 ` Luc Van Oostenryck
2017-03-03 12:39                                   ` Dibyendu Majumdar
2017-03-02 17:03                     ` Dibyendu Majumdar
2017-03-02 17:18                       ` Dibyendu Majumdar
2017-03-02 17:43                         ` Luc Van Oostenryck
2017-03-02 18:58                           ` Dibyendu Majumdar
2017-03-02 19:34                             ` Luc Van Oostenryck [this message]
2017-03-02 17:50                       ` Luc Van Oostenryck
2017-03-02 17:57                         ` Luc Van Oostenryck
2017-03-02 18:02                           ` Dibyendu Majumdar
2017-03-03  4:21                             ` Luc Van Oostenryck
2017-03-02 17:27                   ` Luc Van Oostenryck
2017-03-02 18:41                   ` Dibyendu Majumdar
2017-03-03  5:35                     ` Luc Van Oostenryck
2017-03-02 16:39           ` Dibyendu Majumdar
2017-03-02 17:21             ` Luc Van Oostenryck

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='CAExDi1S01UxR0_Kbc33NGp1RMbYT12brE=Kst8pkt51w36-Aag@mail.gmail.com' \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=mobile@majumdar.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.