All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Christopher Li <sparse@chrisli.org>
Cc: Linux-Sparse <linux-sparse@vger.kernel.org>,
	Dibyendu Majumdar <mobile@majumdar.org.uk>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: sparse-next and preview of 0.5.1-rc5
Date: Wed, 26 Jul 2017 11:00:23 +0200	[thread overview]
Message-ID: <20170726090022.2waraq4rgci2wuq2@ltop.local> (raw)
In-Reply-To: <CANeU7QnovxzRQuhjyRHY==B2Vk5qU9Qk08rTDuvdwmARGci4Og@mail.gmail.com>

On Fri, Jul 21, 2017 at 11:55:09PM -0400, Christopher Li wrote:
> Notice the "add.64      %r6 <- %r6, $4", that is very wrong.
> Not valid SSA form at all.

This is typical of situations where undefined pseudos are involved.
For example this is what Linus wrote on the subject some months ago:

	       and.32      %r3 <- %r4, $-65
	        or.32       %r4 <- %r3, $64
	
	which *initializes* the pseudo %r4 in the second instruction, but uses
	it in the first one. That's a classic pattern of uninitialized pseudos
	in sparse exactly because of the SSA logic.
	
	But it is all internally consistent, and the simplification is
	"correct". The simplification phase very much has a "garbage in,
	garbage out" model.

> I believe that is the one of the condition triggering the crazy programmer
> bug.

Of course, again this is explained in the original patch description.
The "crazy programmer" warning is all about this condition,
either in a single instruction or a chain producing such a cycle.

> It is just you pack the BB early so it does not
> trigger the "crazy programmer".

Yes, this is what was explained in the original patch description.

> I think your patch pack the BB early to avoid the "crazy programmer".
> That sounds more like a cover up rather than a proper fix up.

Like explained in the original patch description, this situation with
a self-defined pseudo can happen in unreachable code *even* if the
pseudo was in fact defined if:
- the definition was done in a loop header
- the loop header was deleted by insert_branch()
  * the definition is then removed, the pseudo become undefined
  * it shouldn't matter since all it's use is now in dead code
  * we don't know the that the loop is now dead code before
    kill_unreachable_bbs() is called.
  * therefore, kill_unreachable_bbs() must be called:
    - after a branch have been deleted
    - before simplify_one_memop() is called and is about to issue the
      "crazy programmer" warning 
      BECAUSE THE "crazy programmer" WARNING SHOULD NOT BE ISSUED
      IF THE CONCERNED CODE IS IN FACT DEAD CODE.

So, if you really prefer, you can call kill_unreachable_bbs() just before
the "crazy programmer" check instead of just after the branch delete
like it was done in my patch but calling kill_unreachable_bbs()
only after clean_up_insn() like done in your patch is wrong.

> If we have the proper SSA form, the "crazy programmer" shouldn't
> pop up at all.

See Linus explanation here above.


I found absolutely incredible the amount of time already wasted
on this issue and it is even not closed yet.
I feel really tired and totally disgusted by all this.

-- Luc


  reply	other threads:[~2017-07-26  9:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-14 17:48 sparse-next and preview of 0.5.1-rc5 Christopher Li
2017-07-15 18:22 ` Luc Van Oostenryck
2017-07-16  2:34   ` Christopher Li
2017-07-17  1:20     ` Christopher Li
2017-07-19 22:17     ` Luc Van Oostenryck
2017-07-20  3:19       ` Christopher Li
2017-07-20 22:35         ` Luc Van Oostenryck
2017-07-21  3:40           ` Christopher Li
2017-07-22  3:55             ` Christopher Li
2017-07-26  9:00               ` Luc Van Oostenryck [this message]
2017-07-26 16:10                 ` Christopher Li
2017-07-26 19:28                   ` 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=20170726090022.2waraq4rgci2wuq2@ltop.local \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=mobile@majumdar.org.uk \
    --cc=sparse@chrisli.org \
    --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 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.