From: Christopher Li <sparse@chrisli.org>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Dibyendu Majumdar <mobile@majumdar.org.uk>,
Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: Re: Potential incorrect simplification
Date: Sun, 6 Aug 2017 10:24:30 -0400 [thread overview]
Message-ID: <CANeU7QnjRSnnSc8ew69-0M7XP2zoSVh3jhCciYDRVF0i24d=sQ@mail.gmail.com> (raw)
In-Reply-To: <20170806140035.f2tqkmiufjytiwri@ltop.local>
On Sun, Aug 6, 2017 at 10:00 AM, Luc Van Oostenryck
<luc.vanoostenryck@gmail.com> wrote:
>> Sorry I wasn't able to participate this discussion earlier. I am catching
>> up at the important sparse mailing list discussion. This is one of them.
>>
>> This has puzzle me for a long time. From the looks it seems %4 was
>> used before it was define. Is that legal SSA form?
>
> What do you mean exactly by "legal SSA form"?
Legal SSA form means it preserve the normal SSA
properties. E.g. the dominance property of SSA.
> As I've already tried to explain you several times:
> it's a *symptom* that something have been wrong, either:
> - the initial code had some undefined variables
The source code has some variable uninitialized is still valid
C source code. In such condition the compiler produce transformation
that break the dominance property of SSA is wrong IMHO.
> - it's an internal bug.
>
> In both cases you can't do anymore 'normal' processing on it.
> In this sense it's "illegal".
I mean the transformation that break the SSA dominance property
is illegal. The source code is legal to have uninitialized values. When
we convert the memory variable to pseudo, we should take into account
that uninitialized variable has one implicit initial define value
"uninitialized".
In other words, we shouldn't produce the IR that use before define like
this:
and.32 %r3 <- %r4, $-65
or.32 %r4 <- %r3, $64
> The other way to see it is something like: "ok, this means that the
> pseudo was not initialized" (and ignore the internal bug aspect) and
No, in SSA world, there is no pseudo is not initialized. Please refer back
Dominance Property of SSA:
1. If x is used in a Phi-function in block N,
then the definition of x dominates *every* <==== notice "every"
predecessor of N.
It has incoming edge to the phi node, it need to be defined.
It means that you can't just do what ever you want with that
edge. You can pick a what ever initial value for the uninitialized
value, you can't just pretend that uninitialized edge does not exist
and do whatever you want with it.
> then process it as such (for example choose any value you like for it).
> You can call this "a new/legal SSA form" if you like but it will only
> confuse discussion and won't change it's nature.
OK, points taken. Replace "illegal SSA from" with "SSA form that violate
the SSA dominance property" so that we are clear what we are talking
about here.
Chris
next prev parent reply other threads:[~2017-08-06 14:24 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-28 12:40 Potential incorrect simplification Dibyendu Majumdar
2017-03-28 13:34 ` Luc Van Oostenryck
2017-03-28 13:58 ` Dibyendu Majumdar
2017-03-28 14:11 ` Luc Van Oostenryck
2017-03-28 14:19 ` Dibyendu Majumdar
2017-03-28 16:20 ` Linus Torvalds
2017-03-28 17:00 ` Luc Van Oostenryck
2017-03-28 18:02 ` Linus Torvalds
2017-03-28 20:27 ` Luc Van Oostenryck
2017-03-28 21:57 ` Linus Torvalds
2017-03-28 22:28 ` Luc Van Oostenryck
2017-03-28 22:22 ` Dibyendu Majumdar
2017-08-06 12:46 ` Christopher Li
2017-08-06 14:00 ` Luc Van Oostenryck
2017-08-06 14:24 ` Christopher Li [this message]
2017-08-06 14:54 ` Christopher Li
2017-08-06 15:07 ` Luc Van Oostenryck
2017-08-06 15:51 ` Christopher Li
2017-08-06 16:51 ` Luc Van Oostenryck
2017-08-06 18:35 ` Christopher Li
2017-08-06 19:51 ` Dibyendu Majumdar
2017-08-06 20:08 ` Luc Van Oostenryck
2017-08-06 19:52 ` Luc Van Oostenryck
2017-08-06 23:34 ` Christopher Li
2017-08-07 0:31 ` Luc Van Oostenryck
2017-08-07 0:38 ` Christopher Li
2017-08-06 15:52 ` Dibyendu Majumdar
2017-08-06 16:56 ` Luc Van Oostenryck
2017-08-06 17:04 ` Dibyendu Majumdar
2017-08-06 17:45 ` Luc Van Oostenryck
2017-08-06 17:58 ` Dibyendu Majumdar
2017-08-06 18:15 ` Luc Van Oostenryck
2017-08-06 18:18 ` Dibyendu Majumdar
2017-08-06 18:31 ` Luc Van Oostenryck
2017-08-07 19:11 ` [PATCH v2 0/8] fix loading of partially defined bitfield Luc Van Oostenryck
2017-08-07 19:11 ` [PATCH v2 1/8] Remove single-store shortcut Luc Van Oostenryck
2017-08-07 21:42 ` Linus Torvalds
2017-08-10 0:29 ` Christopher Li
2017-08-10 0:41 ` Luc Van Oostenryck
2017-08-10 0:53 ` Christopher Li
2017-08-10 11:01 ` Christopher Li
2017-08-10 12:26 ` Luc Van Oostenryck
2017-08-10 13:25 ` Christopher Li
2017-08-07 19:11 ` [PATCH v2 2/8] new helper: def_opcode() Luc Van Oostenryck
2017-08-07 19:12 ` [PATCH v2 3/8] reuse nbr_pseudo_users() Luc Van Oostenryck
2017-08-07 19:12 ` [PATCH v2 4/8] change the masking when loading bitfields Luc Van Oostenryck
2017-08-07 19:12 ` [PATCH v2 5/8] simplify ((A & M') | B ) & M when M' & M == 0 Luc Van Oostenryck
2017-08-07 19:12 ` [PATCH v2 6/8] transform (A & M) >> S to (A >> S) & (M >> S) Luc Van Oostenryck
2017-08-08 0:22 ` Christopher Li
2017-08-08 0:29 ` Luc Van Oostenryck
2017-08-08 1:48 ` Christopher Li
2017-08-08 1:00 ` Linus Torvalds
2017-08-08 1:38 ` Luc Van Oostenryck
2017-08-08 1:50 ` Christopher Li
2017-08-07 19:12 ` [PATCH v2 7/8] transform (A << S) >> S into A & (-1 " Luc Van Oostenryck
2017-08-07 21:54 ` Linus Torvalds
2017-08-07 22:08 ` Luc Van Oostenryck
2017-08-07 22:27 ` Luc Van Oostenryck
2017-08-07 19:12 ` [PATCH v2 8/8] fix: cast of OP_AND only valid if it's an OP_CAST Luc Van Oostenryck
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='CANeU7QnjRSnnSc8ew69-0M7XP2zoSVh3jhCciYDRVF0i24d=sQ@mail.gmail.com' \
--to=sparse@chrisli.org \
--cc=linux-sparse@vger.kernel.org \
--cc=luc.vanoostenryck@gmail.com \
--cc=mobile@majumdar.org.uk \
--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).