<feed xmlns='http://www.w3.org/2005/Atom'>
<title>gcc.git/gcc/ipa-prop.cc, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/'/>
<entry>
<title>ipa: Remove LTO requirement for builtin callback carriers.</title>
<updated>2025-11-21T08:17:26+00:00</updated>
<author>
<name>Josef Melcr</name>
<email>josef.melcr@suse.com</email>
</author>
<published>2025-11-20T22:57:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=f9c01c47f8e5451e41a5df78f044d7b1e7b3d5d6'/>
<id>f9c01c47f8e5451e41a5df78f044d7b1e7b3d5d6</id>
<content type='text'>
Due to the if statement in ipa_compute_jump_functions_for_bb, callback
edges were never constructed for builtin functions unless LTO was
enabled.  This patch corrects this behavior, allowing GCC to optimize
callbacks more broadly.  It also extends our testing capabilities.

gcc/ChangeLog:

	* attr-callback.cc (callback_edge_callee_has_attr): New
	function.
	* attr-callback.h (callback_edge_callee_has_attr): New function
	decl.
	* ipa-prop.cc (ipa_compute_jump_functions_for_bb): Don't skip
	callback carriers when calculating jump functions.

libgomp/ChangeLog:

	* testsuite/libgomp.c/ipcp-cb-spec1.c: Remove LTO requirement.
	* testsuite/libgomp.c/ipcp-cb-spec2.c: Likewise.
	* testsuite/libgomp.c/ipcp-cb1.c: Likewise.

Signed-off-by: Josef Melcr &lt;josef.melcr@suse.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Due to the if statement in ipa_compute_jump_functions_for_bb, callback
edges were never constructed for builtin functions unless LTO was
enabled.  This patch corrects this behavior, allowing GCC to optimize
callbacks more broadly.  It also extends our testing capabilities.

gcc/ChangeLog:

	* attr-callback.cc (callback_edge_callee_has_attr): New
	function.
	* attr-callback.h (callback_edge_callee_has_attr): New function
	decl.
	* ipa-prop.cc (ipa_compute_jump_functions_for_bb): Don't skip
	callback carriers when calculating jump functions.

libgomp/ChangeLog:

	* testsuite/libgomp.c/ipcp-cb-spec1.c: Remove LTO requirement.
	* testsuite/libgomp.c/ipcp-cb-spec2.c: Likewise.
	* testsuite/libgomp.c/ipcp-cb1.c: Likewise.

Signed-off-by: Josef Melcr &lt;josef.melcr@suse.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>lto: Use toplevel_node in lto_symtab_encoder</title>
<updated>2025-10-30T15:49:33+00:00</updated>
<author>
<name>Michal Jires</name>
<email>mjires@suse.cz</email>
</author>
<published>2025-08-25T16:07:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=cfce5ff1f62e1e428419ba1ab4427a482f32782e'/>
<id>cfce5ff1f62e1e428419ba1ab4427a482f32782e</id>
<content type='text'>
This patch replaces symtab_node with toplevel_node in lto_symtab_encoder
and modifies all places where lto_symtab_encoder is used to handle
(ignore) asm_node.

gcc/ChangeLog:

	* ipa-icf.cc (sem_item_optimizer::write_summary): Use
	toplevel_node.
	(sem_item_optimizer::read_section): Likewise.
	* ipa-modref.cc (modref_write): Likewise.
	* ipa-prop.cc (ipa_write_return_summaries): Likewise.
	(ipcp_write_transformation_summaries): Likewise.
	* ipa-reference.cc (ipa_reference_write_optimization_summary):
	Likewise.
	* lto-cgraph.cc (lto_symtab_encoder_new): Likewise.
	(lto_symtab_encoder_encode): Likewise.
	(lto_symtab_encoder_delete_node): Likewise.
	(lto_symtab_encoder_in_partition_p): Likewise.
	(lto_set_symtab_encoder_in_partition): Likewise.
	(output_refs): Likewise.
	(compute_ltrans_boundary): Likewise.
	(output_symtab): Likewise.
	(output_cgraph_opt_summary): Likewise.
	* lto-streamer-out.cc (lto_output): Likewise.
	(produce_symtab): Likewise.
	(produce_symtab_extension): Likewise.
	* lto-streamer.h (struct lto_encoder_entry): Likewise.
	(struct lto_symtab_encoder_d): Likewise.
	(lto_symtab_encoder_encode): Likewise.
	(lto_symtab_encoder_delete_node): Likewise.
	(lto_symtab_encoder_in_partition_p): Likewise.
	(lto_symtab_encoder_lookup): Likewise.
	(lsei_next): Likewise.
	(lsei_varpool_node): Likewise.

gcc/lto/ChangeLog:

	* lto-partition.cc (add_symbol_to_partition): Use toplevel_node.
	(undo_partition): Likewise.
	(join_partitions): Likewise.
	(split_partition_into_nodes): Likewise.
	(is_partition_reorder): Likewise.
	(lto_balanced_map): Likewise.
	(lto_promote_cross_file_statics): Likewise.
	* lto.cc (lto_wpa_write_files): Likewise.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch replaces symtab_node with toplevel_node in lto_symtab_encoder
and modifies all places where lto_symtab_encoder is used to handle
(ignore) asm_node.

