linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linearize bug?
@ 2011-08-27  6:29 Jeff Garzik
  2011-08-27 11:34 ` Kamil Dudka
  0 siblings, 1 reply; 19+ messages in thread
From: Jeff Garzik @ 2011-08-27  6:29 UTC (permalink / raw)
  To: Sparse Mailing-list; +Cc: Pekka J Enberg, Linus Torvalds

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?



^ permalink raw reply	[flat|nested] 19+ messages in thread
* linearize bug?
@ 2006-11-12  4:09 Jeff Garzik
  2006-11-13  4:43 ` Linus Torvalds
  0 siblings, 1 reply; 19+ messages in thread
From: Jeff Garzik @ 2006-11-12  4:09 UTC (permalink / raw)
  To: linux-sparse

Given the following C code:
#include <stdlib.h>

int foo(void)
{
         int i;

         i = 42;
         i += rand();

         return i;
}

test-linearize seems to give me the following output, which indicates 
that pseudo %r1 is "dead" immediately before it is used:

foo:
.L0x2b52beecd010:
         <entry-point>
         call.32     %r1 <- rand
         dead        %r1
         add.32      %r4 <- %r1, $42
         dead        %r4
         ret.32      %r4

Am I just confused about the meaning of "dead"?   :)

	Jeff

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2011-08-28  8:53 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-27  6:29 linearize bug? Jeff Garzik
2011-08-27 11:34 ` Kamil Dudka
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

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).