From: Dan Sheridan <djs@postman.org.uk>
To: linux-sparse@vger.kernel.org
Subject: Over-eager code elimination?
Date: Tue, 20 Feb 2007 10:38:22 +0000 [thread overview]
Message-ID: <1171967902.5848.2.camel@localhost.localdomain> (raw)
Running test-linearize on some of my code, I seem to be losing an
assignment after a break.
In this minimal test code, y should have the previous iteration's value
of x, so the value returned is the difference between the final two
values from fetch():
int fetch(int);
int test(int v) {
int x, y;
for (int i=0; ; i++) {
x = fetch(i);
if (v < x) break;
y = x;
}
return x-y;
}
test-linearize produces:
test:
.L0xb7db300c:
<entry-point>
br .L0xb7db3034
.L0xb7db3034:
call.32 %r2 <- fetch, $0
setlt.32 %r5 <- %arg1, %r2
dead %r5
br %r5, .L0xb7db3084, .L0xb7db3034
.L0xb7db3084:
dead %r2
sub.32 %r11 <- %r2, %r2
dead %r11
ret.32 %r11
So it thinks that both x and y are in %r2. However, if y is initialised,
the assignment happens as expected.
Any ideas?
Dan.
next reply other threads:[~2007-02-20 11:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-20 10:38 Dan Sheridan [this message]
2007-02-20 17:30 ` Over-eager code elimination? Linus Torvalds
2007-02-21 8:09 ` Christopher Li
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=1171967902.5848.2.camel@localhost.localdomain \
--to=djs@postman.org.uk \
--cc=linux-sparse@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.