gcc/ChangeLog:

	* ipa-icf.cc (sem_item_optimizer::write_summary): Use
	toplevel_node.
	(sem_item_optimizer::read_section): Likewise.
	* ipa-modref.cc (modref_write): Likewise.
	* ipa-prop.cc (ipa_write_return_summaries): Likewise.
	(ipcp_write_transformation_summaries): Likewise.
	* ipa-reference.cc (ipa_reference_write_optimization_summary):
	Likewise.
	* lto-cgraph.cc (lto_symtab_encoder_new): Likewise.
	(lto_symtab_encoder_encode): Likewise.
	(lto_symtab_encoder_delete_node): Likewise.
	(lto_symtab_encoder_in_partition_p): Likewise.
	(lto_set_symtab_encoder_in_partition): Likewise.
	(output_refs): Likewise.
	(compute_ltrans_boundary): Likewise.
	(output_symtab): Likewise.
	(output_cgraph_opt_summary): Likewise.
	* lto-streamer-out.cc (lto_output): Likewise.
	(produce_symtab): Likewise.
	(produce_symtab_extension): Likewise.
	* lto-streamer.h (struct lto_encoder_entry): Likewise.
	(struct lto_symtab_encoder_d): Likewise.
	(lto_symtab_encoder_encode): Likewise.
	(lto_symtab_encoder_delete_node): Likewise.
	(lto_symtab_encoder_in_partition_p): Likewise.
	(lto_symtab_encoder_lookup): Likewise.
	(lsei_next): Likewise.
	(lsei_varpool_node): Likewise.

gcc/lto/ChangeLog:

	* lto-partition.cc (add_symbol_to_partition): Use toplevel_node.
	(undo_partition): Likewise.
	(join_partitions): Likewise.
	(split_partition_into_nodes): Likewise.
	(is_partition_reorder): Likewise.
	(lto_balanced_map): Likewise.
	(lto_promote_cross_file_statics): Likewise.
	* lto.cc (lto_wpa_write_files): Likewise.
</pre>
</div>
</content>
</entry>
<entry>
<title>ipa, cgraph: Enable constant propagation to OpenMP kernels.</title>
<updated>2025-10-17T09:31:38+00:00</updated>
<author>
<name>Josef Melcr</name>
<email>jmelcr02@gmail.com</email>
</author>
<published>2025-10-16T14:25:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=7cd91c7c42eec894c8c13fa68ccc12ec3a047c9a'/>
<id>7cd91c7c42eec894c8c13fa68ccc12ec3a047c9a</id>
<content type='text'>
This patch enables constant propagation to outlined OpenMP kernels.
It does so using a new function attribute called ' callback' (note the
space).

The attribute ' callback' captures the notion of a function calling one
of its arguments with some of its parameters as arguments.  An OpenMP
example of such function is GOMP_parallel.
We implement the attribute with new callgraph edges called callback
edges. They are imaginary edges pointing from the caller of the function
with the attribute (e.g. caller of GOMP_parallel) to the body function
itself (e.g. the outlined OpenMP body).  They share their call statement
with the edge from which they are derived (direct edge caller -&gt; GOMP_parallel
in this case).  These edges allow passes such as ipa-cp to see the hidden
call site to the body function and optimize the function accordingly.

To illustrate on an example, the body GOMP_parallel looks something
like this:

void GOMP_parallel (void (*fn) (void *), void *data, /* ... */)
{
  /* ... */
  fn (data);
  /* ... */
}

If we extend it with the attribute ' callback(1, 2)', we express that the
function calls its first argument and passes it its second argument.
This is represented in the call graph in this manner:

             direct                         indirect
caller -----------------&gt; GOMP_parallel ---------------&gt; fn
  |
  ----------------------&gt; fn
          callback

The direct edge is then the callback-carrying edge, all new edges
are the derived callback edges.
While constant propagation is the main focus of this patch, callback
edges can be useful for different passes (for example, they improve icf
for OpenMP kernels), as they allow for address redirection.
If the outlined body function gets optimized and cloned, from body_fn to
body_fn.optimized, the callback edge allows us to replace the
address in the arguments list:

GOMP_parallel (body_fn, &amp;data_struct, /* ... */);

becomes

GOMP_parallel (body_fn.optimized, &amp;data_struct, /* ... */);

This redirection is possible for any function with the attribute.

This callback attribute implementation is partially compatible with
clang's implementation. Its semantics, arguments and argument indexing style are
the same, but we represent an unknown argument position with 0
(precedent set by attributes such as 'format'), while clang uses -1 or '?'.
We use the index 1 for the 'this' pointer in member functions, clang
uses 0. We also allow for multiple callback attributes on the same function,
while clang only allows one.

The attribute is currently for GCC internal use only, thanks to the
space in its name.  Originally, it was supposed to be called
'callback' like its clang counterpart, but we cannot use this name, as
clang uses non-standard indexing style, leading to inconsistencies.  The
attribute will be introduced into the public API as 'gnu::callback_only'
in a future patch.

The attribute allows us to propagate constants into body functions of
OpenMP constructs. Currently, GCC won't propagate the value 'c' into the
OpenMP body in the following example:

int a[100];
void test(int c) {
#pragma omp parallel for
  for (int i = 0; i &lt; c; i++) {
    if (!__builtin_constant_p(c)) {
      __builtin_abort();
    }
    a[i] = i;
  }
}
int main() {
  test(100);
  return a[5] - 5;
}

With this patch, the body function will get cloned and the constant 'c'
will get propagated.

Some functions may utilize the attribute's infrastructure without being
declared with it, for example GOMP_task.  These functions are special
cases and use the special case functions found in attr-callback.h.  Special
cases use the attribute under certain circumstances, for example
GOMP_task uses it when the copy function is not being used required.

