https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109960

Daniel Henrique Barboza <daniel.barboza at oss dot qualcomm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.barboza at oss dot 
qualcomm
                   |                            |.com

--- Comment #13 from Daniel Henrique Barboza <daniel.barboza at oss dot 
qualcomm.com> ---
I tried this one a little bit with match.pd with a simplified example that
doesn't have mem pointers (since match.pd can't deal with them):

```
static inline bool b1(unsigned a)
{
        return (a&1);
}
static inline bool b2(unsigned a)
{
        return (a&2);
}
static inline bool b5(unsigned a)
{
        return (a&5);
}
static inline bool b9(unsigned a)
{
        return (a&9);
}

bool bar3 (unsigned a)
{
  return b1 (a) || b2(a) || b5(a) || b9 (a) ;
}
```

I tried to convince match.pd that this ifcond format can be converted (from
optimized):

;;   basic block 2
  _6 = (_BoolD.4579) a_3(D);
  if (_6 != 0)
    goto <bb 4>; [50.00%]
  else
    goto <bb 3>; [50.00%]

;;   basic block 3
  # RANGE [irange] unsigned int [0, 0][2, 14] MASK 0xe VALUE 0x0
  _10 = a_3(D) & 15;
  _11 = _10 != 0;

;;   basic block 4
  # prephitmp_5 = PHI <_6(2), _11(3)>
  # VUSE <.MEM_2(D)>
  return prephitmp_5;


But even with this very crude an unsafe pattern I couldn't convince it:

(simplify
 (cond (ne (convert@0 @A) integer_zerop)
        @0 (ne (bit_and @A INTEGER_CST@1) integer_zerop))
   (ne (bit_and @A (bit_ior @1 { build_one_cst (TREE_TYPE (@A)); }))
        { build_zero_cst (TREE_TYPE (@A)); }  ))


If this happens to be a hot code I suppose we can throw stuff at
tree-ssa-phiopt and friends until it works.  Unless there's something more
fundamental preventing this from happening ...
  • [Bug tree-optimization... pinskia at gcc dot gnu.org via Gcc-bugs
    • [Bug tree-optimiz... daniel.barboza at oss dot qualcomm.com via Gcc-bugs

Reply via email to