All of lore.kernel.org
 help / color / mirror / Atom feed
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 type when ealing with union type
Date: Sun, 19 Mar 2017 20:48:03 +0000	[thread overview]
Message-ID: <CACXZuxfY1nfvpRfA_MBzuLnZMxJjGSvpR-4CQiKUSnkdXOCYMw@mail.gmail.com> (raw)
In-Reply-To: <CACXZuxeEgMv2iY=kFi_jWpJ2m5Lmx2qxr738mw8oJ+f=pPR2sw@mail.gmail.com>

Hi Luc,

On 19 March 2017 at 17:55, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
> On 19 March 2017 at 17:15, Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
>> On Sun, Mar 19, 2017 at 5:37 PM, Dibyendu Majumdar
>> <mobile@majumdar.org.uk> wrote:
>>> On 19 March 2017 at 15:36, Luc Van Oostenryck
>>> <luc.vanoostenryck@gmail.com> wrote:
>>>>
>>> I noticed that in the latest patch series for add/sub you are not
>>> using GEP anymore, and there is a conversion to target type at the end
>>> of a binary op. I will try out these changes and report back.
>>
>> Yes. It's not that the GEP was wrong but it was not enough and the more
>> complete solution made this one unneeded.
>>
>
> I have now tested the changes to binary op implementation - and I can
> confirm that all my tests pass, and this appears to be a better
> approach than the previous one that used the GEP instruction.
>

It seems that we can replace the other GEP too with pointer
arithmetic. This makes LLVM output closer to the IR generated by
sparse.

The change required is in calc_memop_addr():

 /* int type large enough to hold a pointer */
 int_type = LLVMIntType(bits_in_pointer);
 /* IMPORTANT offset can be negative */
 off = LLVMConstInt(int_type, (int) insn->offset, 0);
 /* convert src to the effective pointer type */
 src = pseudo_to_value(fn, insn, insn->src);
 as = LLVMGetPointerAddressSpace(LLVMTypeOf(src));
 addr_type = LLVMPointerType(insn_symbol_type(insn), as);
 src = value_to_ivalue(fn, src);
 addr = LLVMBuildAdd(fn->builder, src, off, "");
 addr = LLVMBuildIntToPtr(fn->builder, addr, addr_type, "");
 return addr;


Regards
Dibyendu

      reply	other threads:[~2017-03-19 21:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13 22:54 sparse-llvm incorrect type when ealing with union type Dibyendu Majumdar
2017-03-13 23:44 ` Dibyendu Majumdar
2017-03-14  1:29   ` Dibyendu Majumdar
2017-03-19 15:36 ` Luc Van Oostenryck
2017-03-19 15:54   ` Dibyendu Majumdar
2017-03-19 16:37   ` Dibyendu Majumdar
2017-03-19 17:15     ` Luc Van Oostenryck
2017-03-19 17:55       ` Dibyendu Majumdar
2017-03-19 20:48         ` Dibyendu Majumdar [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=CACXZuxfY1nfvpRfA_MBzuLnZMxJjGSvpR-4CQiKUSnkdXOCYMw@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 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.