]> gcc.gnu.org Git - gcc.git/commit
PHIOPT: Mark the conditional lhs and rhs as to look at to see if DCEable
authorAndrew Pinski <apinski@marvell.com>
Tue, 13 Jun 2023 16:17:45 +0000 (09:17 -0700)
committerAndrew Pinski <apinski@marvell.com>
Wed, 2 Aug 2023 08:07:24 +0000 (01:07 -0700)
commit7ff1d1b156cc78034e299757629de33e110a30b1
tree92a9d9106f2e86f579ac576aad6daeb63244df91
parent21c2815605fb0ec43ea65b1104990cf03248013e
PHIOPT: Mark the conditional lhs and rhs as to look at to see if DCEable

In some cases (usually dealing with bools only), there could be some statements
left behind which are considered trivial dead.
An example is:
```
bool f(bool a, bool b)
{
    if (!a && !b)
        return 0;
    if (!a && b)
        return 0;
    if (a && !b)
        return 0;
    return 1;
}
```
Where during phiopt2, the IR had:
```
  _3 = ~b_7(D);
  _4 = _3 & a_6(D);
  _4 != 0 ? 0 : 1
```
match-and-simplify would transform that into:
```
  _11 = ~a_6(D);
  _12 = b_7(D) | _11;
```
But phiopt would leave around the statements defining _4 and _3.
This helps by marking the conditional's lhs and rhs to see if they are
trivial dead.

OK? Bootstrapped and tested on x86_64-linux-gnu.

gcc/ChangeLog:

* tree-ssa-phiopt.cc (match_simplify_replacement): Mark's cond
statement's lhs and rhs to check if trivial dead.
Rename inserted_exprs to exprs_maybe_dce; also move it so
bitmap is not allocated if not needed.
gcc/tree-ssa-phiopt.cc
This page took 0.085148 seconds and 5 git commands to generate.