linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kamil Dudka <kdudka@redhat.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Sparse Mailing-list <linux-sparse@vger.kernel.org>,
	Pekka J Enberg <penberg@cs.helsinki.fi>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: linearize bug?
Date: Sat, 27 Aug 2011 13:34:17 +0200	[thread overview]
Message-ID: <201108271334.17659.kdudka@redhat.com> (raw)
In-Reply-To: <4E588EB8.80808@garzik.org>

On Saturday 27 August 2011 08:29:12 Jeff Garzik wrote:
> While trying to implement loops in LLVM, the following testcase appears
> to have some strange behavior:
>
> int foo(int x)
> {
> 	int i;
>
> 	for (i = 0; i < 10; i++)
> 		x += 42;
>
> 	return x;
> }
>
> when run through test-linearize produces
>
> foo.c:1:5: warning: symbol 'foo' was not declared. Should it be static?
> foo:
> .L0x7f4c095ae010:
> 	<entry-point>
> 	phisrc.32   %phi2(x) <- %arg1
> 	phisrc.32   %phi4(x) <- %arg1
> 	phisrc.32   %phi7(i) <- $0
> 	br          .L0x7f4c095ae150
>
> .L0x7f4c095ae150:
> 	phi.32      %r1(i) <- %phi7(i), %phi8(i)
> 	setlt.32    %r2 <- %r1(i), $10
> 	br          %r2, .L0x7f4c095ae060, .L0x7f4c095ae100
>
> .L0x7f4c095ae060:
> 	add.32      %r5 <- %r9, $42
> 	phisrc.32   %phi3(x) <- %r5
> 	phisrc.32   %phi5(x) <- %r5
> 	add.32      %r8 <- %r1(i), $1
> 	phisrc.32   %phi8(i) <- %r8
> 	br          .L0x7f4c095ae150
>
> .L0x7f4c095ae100:
> 	phi.32      %r9 <- %phi2(x), %phi3(x)
> 	ret.32      %r9
>
> So...  WTF did %r9 come from, in the third basic block?

Two years ago I proposed a patch that I believe would solve your problem:

https://patchwork.kernel.org/patch/40307/

Kamil

  reply	other threads:[~2011-08-27 11:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-27  6:29 linearize bug? Jeff Garzik
2011-08-27 11:34 ` Kamil Dudka [this message]
2011-08-27 15:29   ` Linus Torvalds
2011-08-27 15:37     ` Jeff Garzik
2011-08-27 15:53       ` Linus Torvalds
2011-08-27 16:54         ` Kamil Dudka
2011-08-27 17:13           ` Linus Torvalds
2011-08-27 17:27             ` Linus Torvalds
2011-08-27 19:26               ` Linus Torvalds
2011-08-27 20:03         ` Jeff Garzik
2011-08-28  6:26           ` Pekka Enberg
2011-08-27 23:39         ` [PATCH] cse: update PHI users when throwing away an instruction Kamil Dudka
2011-08-28  0:34           ` Linus Torvalds
2011-08-28  6:32             ` Christopher Li
2011-08-28  6:33             ` Pekka Enberg
2011-08-28  8:53               ` Jeff Garzik
2011-08-27 22:07   ` linearize bug? Jeff Garzik
  -- strict thread matches above, loose matches on Subject: below --
2006-11-12  4:09 Jeff Garzik
2006-11-13  4:43 ` Linus Torvalds

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=201108271334.17659.kdudka@redhat.com \
    --to=kdudka@redhat.com \
    --cc=jeff@garzik.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=torvalds@linux-foundation.org \
    /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).