Re: [PATCH 3/4] sparse, llvm: base load/store address type on insn_symbol_type()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux