PHIOPT: Move two_value_replacement to match.pd
commit1dd154f6407658d46faa4d21bfec04fc2551506a
authorAndrew Pinski <apinski@marvell.com>
Wed, 26 Apr 2023 02:46:40 +0000 (25 19:46 -0700)
committerAndrew Pinski <apinski@marvell.com>
Fri, 28 Apr 2023 14:25:40 +0000 (28 07:25 -0700)
tree8b3dc90dfee36fcad87de81a4e5e33ad53768a6c
parentc43819a9b4cdaa7359e55f942f20d2ce6fd49da6
PHIOPT: Move two_value_replacement to match.pd

This patch converts two_value_replacement function
into a match.pd pattern.
It is a direct translation with only one minor change,
does not check for the {0,+-1} case as that is handled
before in match.pd so there is no reason to do the extra
check for it.

OK? Bootstrapped and tested on x86_64-linux-gnu with
no regressions.

gcc/ChangeLog:

PR tree-optimization/100958
* tree-ssa-phiopt.cc (two_value_replacement): Remove.
(pass_phiopt::execute): Don't call two_value_replacement.
* match.pd (a !=/== CST1 ? CST2 : CST3): Add pattern to
handle what two_value_replacement did.
gcc/match.pd
gcc/tree-ssa-phiopt.cc