fab/forwprop: Move optimize_unreachable to forwprop [PR121762]
This moves the optimize_unreachable to forwprop from fab.
There is a slightly optimization here in that the first
statement is checked and outside of the main fold loop. And if
the statement is __builtin_unreachable, then call optimize_unreachable.
Changes since v1:
* v2: simplified the check for BUILT_IN_UNREACHABLE to just use gimple_call_builtin_p.
Move the code after checking for not executable blocks.
Bootstrapped and tested on x86_64-linux-gnu.
PR tree-optimization/121762
gcc/ChangeLog:
* tree-ssa-ccp.cc (optimize_unreachable): Move to tree-ssa-forwprop.cc
(pass_fold_builtins::execute): Remove handling of __builtin_unreachable.
* tree-ssa-forwprop.cc (optimize_unreachable): New function from
tree-ssa-ccp.cc. Change argument to bb. Remove check on first statement
being the __builtin_unreachable since it is handled already.
(pass_forwprop::execute): Handle first statement as being __builtin_unreachable
by calling optimize_unreachable.
Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>