gcc/ChangeLog:

	* Makefile.in: Add attr-callback.o to OBJS.
	* builtin-attrs.def (ATTR_CALLBACK): Callback attr identifier.
	(DEF_CALLBACK_ATTRIBUTE): Macro for callback attr creation.
	(GOMP): Attr for libgomp functions.
	(ATTR_CALLBACK_GOMP_LIST): ATTR_NOTHROW_LIST with GOMP callback
	attr added.
	* cgraph.cc (cgraph_add_edge_to_call_site_hash): Always hash the
	callback-carrying edge.
	(cgraph_node::get_edge): Always return the callback-carrying
	edge.
	(cgraph_edge::set_call_stmt): Add cascade for callback edges.
	(symbol_table::create_edge): Allow callback edges to share call
	stmts, initialize new flags.
	(cgraph_edge::make_callback): New method, derives a new callback
	edge.
	(cgraph_edge::get_callback_carrying_edge): New method.
	(cgraph_edge::first_callback_edge): Likewise.
	(cgraph_edge::next_callback_edge): Likewise.
	(cgraph_edge::purge_callback_edges): Likewise.
	(cgraph_edge::redirect_callee): When redirecting a callback
	edge, redirect its ref as well.
	(cgraph_edge::redirect_call_stmt_to_callee): Add callback edge
	redirection logic, set update_derived_edges to true hwne
	redirecting the carrying edge.
	(cgraph_node::remove_callers): Add cascade for callback edges.
	(cgraph_edge::dump_edge_flags): Print callback flags.
	(cgraph_node::verify_node): Add sanity checks for callback
	edges.
	* cgraph.h: Add new 1 bit flags and 16 bit callback_id to
	cgraph_edge class.
	* cgraphclones.cc (cgraph_edge::clone): Copy over callback data.
	* cif-code.def (CALLBACK_EDGE): Add CIF_CALLBACK_EDGE code.
	* ipa-cp.cc (purge_useless_callback_edges): New function,
	deletes callback edges when necessary.
	(ipcp_decision_stage): Call purge_useless_callback_edges.
	* ipa-fnsummary.cc (ipa_call_summary_t::duplicate): Add
	an exception for callback edges.
	(analyze_function_body): Copy over summary from carrying to
	callback edge.
	* ipa-inline-analysis.cc (do_estimate_growth_1): Skip callback
	edges when estimating growth.
	* ipa-inline-transform.cc (inline_transform): Add redirection
	cascade for callback edges.
	* ipa-param-manipulation.cc
	(drop_decl_attribute_if_params_changed_p): New function.
	(ipa_param_adjustments::build_new_function_type): Add
	args_modified out param.
	(ipa_param_adjustments::adjust_decl): Drop callback attrs when
	modifying args.
	* ipa-param-manipulation.h: Adjust decl of
	build_new_function_type.
	* ipa-prop.cc (ipa_duplicate_jump_function): Add decl.
	(init_callback_edge_summary): New function.
	(ipa_compute_jump_functions_for_edge): Add callback edge
	creation logic.
	* lto-cgraph.cc (lto_output_edge): Stream out callback data.
	(input_edge): Input callback data.
	* omp-builtins.def (BUILT_IN_GOMP_PARALLEL_LOOP_STATIC): Use new
	attr list.
	(BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED): Likewise.
	(BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC): Likewise.
	(BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME): Likewise.
	(BUILT_IN_GOMP_PARALLEL): Likewise.
	(BUILT_IN_GOMP_PARALLEL_SECTIONS): Likewise.
	(BUILT_IN_GOMP_TEAMS_REG): Likewise.
	* tree-core.h (ECF_CB_1_2): New constant for callback(1,2).
	* tree-inline.cc (copy_bb): Copy callback edges when copying the
	carrying edge.
	(redirect_all_calls): Redirect callback edges.
	* tree.cc (set_call_expr_flags): Create callback attr according
	to the ECF_CB flag.
	* attr-callback.cc: New file.
	* attr-callback.h: New file.

gcc/c-family/ChangeLog:

	* c-attribs.cc: Define callback attr.

gcc/fortran/ChangeLog:

	* f95-lang.cc (ATTR_CALLBACK_GOMP_LIST): New attr list
	corresponding to the list in builtin-attrs.def.

gcc/testsuite/ChangeLog:

	* gcc.dg/ipa/ipcp-cb-spec1.c: New test.
	* gcc.dg/ipa/ipcp-cb-spec2.c: New test.
	* gcc.dg/ipa/ipcp-cb1.c: New test.

Signed-off-by: Josef Melcr &lt;jmelcr02@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch enables constant propagation to outlined OpenMP kernels.
It does so using a new function attribute called ' callback' (note the
space).

The attribute ' callback' captures the notion of a function calling one
of its arguments with some of its parameters as arguments.  An OpenMP
example of such function is GOMP_parallel.
We implement the attribute with new callgraph edges called callback
edges. They are imaginary edges pointing from the caller of the function
with the attribute (e.g. caller of GOMP_parallel) to the body function
itself (e.g. the outlined OpenMP body).  They share their call statement
with the edge from which they are derived (direct edge caller -&gt; GOMP_parallel
in this case).  These edges allow passes such as ipa-cp to see the hidden
call site to the body function and optimize the function accordingly.

To illustrate on an example, the body GOMP_parallel looks something
like this:

void GOMP_parallel (void (*fn) (void *), void *data, /* ... */)
{
  /* ... */
  fn (data);
  /* ... */
}

