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

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

 



On Sun, Nov 22, 2020 at 11:57 AM Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:
>
> In the case here with your example, the if-conversion doesn't happen
> because the phi-sources is not defined in the top block because of
> the OR:

Ahh. Yes, it's more obvious with a more realistic test-case that
actually translates one set of bits to another set of bits (which is
something we do in the kernel for various reasons - different bit
"namespaces", for example user interfaces etc):

   #define BIT1   4
   #define BIT1x 16

   #define BIT2   8
   #define BIT2x 32

   int translate_bits(int x)
   {
        int y = 0;
        if (x & BIT1)
                y |= BIT1x;
        if (x & BIT2)
                y |= BIT2x;
        return y;
   }

and the first one gets nicely translated as

   and.32      %r2 <- %arg1, $4
   select.32   %r14(y) <- %r2, $16, $0

but then the second one doesn't for the reason you mention.

Honestly, particularly in the conditional form, the OP_SEL
optimization might not even be the right thing. It adds register
pressure.

So maybe a better model would be to not try to do jump-conversion, but
have some kind of general "can we simplify phi nodes", where jump
conversion to OP_SEL is just one of the options.

              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