linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>
To: Xi Wang <xi.wang@gmail.com>
Cc: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
	linux-sparse@vger.kernel.org, "Pekka Enberg" <penberg@kernel.org>,
	"Christopher Li" <sparse@chrisli.org>,
	"Jeff Garzik" <jgarzik@pobox.com>,
	"Linus Torvalds" <torvalds@linux-foundation.org>
Subject: Re: [PATCH 3/4] sparse, llvm: base load/store address type on insn_symbol_type()
Date: Sun, 19 May 2013 02:17:43 +0200	[thread overview]
Message-ID: <20130519001743.GF3154@debian.debian> (raw)
In-Reply-To: <5198047E.5000806@gmail.com>

On Sat, May 18, 2013 at 06:45:18PM -0400, Xi Wang wrote:
> On 05/18/2013 01:52 PM, Jonathan Neuschäfer wrote:
> >   	/* convert address back to pointer */
> > -	addr = LLVMBuildIntToPtr(fn->builder, addr_i,
> > -				 LLVMTypeOf(src_p), "addr");
> > +	addr = LLVMBuildIntToPtr(fn->builder, addr_i, addr_type, "addr");
> 
> Actually, we shouldn't convert pointers to integers in the first place.
> This effectively disables pointer analysis and future optimizations.
> 
> A better way is to use LLVM's GEP for pointer arithmetic, by converting
> pointers to `char *', rather than integers.
> 
> See more examples here:
> http://www.spinics.net/lists/linux-sparse/msg02768.html
> 
> Jonathan, how about this version using `char *' based on your patchset?

It looks good. ACK.

> +	LLVMTypeRef type = LLVMTypeOf(base);
> +	unsigned int as = LLVMGetPointerAddressSpace(type);

Right, I was sloppy about address spaces. :-)


Thanks,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2013-05-19  0:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-18 17:52 [PATCH 1/4] sparse, llvm: Fix resulting type of store address calculations Jonathan Neuschäfer
2013-05-18 17:52 ` [PATCH 2/4] sparse, llvm: de-duplicate load/store address calculation code Jonathan Neuschäfer
2013-05-18 17:52 ` [PATCH 3/4] sparse, llvm: base load/store address type on insn_symbol_type() Jonathan Neuschäfer
2013-05-18 22:45   ` Xi Wang
2013-05-19  0:17     ` Jonathan Neuschäfer [this message]
2013-05-18 17:52 ` [PATCH 4/4] sparse, llvm: add a struct access test case Jonathan Neuschäfer
2013-05-19  8:01 ` [PATCH 1/4] sparse, llvm: Fix resulting type of store address calculations Pekka Enberg

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=20130519001743.GF3154@debian.debian \
    --to=j.neuschaefer@gmx.net \
    --cc=jgarzik@pobox.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=penberg@kernel.org \
    --cc=sparse@chrisli.org \
    --cc=torvalds@linux-foundation.org \
    --cc=xi.wang@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).