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 18:18:43 +0100	[thread overview]
Message-ID: <20170302171842.xuk535w6wrfxke3b@macpro.local> (raw)
In-Reply-To: <CACXZuxdr9ubL6S8PEzAHtOt9AT=PjYcv_8EotLD8_Cagc7ZGPw@mail.gmail.com>

On Thu, Mar 02, 2017 at 04:30:53PM +0000, Dibyendu Majumdar wrote:
> >> Why I try your code (without LLVM assertions), I got indeed several
> >> problems:
> >>         Call parameter type does not match function signature!
> >>         i0 16
> >>          i64  %1 = call i8* @malloc(i0 16)
> >
> > I have the function argument fix so I don't get the malloc error.

Good.

> >>         Invalid bitcast
> >>           %27 = bitcast void <badref> to i8**
> >>         Both operands to a binary operator are not of the same type!
> >
> > I think this corresponds to the code that fails - the type of the LLVM
> > instruction is 'void' and the code is trying to cast to it or
> > something.

That's obviously wrong.

> >>           %R31 = add void <badref>, i64 %R30
> >>         Stored value type does not match pointer operand type!
> >>           store void %R31, i8** %46
> >>
> >
> > The code aborts at previous step
> >
> >> The first one is really weird but I think you don't see it.
> >
> > It is the function call issue, for which I have a fix I described.

OK.

> >> The next two I have no idea.
> >> The fourth have something obviously wrong with the type of its 'target'.
> >
> >> However, while running sparse-llvm on some code sample I use to test
> >> the linearization, I see that most errors are type errors and are
> >> related to pointer arithmetic, exactly where LLVM's getelemptr is used.
> >> Most offending instructions are OP_ADD (but since I have tests for
> >> bitfields I see also errors for OP_AND, OP_OR & OP_LSR).
> >> I guess that if you test OP_ADD instruction with pointer on one side
> >> and integer on tne other side and issue an appropriate LLVMBuildGEP(),
> >> things will already be much better.
> >>
> >
> > Here is the output from linearize. I think the way stores and loads
> > are handled is broken. It appears that the last store / load
> > instruction is stored in insn->target->priv, and then used later on
> > ... I do not understand what the code is trying to do. Is it trying to
> > optimize away stores and loads?

No, no.
What is stored in ->priv is the target's  LLVMValueRef (and for a store
the 'target' is what need to be stored).
And indeed there is a bug there: it's target_in that should be stored in
->priv (in fact, for a store, there is no need to put anything at all
in this field; at least I don't see any reason why it should).
Nice catch.
I don't know how it's related to your problem though.

Luc

  reply	other threads:[~2017-03-02 17:26 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 [this message]
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
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=20170302171842.xuk535w6wrfxke3b@macpro.local \
    --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.