]> git.ipfire.org Git - thirdparty/gcc.git/commit
fab/forwprop: Move optimize_unreachable to forwprop [PR121762]
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Tue, 23 Sep 2025 19:14:47 +0000 (12:14 -0700)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Fri, 3 Oct 2025 14:29:07 +0000 (07:29 -0700)
commit415f21fed2c5411cc6a378317f7142b22a623358
tree07361cce1c193de375c9b9189cc59e1aa27a9f43
parenta8326b0c20383b4f10c8a5a3c8c4887fd54d4335
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>
gcc/tree-ssa-ccp.cc
gcc/tree-ssa-forwprop.cc