If we extend it with the attribute ' callback(1, 2)', we express that the
function calls its first argument and passes it its second argument.
This is represented in the call graph in this manner:

             direct                         indirect
caller -----------------&gt; GOMP_parallel ---------------&gt; fn
  |
  ----------------------&gt; fn
          callback

The direct edge is then the callback-carrying edge, all new edges
are the derived callback edges.
While constant propagation is the main focus of this patch, callback
edges can be useful for different passes (for example, they improve icf
for OpenMP kernels), as they allow for address redirection.
If the outlined body function gets optimized and cloned, from body_fn to
body_fn.optimized, the callback edge allows us to replace the
address in the arguments list:

GOMP_parallel (body_fn, &amp;data_struct, /* ... */);

becomes

GOMP_parallel (body_fn.optimized, &amp;data_struct, /* ... */);

This redirection is possible for any function with the attribute.

This callback attribute implementation is partially compatible with
clang's implementation. Its semantics, arguments and argument indexing style are
the same, but we represent an unknown argument position with 0
(precedent set by attributes such as 'format'), while clang uses -1 or '?'.
We use the index 1 for the 'this' pointer in member functions, clang
uses 0. We also allow for multiple callback attributes on the same function,
while clang only allows one.

The attribute is currently for GCC internal use only, thanks to the
space in its name.  Originally, it was supposed to be called
'callback' like its clang counterpart, but we cannot use this name, as
clang uses non-standard indexing style, leading to inconsistencies.  The
attribute will be introduced into the public API as 'gnu::callback_only'
in a future patch.

The attribute allows us to propagate constants into body functions of
OpenMP constructs. Currently, GCC won't propagate the value 'c' into the
OpenMP body in the following example:

int a[100];
void test(int c) {
#pragma omp parallel for
  for (int i = 0; i &lt; c; i++) {
    if (!__builtin_constant_p(c)) {
      __builtin_abort();
    }
    a[i] = i;
  }
}
int main() {
  test(100);
  return a[5] - 5;
}

With this patch, the body function will get cloned and the constant 'c'
will get propagated.

Some functions may utilize the attribute's infrastructure without being
declared with it, for example GOMP_task.  These functions are special
cases and use the special case functions found in attr-callback.h.  Special
cases use the attribute under certain circumstances, for example
GOMP_task uses it when the copy function is not being used required.

gcc/ChangeLog:

	* Makefile.in: Add attr-callback.o to OBJS.
	* builtin-attrs.def (ATTR_CALLBACK): Callback attr identifier.
	(DEF_CALLBACK_ATTRIBUTE): Macro for callback attr creation.
	(GOMP): Attr for libgomp functions.
	(ATTR_CALLBACK_GOMP_LIST): ATTR_NOTHROW_LIST with GOMP callback
	attr added.
	* cgraph.cc (cgraph_add_edge_to_call_site_hash): Always hash the
	callback-carrying edge.
	(cgraph_node::get_edge): Always return the callback-carrying
	edge.
	(cgraph_edge::set_call_stmt): Add cascade for callback edges.
	(symbol_table::create_edge): Allow callback edges to share call
	stmts, initialize new flags.
	(cgraph_edge::make_callback): New method, derives a new callback
	edge.
	(cgraph_edge::get_callback_carrying_edge): New method.
	(cgraph_edge::first_callback_edge): Likewise.
	(cgraph_edge::next_callback_edge): Likewise.
	(cgraph_edge::purge_callback_edges): Likewise.
	(cgraph_edge::redirect_callee): When redirecting a callback
	edge, redirect its ref as well.
	(cgraph_edge::redirect_call_stmt_to_callee): Add callback edge
	redirection logic, set update_derived_edges to true hwne
	redirecting the carrying edge.
	(cgraph_node::remove_callers): Add cascade for callback edges.
	(cgraph_edge::dump_edge_flags): Print callback flags.
	(cgraph_node::verify_node): Add sanity checks for callback
	edges.
	* cgraph.h: Add new 1 bit flags and 16 bit callback_id to
	cgraph_edge class.
	* cgraphclones.cc (cgraph_edge::clone): Copy over callback data.
	* cif-code.def (CALLBACK_EDGE): Add CIF_CALLBACK_EDGE code.
	* ipa-cp.cc (purge_useless_callback_edges): New function,
	deletes callback edges when necessary.
	(ipcp_decision_stage): Call purge_useless_callback_edges.
	* ipa-fnsummary.cc (ipa_call_summary_t::duplicate): Add
	an exception for callback edges.
	(analyze_function_body): Copy over summary from carrying to
	callback edge.
	* ipa-inline-analysis.cc (do_estimate_growth_1): Skip callback
	edges when estimating growth.
	* ipa-inline-transform.cc (inline_transform): Add redirection
	cascade for callback edges.
	* ipa-param-manipulation.cc
	(drop_decl_attribute_if_params_changed_p): New function.
	(ipa_param_adjustments::build_new_function_type): Add
	args_modified out param.
	(ipa_param_adjustments::adjust_decl): Drop callback attrs when
	modifying args.
	* ipa-param-manipulation.h: Adjust decl of
	build_new_function_type.
	* ipa-prop.cc (ipa_duplicate_jump_function): Add decl.
	(init_callback_edge_summary): New function.
	(ipa_compute_jump_functions_for_edge): Add callback edge
	creation logic.
	* lto-cgraph.cc (lto_output_edge): Stream out callback data.
	(input_edge): Input callback data.
	* omp-builtins.def (BUILT_IN_GOMP_PARALLEL_LOOP_STATIC): Use new
	attr list.
	(BUILT_IN_GOMP_PARALLEL_LOOP_GUIDED): Likewise.
	(BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC): Likewise.
	(BUILT_IN_GOMP_PARALLEL_LOOP_NONMONOTONIC_RUNTIME): Likewise.
	(BUILT_IN_GOMP_PARALLEL): Likewise.
	(BUILT_IN_GOMP_PARALLEL_SECTIONS): Likewise.
	(BUILT_IN_GOMP_TEAMS_REG): Likewise.
	* tree-core.h (ECF_CB_1_2): New constant for callback(1,2).
	* tree-inline.cc (copy_bb): Copy callback edges when copying the
	carrying edge.
	(redirect_all_calls): Redirect callback edges.
	* tree.cc (set_call_expr_flags): Create callback attr according
	to the ECF_CB flag.
	* attr-callback.cc: New file.
	* attr-callback.h: New file.

gcc/c-family/ChangeLog:

	* c-attribs.cc: Define callback attr.

gcc/fortran/ChangeLog:

	* f95-lang.cc (ATTR_CALLBACK_GOMP_LIST): New attr list
	corresponding to the list in builtin-attrs.def.

gcc/testsuite/ChangeLog:

	* gcc.dg/ipa/ipcp-cb-spec1.c: New test.
	* gcc.dg/ipa/ipcp-cb-spec2.c: New test.
	* gcc.dg/ipa/ipcp-cb1.c: New test.

Signed-off-by: Josef Melcr &lt;jmelcr02@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix various comment typos</title>
<updated>2025-09-30T14:12:46+00:00</updated>
<author>
<name>Jakub Jelinek</name>
<email>jakub@redhat.com</email>
</author>
<published>2025-09-30T14:11:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=6e624833cbe0a7479564fbe3294e10c9d4746a2e'/>
<id>6e624833cbe0a7479564fbe3294e10c9d4746a2e</id>
<content type='text'>
The following patch fixes various comment typos.

2025-09-30  Jakub Jelinek  &lt;jakub@redhat.com&gt;

gcc/
	* auto-profile.h (maybe_hot_afdo_count_p): Fix comment typos,
	possiby -&gt; possibly and ture -&gt; true.
	* gimplify.cc (build_asan_poison_call_expr): Change "of a for"
	to "memory of the" in a comment.
	* ipa-devirt.cc (add_type_duplicate): Fix comment typo,
	mangles -&gt; mangled.
	* auto-profile.cc: Fix comment typo, -fauto-profile-inlinig
	-&gt; -fauto-profile-inlining.
	(maybe_hot_afdo_count_p): Fix comment typos, possiby -&gt; possibly
	and ture -&gt; true.
	(function_instance::removed_icall_target): Fix comment typo,
	Reutrn -&gt; Return.
	(function_instance::in_worklist_): Fix comment typo, Ture -&gt; True.
	(function_instance::offline): Fix comment typo, tolevel -&gt; toplevel.
	(function_instance::match): Fix comment typo, craeate_gcov -&gt;
	create_gcov.
	(autofdo_source_profile::offline_external_functions): Fix comment
	typos, tolevel -&gt; toplevel and porfile -&gt; profile.
	(autofdo_source_profile::get_function_instance_by_inline_stack): Fix
	comment typo, chekcing -&gt; checking.
	(struct scale): Fix comment typo, scalle -&gt; scale.
	* gimple.h (currently_expanding_gimple_stmt): Fix comment typo,
	comminucating -&gt; communicating.
	* tree.h (canonical_type_used_p): Fix comment typo, ture -&gt; true.
	* tree-ssa-alias.cc (types_equal_for_same_type_for_tbaa_p): Likewise.
	* ipa-profile.cc (contains_hot_call_p): Likewise.
	* cfgexpand.cc (add_scope_conflicts_2): Fix comment typos,
	Querry -&gt; Query, referendd -&gt; referenced and Querrying -&gt; Querying.
	* ipa-param-manipulation.cc (currently_expanding_gimple_stmt): Fix
	comment typo, comminucating -&gt; communicating.
	* ipa-prop.cc (ipa_cst_ref_desc::refcount): Fix comment typo,
	if -&gt; is.
	* tree-if-conv.cc (version_loop_for_if_conversion): Fix comment typos,
	porfile -&gt; profile and confistency -&gt; consistency.
	* fold-const.cc: Change size_int_wide in comment to size_int as
	size_int_wide doesn't exit for 21 years.
gcc/testsuite/
	* gcc.dg/vect/tsvc/vect-tsvc-s1244.c (s1244): Fix comment typo,
	ture -&gt; true.
	* gcc.dg/vect/tsvc/vect-tsvc-s2244.c (s2244): Likewise.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The following patch fixes various comment typos.

2025-09-30  Jakub Jelinek  &lt;jakub@redhat.com&gt;

