[gcc r17-3391] [AutoFDO] Walk predecessor edges for PHI arguments in match
Kugan Vivekanandarajah via Gcc-cvs <[email protected]>
| Newsgroups | gmane.comp.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://gcc.gnu.org/g:01cbfb28f7140f5a6089151b98bdf6a15532fda6 commit r17-3391-g01cbfb28f7140f5a6089151b98bdf6a15532fda6 Author: Kugan Vivekanandarajah <[email protected]> Date: Wed Aug 19 08:30:08 2026 +1000 [AutoFDO] Walk predecessor edges for PHI arguments in match PHI arguments are indexed by incoming edges. function_instance::match walked successor edges and could fail gimple_phi_arg_def_from_edge's destination assertion during afdo_offline. Regression tested on aarch64-linux-gnu with no new regressions Signed-off-by: Kugan Vivekanandarajah <[email protected]> gcc/ChangeLog: 2026-08-19 Kugan Vivekanandarajah <[email protected]> * auto-profile.cc (function_instance::match): Walk predecessor edges for PHI arguments. Diff: --- gcc/auto-profile.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc index 6aa5166c748b..324a26cefc8c 100644 --- a/gcc/auto-profile.cc +++ b/gcc/auto-profile.cc @@ -1764,7 +1764,8 @@ function_instance::match (cgraph_node *node, gcc_assert (!info); dump_stmt (phi, info, NULL, stack); counts.add (info); - for (edge e : bb->succs) + /* PHI arguments are indexed by incoming (predecessor) edges. */ + for (edge e : bb->preds) { location_t phi_loc = gimple_phi_arg_location_from_edge (phi, e);