Re: regressions on HEAD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 26, 2018 at 5:12 PM, Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:
> On Mon, Feb 26, 2018 at 03:36:38PM -0800, Christopher Li wrote:
>>
>> You said you did not found crash in your first round testing.
>> However there is some regression of the IR. Can you share
>> the regression test case you found?
>
> I didn't spend much time at it but a typical small example
> of what I've seen is:
>         void a(void) {
>           long b;
>           unsigned c = 0;
>           for (;;)
>             if (c)
>               c = b;
>         }
>
> Before it linearized as:
>         .L0:
>                 br          .L2
>         .L2:
>                 br          .L2
>
> Now it linearizes as:
>         .L0:
>                 phisrc.32   %phi1(c) <- $0
>                 br          .L1
>         .L1:
>                 phi.32      %r1 <- %phi1(c), %phi2(c)
>                 cbr         %r1, .L5, .L1
>         .L5:
>                 phisrc.32   %phi2(c) <- $0
>                 br          .L1
>
> It's clearly one of the problem with casts and the CSE changes
> I've talked about. I'm sure that the fact that b is uninitialized

First of all, that is a VALID IR of the original source code.
I play with it a little more.

void a(void) {
          long b = 1;
          int c = 0;
          for (;;)
            if (c)
              c = b;
        }
}

For both before and after the sized pseudo merge, it output:
.L0:
<entry-point>
phisrc.32   %phi1(c) <- $0
br          .L1

.L1:
phi.32      %r1 <- %phi1(c), %phi2(c)
cbr         %r1, .L5, .L1

.L5:
phisrc.32   %phi2(c) <- $1
br          .L5

If we change to "long b=0;", both before and after the merge it output:

.L0:
<entry-point>
br          .L2

.L2:
br          .L2

So clearly sparse is not smart enough to see that C = 0  then
the srcphi2(c) is never going to be executed.

It is depending on phisrc2(c) and phisrc1(c) are the exact same
pseudo (0) so it optimized away the %r1 phi instruction as 0.

In the case b is not define then pick one value (1) then you get
the long output and pick value (0) you get the short version.
It is clear pointing towards b is not being initialized making
the different here.

How are you convinced it is independent of the problem itself?

It is possible that CSE is seeing same value of constant has
two different size might consider it as different pseudo. In those
case we want to close examine how do it get into this situation
in the first place.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux