linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sparse-llvm issue with handling of phisrc instruction
@ 2017-03-22 16:46 Dibyendu Majumdar
  2017-03-22 17:38 ` Luc Van Oostenryck
  0 siblings, 1 reply; 13+ messages in thread
From: Dibyendu Majumdar @ 2017-03-22 16:46 UTC (permalink / raw)
  To: Linux-Sparse

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

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

end of thread, other threads:[~2017-03-22 21:45 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-22 16:46 sparse-llvm issue with handling of phisrc instruction Dibyendu Majumdar
2017-03-22 17:38 ` 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

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