From mboxrd@z Thu Jan 1 00:00:00 1970 From: Luc Van Oostenryck Subject: Re: [PATCH 07/13] llvm: fix output OP_ADD mixed with pointers Date: Mon, 6 Mar 2017 20:52:35 +0100 Message-ID: <20170306195234.dqrbqs4owehwipdl@macpro.local> References: <20170305112047.3411-1-luc.vanoostenryck@gmail.com> <20170305112047.3411-8-luc.vanoostenryck@gmail.com> <20170306164306.hibukuy2t4j4camh@macpro.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mail-wm0-f50.google.com ([74.125.82.50]:37221 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932368AbdCFUAA (ORCPT ); Mon, 6 Mar 2017 15:00:00 -0500 Received: by mail-wm0-f50.google.com with SMTP id n11so74124841wma.0 for ; Mon, 06 Mar 2017 11:59:59 -0800 (PST) Content-Disposition: inline In-Reply-To: Sender: linux-sparse-owner@vger.kernel.org List-Id: linux-sparse@vger.kernel.org To: Christopher Li Cc: Dibyendu Majumdar , Linux-Sparse On Tue, Mar 07, 2017 at 01:07:27AM +0800, Christopher Li wrote: > On Tue, Mar 7, 2017 at 12:43 AM, Luc Van Oostenryck > wrote: > > > > With an example: > > == C code == > > void *foo(int *p) { return p + 5; } > > > > == linearized code == > > foo: > > .L0: > > > > add.64 %r2 <- %arg1, $20 > > cast.64 %r3 <- (64) %r2 > > ret.64 %r3 > > > > == LLVM code from sparse-llvm == > > ; ModuleID = '' > > source_filename = "sparse" > > > > define i8* @foo(i32* %ARG1) { > > L0: > > %0 = getelementptr i32, i32* %ARG1, inttoptr (i64 20 to i32*) > > %R3 = bitcast i32* %0 to i8* > > ret i8* %R3 > > } > > > > > OK, good. Let's use this example. > I am using clang to get the llvm bytecode. t.c is your example. > > clang -S -emit-llvm /tmp/t.c > Here is output, compare the line I am pointing at: > The indices should be 5 according clang's output. > However sparse-llvm generate as 20 per your output > if I am reading it correctly. Absolutely. -- Luc