gcc/
	* auto-profile.h (maybe_hot_afdo_count_p): Fix comment typos,
	possiby -&gt; possibly and ture -&gt; true.
	* gimplify.cc (build_asan_poison_call_expr): Change "of a for"
	to "memory of the" in a comment.
	* ipa-devirt.cc (add_type_duplicate): Fix comment typo,
	mangles -&gt; mangled.
	* auto-profile.cc: Fix comment typo, -fauto-profile-inlinig
	-&gt; -fauto-profile-inlining.
	(maybe_hot_afdo_count_p): Fix comment typos, possiby -&gt; possibly
	and ture -&gt; true.
	(function_instance::removed_icall_target): Fix comment typo,
	Reutrn -&gt; Return.
	(function_instance::in_worklist_): Fix comment typo, Ture -&gt; True.
	(function_instance::offline): Fix comment typo, tolevel -&gt; toplevel.
	(function_instance::match): Fix comment typo, craeate_gcov -&gt;
	create_gcov.
	(autofdo_source_profile::offline_external_functions): Fix comment
	typos, tolevel -&gt; toplevel and porfile -&gt; profile.
	(autofdo_source_profile::get_function_instance_by_inline_stack): Fix
	comment typo, chekcing -&gt; checking.
	(struct scale): Fix comment typo, scalle -&gt; scale.
	* gimple.h (currently_expanding_gimple_stmt): Fix comment typo,
	comminucating -&gt; communicating.
	* tree.h (canonical_type_used_p): Fix comment typo, ture -&gt; true.
	* tree-ssa-alias.cc (types_equal_for_same_type_for_tbaa_p): Likewise.
	* ipa-profile.cc (contains_hot_call_p): Likewise.
	* cfgexpand.cc (add_scope_conflicts_2): Fix comment typos,
	Querry -&gt; Query, referendd -&gt; referenced and Querrying -&gt; Querying.
	* ipa-param-manipulation.cc (currently_expanding_gimple_stmt): Fix
	comment typo, comminucating -&gt; communicating.
	* ipa-prop.cc (ipa_cst_ref_desc::refcount): Fix comment typo,
	if -&gt; is.
	* tree-if-conv.cc (version_loop_for_if_conversion): Fix comment typos,
	porfile -&gt; profile and confistency -&gt; consistency.
	* fold-const.cc: Change size_int_wide in comment to size_int as
	size_int_wide doesn't exit for 21 years.
gcc/testsuite/
	* gcc.dg/vect/tsvc/vect-tsvc-s1244.c (s1244): Fix comment typo,
	ture -&gt; true.
	* gcc.dg/vect/tsvc/vect-tsvc-s2244.c (s2244): Likewise.
</pre>
</div>
</content>
</entry>
<entry>
<title>ipa: When inlining, don't combine PT JFs changing signedness (PR120295)</title>
<updated>2025-05-29T14:32:52+00:00</updated>
<author>
<name>Martin Jambor</name>
<email>mjambor@suse.cz</email>
</author>
<published>2025-05-29T14:32:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=0b004c92f5ea239936a403a2a757e12ca82ce6d8'/>
<id>0b004c92f5ea239936a403a2a757e12ca82ce6d8</id>
<content type='text'>
In GCC 15 we allowed jump-function generation code to skip over a
type-cast converting one integer to another as long as the latter can
hold all the values of the former or has at least the same precision.
This works well for IPA-CP where we do then evaluate each jump
function as we propagate values and value-ranges.  However, the
test-case in PR 120295 shows a problem with inlining, where we combine
pass-through jump-functions so that they are always relative to the
function which is the root of the inline tree.  Unfortunately, we are
happy to combine also those with type-casts to a different signedness
which makes us use sign zero extension for the expected value ranges
where we should have used sign extension.  When the value-range which
then leads to wrong insertion of a call to builtin_unreachable is
being computed, the information about an existence of a intermediary
signed type has already been lost during previous inlining.

This patch simply blocks combining such jump-functions so that it is
back-portable to GCC 15.  Once we switch pass-through jump functions
to use a vector of operations rather than having room for just one, we
will be able to address this situation with adding an extra conversion
instead.

gcc/ChangeLog:

2025-05-19  Martin Jambor  &lt;mjambor@suse.cz&gt;

	PR ipa/120295
	* ipa-prop.cc (update_jump_functions_after_inlining): Do not
	combine pass-through jump functions with type-casts changing
	signedness.

gcc/testsuite/ChangeLog:

2025-05-19  Martin Jambor  &lt;mjambor@suse.cz&gt;

	PR ipa/120295
	* gcc.dg/ipa/pr120295.c: New test.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In GCC 15 we allowed jump-function generation code to skip over a
type-cast converting one integer to another as long as the latter can
hold all the values of the former or has at least the same precision.
This works well for IPA-CP where we do then evaluate each jump
function as we propagate values and value-ranges.  However, the
test-case in PR 120295 shows a problem with inlining, where we combine
pass-through jump-functions so that they are always relative to the
function which is the root of the inline tree.  Unfortunately, we are
happy to combine also those with type-casts to a different signedness
which makes us use sign zero extension for the expected value ranges
where we should have used sign extension.  When the value-range which
then leads to wrong insertion of a call to builtin_unreachable is
being computed, the information about an existence of a intermediary
signed type has already been lost during previous inlining.

This patch simply blocks combining such jump-functions so that it is
back-portable to GCC 15.  Once we switch pass-through jump functions
to use a vector of operations rather than having room for just one, we
will be able to address this situation with adding an extra conversion
instead.

gcc/ChangeLog:

2025-05-19  Martin Jambor  &lt;mjambor@suse.cz&gt;

	PR ipa/120295
	* ipa-prop.cc (update_jump_functions_after_inlining): Do not
	combine pass-through jump functions with type-casts changing
	signedness.

gcc/testsuite/ChangeLog:

2025-05-19  Martin Jambor  &lt;mjambor@suse.cz&gt;

	PR ipa/120295
	* gcc.dg/ipa/pr120295.c: New test.
