Re: [PATCH 1/7] not: add testcases for canonicalization & simplification of negations

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

 



I thought we already canonicalized the pseudo ordering, but clearly not..

Anyway., looks good to me.

Btw, if you want to do another simplification, one that I've actually
seen multiple times in the kernel is this one:

    if (val1 & BITx)
       val2 |= BITy;

and turning it into

    val2 |= (val1 & BITx) .. shift left or right by (BITx-BITy);

and while actually testing the above, I note that sparse seems to have
problems with even simple if-conversion:

   #define BIT1 4
   #define BIT2 8

   int fn(int x, int y)
   {
        if (x & BIT1)
                y |= BIT2;
        return y;
   }

linearizes to a nasty mess of actual phi nodes and conditional jumps
rather than just a 'select' op. Never mind the actual unconditional
version, of course.

I didn't check why the if-conversion doesn't happen.

           Linus



[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