PHI-OPT: speed up value_replacement slightly
commit611815e0233302e1fcccca113e6f865fa450b7ae
authorAndrew Pinski <quic_apinski@quicinc.com>
Sun, 28 Apr 2024 01:54:45 +0000 (27 18:54 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Tue, 30 Apr 2024 16:11:55 +0000 (30 09:11 -0700)
tree02261598447e1f7f5e2b850d366499b044f98dc7
parent9c18bdb07e299b25e7526fea16659c7ff8f0d14e
PHI-OPT: speed up value_replacement slightly

This adds a few early outs to value_replacement that I noticed
while rewriting this to use match-and-simplify but could be committed
seperately.
* virtual operands won't change so return early for them
* special case `A ? B : B` as that is already just `B`

Also moves the check for NE/EQ earlier as calculating empty_or_with_defined_p
is an IR walk for a BB and that might be big.

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

gcc/ChangeLog:

* tree-ssa-phiopt.cc (value_replacement): Move check for
NE/EQ earlier.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/tree-ssa-phiopt.cc