</pre>
</div>
</content>
</entry>
<entry>
<title>ipa: Fix whitespace when dumping VR in jump_functions</title>
<updated>2025-05-29T14:32:41+00:00</updated>
<author>
<name>Martin Jambor</name>
<email>mjambor@suse.cz</email>
</author>
<published>2025-05-29T14:32:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=71e6b7b26a5169d217a62f34acbbc43c592b24bd'/>
<id>71e6b7b26a5169d217a62f34acbbc43c592b24bd</id>
<content type='text'>
Lack of white space breakes the tree-visualisation structure and makes
the dump unnecessarily difficult to read.

gcc/ChangeLog:

2025-05-19  Martin Jambor  &lt;mjambor@suse.cz&gt;

	* ipa-prop.cc (ipa_dump_jump_function): Fix whitespace when
	dumping IPA VRs.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Lack of white space breakes the tree-visualisation structure and makes
the dump unnecessarily difficult to read.

gcc/ChangeLog:

2025-05-19  Martin Jambor  &lt;mjambor@suse.cz&gt;

	* ipa-prop.cc (ipa_dump_jump_function): Fix whitespace when
	dumping IPA VRs.
</pre>
</div>
</content>
</entry>
<entry>
<title>Stream ipa_return_value_summary</title>
<updated>2025-04-16T13:28:32+00:00</updated>
<author>
<name>Jan Hubicka</name>
<email>hubicka@ucw.cz</email>
</author>
<published>2025-04-16T13:28:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=eabba7be040e81690332070873d59d23e8c93e11'/>
<id>eabba7be040e81690332070873d59d23e8c93e11</id>
<content type='text'>
Add streaming of return summaries from compile time to ltrans
which are now needed for vrp to not ouput false errors on musttail.

	Co-authored-by: Jakub Jelinek &lt;jakub@redhat.com&gt;

gcc/ChangeLog:
	PR tree-optimization/119614

	* ipa-prop.cc (ipa_write_return_summaries): New function.
	(ipa_record_return_value_range_1): Break out from ....
	(ipa_record_return_value_range): ... here.
	(ipa_read_return_summaries): New function.
	(ipa_prop_read_section): Read return summaries.
	(read_ipcp_transformation_info): Read return summaries.
	(ipcp_write_transformation_summaries): Write return summaries;
	do not stream stray 0.

gcc/testsuite/ChangeLog:

	* g++.dg/lto/pr119614_0.C: New test.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add streaming of return summaries from compile time to ltrans
which are now needed for vrp to not ouput false errors on musttail.

	Co-authored-by: Jakub Jelinek &lt;jakub@redhat.com&gt;

gcc/ChangeLog:
	PR tree-optimization/119614

	* ipa-prop.cc (ipa_write_return_summaries): New function.
	(ipa_record_return_value_range_1): Break out from ....
	(ipa_record_return_value_range): ... here.
	(ipa_read_return_summaries): New function.
	(ipa_prop_read_section): Read return summaries.
	(read_ipcp_transformation_info): Read return summaries.
	(ipcp_write_transformation_summaries): Write return summaries;
	do not stream stray 0.

gcc/testsuite/ChangeLog:

	* g++.dg/lto/pr119614_0.C: New test.
</pre>
</div>
</content>
</entry>
<entry>
<title>ipa: Record and stream result types of arithemetic jump functions</title>
<updated>2025-04-14T12:33:37+00:00</updated>
<author>
<name>Martin Jambor</name>
<email>mjambor@suse.cz</email>
</author>
<published>2025-04-14T12:21:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=f33d2e6b532304d487193667e6b5d8f8d7df2bf4'/>
<id>f33d2e6b532304d487193667e6b5d8f8d7df2bf4</id>
<content type='text'>
In order to replace the use of somewhat unweildy
expr_type_first_operand_type_p we need to record and stream the types
of results of operations recorded in arithmetic jump functions.  This
is necessary so that we can then simulate them at the IPA stage with
the corresponding precision and signedness.  This patch does the
recorsing and streaming, the following one adds the use of the date.

Per Honza's request this version also checks that we do not put VLA
types into the global LTO stream, even though I was not able to
actually craft a test-case that would do that without them.

gcc/ChangeLog:

2025-04-11  Martin Jambor  &lt;mjambor@suse.cz&gt;

	PR ipa/118097
	PR ipa/118785
	PR ipa/119318
	* lto-streamer.h (lto_variably_modified_type_p): Declare.
	* ipa-prop.h (ipa_pass_through_data): New field op_type.
	(ipa_get_jf_pass_through_op_type): New function.
	* ipa-prop.cc: Include lto-streamer.h.
	(ipa_dump_jump_function): Dump also pass-through
	operation types, if any.  Dump pass-through operands only if not NULL.
	(ipa_set_jf_simple_pass_through): Set op_type accordingly.
	(compute_complex_assign_jump_func): Set op_type of arithmetic
	pass-through jump_functions.
	(analyze_agg_content_value): Update lhs when walking assighment
	copies.  Set op_type of aggregate arithmetic pass-through
	jump_functions.
	(update_jump_functions_after_inlining): Also transfer the operation
	type from the source arithmentic pass-through jump function to the
	destination jump function.
	(ipa_write_jump_function): Stream also the op_type when necessary.
	(ipa_read_jump_function): Likewise.
	(ipa_agg_pass_through_jf_equivalent_p): Also compare operation types.
	* lto-streamer-out.cc (lto_variably_modified_type_p): Make public.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In order to replace the use of somewhat unweildy
expr_type_first_operand_type_p we need to record and stream the types
of results of operations recorded in arithmetic jump functions.  This
is necessary so that we can then simulate them at the IPA stage with
the corresponding precision and signedness.  This patch does the
recorsing and streaming, the following one adds the use of the date.

