linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dibyendu Majumdar <mobile@majumdar.org.uk>
To: Linux-Sparse <linux-sparse@vger.kernel.org>
Subject: sparse-llvm issue with handling of phisrc instruction
Date: Wed, 22 Mar 2017 16:46:24 +0000	[thread overview]
Message-ID: <CACXZuxdzxg_+rXu-OEUe+CwbbW+C-0CHZ=1wRrGa1ysptGDozA@mail.gmail.com> (raw)

Hi

I am trying to see if sparse-llvm can handle unsimplified IR output
from linearizer. I think there is a problem in how it handles phisrc.
Example:

static int testfunc(int i) {
return i-6;
}

Linearied IR:
testfunc:
.L0:
        <entry-point>
        store.32    %arg1 -> 0[i]
        load.32     %r1 <- 0[i]
        sub.32      %r2 <- %r1, $6
        phisrc.32   %phi1(return) <- %r2
        br          .L1

.L1:
        phi.32      %r3 <- %phi1(return)
        ret.32      %r2


But the LLVM IR is missing a store instruction corresponding to the
phisrc instruction:

define internal i32 @testfunc(i32 %ARG1) {
L0:
  %i_0000029F015CAA78 = alloca i32
  %0 = alloca i32
  %1 = ptrtoint i32* %i_0000029F015CAA78 to i64
  %2 = add i64 %1, 0
  %3 = inttoptr i64 %2 to i32*
  store i32 %ARG1, i32* %3
  %4 = ptrtoint i32* %i_0000029F015CAA78 to i64
  %5 = add i64 %4, 0
  %6 = inttoptr i64 %5 to i32*
  %load_target = load i32, i32* %6
  %R2 = sub i32 %load_target, 6
  br label %L1

L1:                                               ; preds = %L0
  %7 = load i32, i32* %0
  ret i32 %R2
}

Basically we need a store from %i_0000029F015CAA78 to %0 output for
the phisrc instruction above.

I see that it emits stores for phi_users when it encounters a phisrc
but the phi_users list appears to be empty here. Is that expected? If
so, then how to fix this issue i.e. add the missing store?

Thanks and Regards
Dibyendu

             reply	other threads:[~2017-03-22 16:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22 16:46 Dibyendu Majumdar [this message]
2017-03-22 17:38 ` sparse-llvm issue with handling of phisrc instruction Luc Van Oostenryck
2017-03-22 18:05   ` Dibyendu Majumdar
2017-03-22 18:15     ` Luc Van Oostenryck
2017-03-22 18:17       ` Dibyendu Majumdar
2017-03-22 18:55         ` Dibyendu Majumdar
2017-03-22 20:42           ` Luc Van Oostenryck
2017-03-22 20:48             ` Dibyendu Majumdar
2017-03-22 21:38               ` Luc Van Oostenryck
2017-03-22 19:29         ` Luc Van Oostenryck
2017-03-22 19:46           ` Dibyendu Majumdar
2017-03-22 20:33             ` Dibyendu Majumdar
2017-03-22 20:46             ` 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='CACXZuxdzxg_+rXu-OEUe+CwbbW+C-0CHZ=1wRrGa1ysptGDozA@mail.gmail.com' \
    --to=mobile@majumdar.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 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).