https://gcc.gnu.org/g:9c3dc461749a1257b9939625ef59b2b056035311
commit r17-4999-g9c3dc461749a1257b9939625ef59b2b056035311 Author: Richard Biener <[email protected]> Date: Thu Oct 8 15:52:59 2026 +0200 tree-optimization/127693 - .ASSUME causes address-takens .ASSUME cannot cause observable escaping of addresses so we do not consider address-takens as part of its arguments as needing TREE_ADDRESSABLE to be set. Without this VN will not be able to disambiguate against calls and replicate IPA analysis predicate conditions as optimization. Similarly for PTA we do not need to generate any constraints for .ASSUME. PR tree-optimization/127693 * tree-ssa-operands.cc (operands_scanner::parse_ssa_operands): For IFN_ASSUME do not cause address-takens. * tree-ssa.cc (execute_update_addresses_taken): Likewise, but still make sure to not rewrite to a register. * gimple-ssa-pta-constraints.cc (find_func_aliases_for_call): No side-effects from IFN_ASSUME, so produce no constraints. Diff: --- gcc/gimple-ssa-pta-constraints.cc | 4 ++++ gcc/tree-ssa-operands.cc | 5 ++++- gcc/tree-ssa.cc | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/gimple-ssa-pta-constraints.cc b/gcc/gimple-ssa-pta-constraints.cc index fe8bd738f338..17b5989b06b8 100644 --- a/gcc/gimple-ssa-pta-constraints.cc +++ b/gcc/gimple-ssa-pta-constraints.cc @@ -2125,6 +2125,10 @@ find_func_aliases_for_call (struct function *fn, gcall *t) if (gimple_call_internal_p (t, IFN_DEFERRED_INIT)) return; + /* .ASSUME produces a flag and has no observable side-effects. */ + if (gimple_call_internal_p (t, IFN_ASSUME)) + return; + fi = get_fi_for_callee (t); if (!in_ipa_mode || (fi->decl && fndecl && !fi->is_fn_info)) diff --git a/gcc/tree-ssa-operands.cc b/gcc/tree-ssa-operands.cc index d7a79f40f9d9..c526c842b2fb 100644 --- a/gcc/tree-ssa-operands.cc +++ b/gcc/tree-ssa-operands.cc @@ -953,6 +953,7 @@ operands_scanner::parse_ssa_operands () { enum gimple_code code = gimple_code (stmt); size_t i, n, start = 0; + int flags = 0; switch (code) { @@ -985,6 +986,8 @@ operands_scanner::parse_ssa_operands () case GIMPLE_CALL: /* Add call-clobbered operands, if needed. */ maybe_add_call_vops (as_a <gcall *> (stmt)); + if (gimple_call_internal_p (stmt, IFN_ASSUME)) + flags |= opf_non_addressable; /* FALLTHRU */ case GIMPLE_ASSIGN: @@ -996,7 +999,7 @@ operands_scanner::parse_ssa_operands () do_default: n = gimple_num_ops (stmt); for (i = start; i < n; i++) - get_expr_operands (gimple_op_ptr (stmt, i), opf_use); + get_expr_operands (gimple_op_ptr (stmt, i), opf_use | flags); break; } } diff --git a/gcc/tree-ssa.cc b/gcc/tree-ssa.cc index 436c88d47d5c..b0cd2aa1b43b 100644 --- a/gcc/tree-ssa.cc +++ b/gcc/tree-ssa.cc @@ -1954,6 +1954,20 @@ execute_update_addresses_taken (void) else if (is_asan_mark_p (stmt) || gimple_call_internal_p (stmt, IFN_GOMP_SIMT_ENTER)) ; + else if (gimple_call_internal_p (stmt, IFN_ASSUME)) + { + /* An address-taken arguments are not relevant for aliasing + and we never expand the call (and need the address). + But we can't use a register. */ + for (unsigned i = 1; i < gimple_call_num_args (stmt); ++i) + { + tree arg = gimple_call_arg (stmt, i); + if (TREE_CODE (arg) == ADDR_EXPR) + bitmap_set_bit (not_reg_needs, + DECL_UID (get_base_address + (TREE_OPERAND (arg, 0)))); + } + } else set_addresses_taken (stmt, addresses_taken); }