Per Honza's request this version also checks that we do not put VLA
types into the global LTO stream, even though I was not able to
actually craft a test-case that would do that without them.

gcc/ChangeLog:

2025-04-11  Martin Jambor  &lt;mjambor@suse.cz&gt;

	PR ipa/118097
	PR ipa/118785
	PR ipa/119318
	* lto-streamer.h (lto_variably_modified_type_p): Declare.
	* ipa-prop.h (ipa_pass_through_data): New field op_type.
	(ipa_get_jf_pass_through_op_type): New function.
	* ipa-prop.cc: Include lto-streamer.h.
	(ipa_dump_jump_function): Dump also pass-through
	operation types, if any.  Dump pass-through operands only if not NULL.
	(ipa_set_jf_simple_pass_through): Set op_type accordingly.
	(compute_complex_assign_jump_func): Set op_type of arithmetic
	pass-through jump_functions.
	(analyze_agg_content_value): Update lhs when walking assighment
	copies.  Set op_type of aggregate arithmetic pass-through
	jump_functions.
	(update_jump_functions_after_inlining): Also transfer the operation
	type from the source arithmentic pass-through jump function to the
	destination jump function.
	(ipa_write_jump_function): Stream also the op_type when necessary.
	(ipa_read_jump_function): Likewise.
	(ipa_agg_pass_through_jf_equivalent_p): Also compare operation types.
	* lto-streamer-out.cc (lto_variably_modified_type_p): Make public.
</pre>
</div>
</content>
</entry>
<entry>
<title>Update copyright years.</title>
<updated>2025-01-02T10:59:57+00:00</updated>
<author>
<name>Jakub Jelinek</name>
<email>jakub@redhat.com</email>
</author>
<published>2025-01-02T10:59:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=6441eb6dc020faae0672ea724dfdb38c6a9bf6a1'/>
<id>6441eb6dc020faae0672ea724dfdb38c6a9bf6a1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>lto: Remap node order for stability.</title>
<updated>2024-12-18T17:19:18+00:00</updated>
<author>
<name>Michal Jires</name>
<email>mjires@suse.cz</email>
</author>
<published>2024-10-24T01:02:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/gcc.git/commit/?id=b47e7eabff260a69b0cf596ca807ebbe6d93a2c2'/>
<id>b47e7eabff260a69b0cf596ca807ebbe6d93a2c2</id>
<content type='text'>
This patch adds remapping of node order for each lto partition.
Resulting order conserves relative order inside partition, but
is independent of outside symbols. So if lto partition contains
identical set of symbols, their remapped order will be stable
between compilations.

This stability is needed for Incremental LTO.

gcc/ChangeLog:

	* ipa-devirt.cc (ipa_odr_summary_write):
	Add unused argument.
	* ipa-fnsummary.cc (ipa_fn_summary_write): Likewise.
	* ipa-icf.cc (sem_item_optimizer::write_summary): Likewise.
	* ipa-modref.cc (modref_write): Likewise.
	* ipa-prop.cc (ipa_prop_write_jump_functions): Likewise.
	(ipcp_write_transformation_summaries): Likewise.
	* ipa-sra.cc (ipa_sra_write_summary): Likewise.
	* lto-cgraph.cc (lto_symtab_encoder_delete): Delete remap.
	(lto_output_node): Remap order.
	(lto_output_varpool_node): Likewise.
	(output_cgraph_opt_summary): Add unused argument.
	* lto-streamer-out.cc (produce_symbol_asm): Renamed. Use remapped order.
	(produce_asm): Rename. New wrapper.
	(output_function): Propagate remapped order.
	(output_constructor): Likewise.
	(copy_function_or_variable): Likewise.
	(cmp_int): New.
	(create_order_remap): New.
	(lto_output): Create remap. Remap order.
	* lto-streamer.h (struct lto_symtab_encoder_d): Remap hash_map.
	(produce_asm): Add order argument.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch adds remapping of node order for each lto partition.
Resulting order conserves relative order inside partition, but
is independent of outside symbols. So if lto partition contains
identical set of symbols, their remapped order will be stable
between compilations.

This stability is needed for Incremental LTO.

gcc/ChangeLog:

	* ipa-devirt.cc (ipa_odr_summary_write):
	Add unused argument.
	* ipa-fnsummary.cc (ipa_fn_summary_write): Likewise.
	* ipa-icf.cc (sem_item_optimizer::write_summary): Likewise.
	* ipa-modref.cc (modref_write): Likewise.
	* ipa-prop.cc (ipa_prop_write_jump_functions): Likewise.
	(ipcp_write_transformation_summaries): Likewise.
	* ipa-sra.cc (ipa_sra_write_summary): Likewise.
	* lto-cgraph.cc (lto_symtab_encoder_delete): Delete remap.
	(lto_output_node): Remap order.
	(lto_output_varpool_node): Likewise.
	(output_cgraph_opt_summary): Add unused argument.
	* lto-streamer-out.cc (produce_symbol_asm): Renamed. Use remapped order.
	(produce_asm): Rename. New wrapper.
	(output_function): Propagate remapped order.
	(output_constructor): Likewise.
	(copy_function_or_variable): Likewise.
	(cmp_int): New.
	(create_order_remap): New.
	(lto_output): Create remap. Remap order.
	* lto-streamer.h (struct lto_symtab_encoder_d): Remap hash_map.
	(produce_asm): Add order argument.
</pre>
</div>
</content>
</entry>
</feed>
