Perform elimination for the basic-block B during the domwalk.
Mark new bb.
We want to perform redundant PHI elimination. Do so by
replacing the PHI with a single copy if possible.
Do not touch inserted, single-argument or virtual PHIs.
Queue the copy for eventual removal.
If we inserted this PHI node ourself, it's not an elimination.
Lookup the RHS of the expression, see if we have an
available computation for it. If so, replace the RHS with
the available computation.
If there is no usable leader mark lhs as leader for its value.
See PR43491. Do not replace a global register variable when
it is a the RHS of an assignment. Do replace local register
variables since gcc does not guarantee a local variable will
be allocated in register.
Do not perform copy propagation or undo constant propagation.
If there is no existing usable leader but SCCVN thinks
it has an expression it wants to use as replacement,
insert that.
If there is no existing leader but SCCVN knows this
value is constant, use that constant.
If we removed EH side-effects from the statement, clean
its EH information.
We need to make sure the new and old types actually match,
which may require adding a simple cast, which fold_convert
will do for us.
If we removed EH side-effects from the statement, clean
its EH information.
Likewise for AB side-effects.
If the statement is a scalar store, see if the expression
has the same value number as its rhs. If so, the store is
dead.
Queue stmt for removal.
Visit COND_EXPRs and fold the comparison with the
available value-numbers.
Visit indirect calls and turn them into direct calls if
possible.
When changing a call into a noreturn call, cfg cleanup
is needed to fix up the noreturn call.
If we removed EH side-effects from the statement, clean
its EH information.
Likewise for AB side-effects.
Changing an indirect call to a direct call may
have exposed different semantics. This may
require an SSA update.
Reimplemented from dom_walker.