* sparse-llvm potential error in linearized output
@ 2017-03-12 13:04 Dibyendu Majumdar
[not found] ` <CA+55aFzqZozMb0A4HMJ8UTNEV+LqHWXQsSBrPLMts_vkxsKtQA@mail.gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Dibyendu Majumdar @ 2017-03-12 13:04 UTC (permalink / raw)
To: Linux-Sparse
I have the following test:
extern int printf(const char *, ...);
static char *randomletters = "agqwewbxklpfgytuorz";
int main(void)
{
int i;
for (i = 0; i < 20; i++) {
int key;
key = randomletters[i];
printf("Inserting %d\n", key);
}
return 0;
}
The linearized output is:
main:
.L0:
<entry-point>
phisrc.32 %phi4(i) <- $0
br .L4
.L4:
phi.32 %r1(i) <- %phi4(i), %phi5(i)
setlt.32 %r2 <- %r1(i), $20
br %r2, .L1, .L5
.L1:
load.64 %r3 <- 0[randomletters]
scast.64 %r5 <- (32) %r1(i)
add.64 %r6 <- %r3, %r5
load.8 %r7 <- 0[%r6]
scast.32 %r8 <- (8) %r7
symaddr.64 %r9 <- <anon symbol:0000020914372028>
call.32 %r11 <- printf, %r9, %r8
add.32 %r13 <- %r1(i), $1
phisrc.32 %phi5(i) <- %r13
br .L4
.L5:
ret.32 $0
The following instruction looks incorrect to me:
load.64 %r3 <- 0[randomletters]
Thanks and Regards
Dibyendu
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: sparse-llvm potential error in linearized output
[not found] ` <CA+55aFyaW01tfG5LP+aeV-hSppzhqW7gCV7EM2OmxbJyg0cBXw@mail.gmail.com>
@ 2017-03-12 16:52 ` Dibyendu Majumdar
0 siblings, 0 replies; 2+ messages in thread
From: Dibyendu Majumdar @ 2017-03-12 16:52 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Sparse Mailing-list
On 12 March 2017 at 16:27, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> On Mar 12, 2017 6:04 AM, "Dibyendu Majumdar" <mobile@majumdar.org.uk> wrote:
> load.64 %r3 <- 0[randomletters]
>
>
> Looks fine to me.
>
> You have a variable called randomletters, and it's a pointer to a char. That
> 64-bit load just loads that pointer value from the variable into %r3.
>
> The sparse linearized format only has one memory access model: load with
> constant offset. The base can either be a symbol address (like in this case)
> or a register.
>
Ok thanks.
Regards
Dibyendu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-12 16:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-12 13:04 sparse-llvm potential error in linearized output Dibyendu Majumdar
[not found] ` <CA+55aFzqZozMb0A4HMJ8UTNEV+LqHWXQsSBrPLMts_vkxsKtQA@mail.gmail.com>
[not found] ` <CA+55aFxuovvof9UhSAnQMuBjEr0xd8qxbDSV1cpi_ubWx386Zg@mail.gmail.com>
[not found] ` <CA+55aFyaW01tfG5LP+aeV-hSppzhqW7gCV7EM2OmxbJyg0cBXw@mail.gmail.com>
2017-03-12 16:52 ` Dibyendu Majumdar
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).