[Bug ipa/93429] Missed IPA-CP on by-ref argument directly passed through from caller

2020-06-11 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93429

fxue at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #2 from fxue at gcc dot gnu.org ---
Fixed.

[Bug testsuite/97066] [11 Regression] regression caused by r11-3207

2020-09-16 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97066

fxue at gcc dot gnu.org changed:

   What|Removed |Added

  Component|tree-optimization   |testsuite
   Last reconfirmed||2020-09-16
   Assignee|unassigned at gcc dot gnu.org  |fxue at os dot 
amperecomputing.com
 Status|UNCONFIRMED |NEW
 Ever confirmed|0   |1
 CC||fxue at gcc dot gnu.org

[Bug tree-optimization/89134] A missing optimization opportunity for a simple branch in loop

2019-11-07 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89134

--- Comment #14 from fxue at gcc dot gnu.org ---
Author: fxue
Date: Thu Nov  7 15:43:01 2019
New Revision: 277923

URL: https://gcc.gnu.org/viewcvs?rev=277923&root=gcc&view=rev
Log:
Loop split on semi-invariant conditional statement

2019-11-07  Feng Xue 

PR tree-optimization/89134
* doc/invoke.texi (min-loop-cond-split-prob): Document new --params.
* params.def: Add min-loop-cond-split-prob.
* tree-ssa-loop-split.c (split_loop): Remove niter parameter, move some
outside checks on loop into the function.
(split_info): New class.
(find_vdef_in_loop, get_control_equiv_head_block): New functions.
(find_control_dep_blocks, vuse_semi_invariant_p): Likewise.
(ssa_semi_invariant_p, loop_iter_phi_semi_invariant_p): Likewise.
(control_dep_semi_invariant_p, stmt_semi_invariant_p_1): Likewise.
(stmt_semi_invariant_p, branch_removable_p): Likewise.
(get_cond_invariant_branch, compute_added_num_insns): Likewise.
(get_cond_branch_to_split_loop, do_split_loop_on_cond): Likewise.
(split_loop_on_cond): Likewise.
(tree_ssa_split_loops): Add loop split on conditional statement.

2019-11-07  Feng Xue  

PR tree-optimization/89134
* gcc.dg/tree-ssa/loop-cond-split-1.c: New test.
* g++.dg/tree-ssa/loop-cond-split-1.C: New test.
* gcc.dg/torture/pr55107.c: Add -fno-split-loops.


Added:
trunk/gcc/testsuite/g++.dg/tree-ssa/loop-cond-split-1.C
trunk/gcc/testsuite/gcc.dg/tree-ssa/loop-cond-split-1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/doc/invoke.texi
trunk/gcc/params.def
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/torture/pr55107.c
trunk/gcc/tree-ssa-loop-split.c

[Bug ipa/91682] IPA-cp can not propagate value for by-ref argument in form of *arg = param op constant

2019-11-13 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91682

--- Comment #1 from fxue at gcc dot gnu.org ---
Author: fxue
Date: Thu Nov 14 03:19:15 2019
New Revision: 278193

URL: https://gcc.gnu.org/viewcvs?rev=278193&root=gcc&view=rev
Log:
Support extended aggregate jump function in ipa-cp

2019-11-14  Feng Xue  

PR ipa/91682
* ipa-prop.h (jump_func_type): New value IPA_JF_LOAD_AGG.
(ipa_load_agg_data, ipa_agg_value, ipa_agg_value_set): New structs.
(ipa_agg_jf_item): Add new field jftype and type, redefine field value.
(ipa_agg_jump_function): Remove member function equal_to.
(ipa_agg_jump_function_p): Remove typedef.
(ipa_copy_agg_values, ipa_release_agg_values): New functions.
* ipa-prop.c (ipa_print_node_jump_functions_for_edge): Dump
information for aggregate jump function.
(get_ssa_def_if_simple_copy): Add new parameter rhs_stmt to
record last definition statement.
(load_from_unmodified_param_or_agg): New function.
(ipa_known_agg_contents_list): Add new field type and value, remove
field constant.
(build_agg_jump_func_from_list): Rename parameter const_count to
value_count, build aggregate jump function from ipa_load_agg_data.
(analyze_agg_content_value): New function.
(extract_mem_content): Analyze memory store assignment to prepare
information for aggregate jump function generation.
(determine_known_aggregate_parts): Add new parameter fbi, remove
parameter aa_walk_budeget_p.
(update_jump_functions_after_inlining): Update aggregate jump function.
(ipa_find_agg_cst_for_param): Change type of parameter agg.
(try_make_edge_direct_simple_call): Add new parameter new_root.
(try_make_edge_direct_virtual_call): Add new parameter new_root and
new_root_info.
(update_indirect_edges_after_inlining): Pass new argument to
try_make_edge_direct_simple_call and try_make_edge_direct_virtual_call.
(ipa_write_jump_function): Write aggregate jump function to file.
(ipa_read_jump_function): Read aggregate jump function from file.
(ipa_agg_value::equal_to): Migrate from ipa_agg_jf_item::equal_to.
* ipa-cp.c (ipa_get_jf_arith_result): New function.
(ipa_agg_value_from_node): Likewise.
(ipa_agg_value_set_from_jfunc): Likewise.
(propagate_vals_across_arith_jfunc): Likewise.
(propagate_aggregate_lattice): Likewise.
(ipa_get_jf_pass_through_result): Call ipa_get_jf_arith_result.
(propagate_vals_across_pass_through): Call
propagate_vals_across_arith_jfunc.
(get_clone_agg_value): Move forward.
(propagate_aggs_across_jump_function): Handle value propagation for
aggregate jump function.
(agg_jmp_p_vec_for_t_vec): Remove.
(context_independent_aggregate_values): Replace vec
with vec.
(copy_plats_to_inter, intersect_with_plats): Likewise.
(agg_replacements_to_vector, intersect_with_agg_replacements):
Likewise.
(intersect_aggregate_with_edge): Likewise.
(find_aggregate_values_for_callers_subset): Likewise.
(cgraph_edge_brings_all_agg_vals_for_node): Likewise.
(estimate_local_effects): Replace vec and
vec with vec.
(gather_context_independent_values): Likewise.
(perform_estimation_of_a_value, decide_whether_version_node): Likewise.
* ipa-fnsummary.c (evaluate_conditions_for_known_args): Replace
vec with vec.
(evaluate_properties_for_edge): Likewise.
(estimate_edge_devirt_benefit): Likewise.
(estimate_edge_size_and_time):  Likewise.
(estimate_calls_size_and_time): Likewise.
(ipa_call_context::ipa_call_context): Likewise.
(estimate_ipcp_clone_size_and_time):  Likewise.
* ipa-fnsummary.h (ipa_call_context): Replace
vec with vec.
* ipa-inline-analysis.c (do_estimate_edge_time): Replace
vec with vec.
(do_estimate_edge_size): Likewise.
(do_estimate_edge_hints): Likewise.

2019-11-14  Feng Xue  

PR ipa/91682
* gcc.dg/ipa/ipcp-agg-10.c: Change dg-scan string.
* gcc.dg/ipa/ipcp-agg-11.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/ipa/ipcp-agg-11.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ipa-cp.c
trunk/gcc/ipa-fnsummary.c
trunk/gcc/ipa-fnsummary.h
trunk/gcc/ipa-inline-analysis.c
trunk/gcc/ipa-prop.c
trunk/gcc/ipa-prop.h
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/ipa/ipcp-agg-10.c

[Bug ipa/92528] [10 Regression] ICE in ipa_get_parm_lattices since r278219

2019-11-15 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92528

--- Comment #7 from fxue at gcc dot gnu.org ---
Author: fxue
Date: Fri Nov 15 15:03:24 2019
New Revision: 278300

URL: https://gcc.gnu.org/viewcvs?rev=278300&root=gcc&view=rev
Log:
2019-11-15  Feng Xue  

PR ipa/92528
* ipa-prop.c (update_jump_functions_after_inlining): Invalidate
aggregate jump function when inlined-to caller has no edge summary.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/ipa-prop.c

[Bug ipa/92133] Support multi versioning on self recursive function

2019-12-01 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92133

--- Comment #7 from fxue at gcc dot gnu.org ---
Author: fxue
Date: Mon Dec  2 06:37:30 2019
New Revision: 278893

URL: https://gcc.gnu.org/viewcvs?rev=278893&root=gcc&view=rev
Log:
Enable recursive function versioning

2019-12-02  Feng Xue 

PR ipa/92133
* doc/invoke.texi (ipa-cp-max-recursive-depth): Document new option.
(ipa-cp-min-recursive-probability): Likewise.
* params.opt (ipa-cp-max-recursive-depth): New.
(ipa-cp-min-recursive-probability): Likewise.
* ipa-cp.c (ipcp_lattice::add_value): Add two new parameters
val_p and unlimited.
(self_recursively_generated_p): New function.
(get_val_across_arith_op): Likewise.
(propagate_vals_across_arith_jfunc): Add constant propagation for
self-recursive function.
(incorporate_penalties): Do not penalize pure self-recursive function.
(good_cloning_opportunity_p): Dump node_is_self_scc flag.
(propagate_constants_topo): Set node_is_self_scc flag for cgraph node.
(get_info_about_necessary_edges): Relax hotness check for edge to
self-recursive function.
* ipa-prop.h (ipa_node_params): Add new field node_is_self_scc.

2019-12-02  Feng Xue  

PR ipa/92133
* gcc.dg/ipa/ipa-clone-2.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/ipa/ipa-clone-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/doc/invoke.texi
trunk/gcc/ipa-cp.c
trunk/gcc/ipa-prop.h
trunk/gcc/params.opt
trunk/gcc/testsuite/ChangeLog

[Bug ipa/92794] [10 Regression] ICE in decide_about_value, at ipa-cp.c:5186

2019-12-15 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92794

--- Comment #3 from fxue at gcc dot gnu.org ---
What's configure option for 32 be powerpc?

[Bug ipa/92971] New: Suspicious code in cgraph_edge_brings_all_agg_vals_for_node(), ipa-cp.c

2019-12-17 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92971

Bug ID: 92971
   Summary: Suspicious code in
cgraph_edge_brings_all_agg_vals_for_node(), ipa-cp.c
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fxue at gcc dot gnu.org
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

The variable "values" is defined as static, which makes a questionable side
effect. History calls will impact result of current call!

  for (i = 0; i < count; i++)
{
  static vec values = vNULL;
  class ipcp_param_lattices *plats;

[Bug ipa/92794] [10 Regression] ICE in decide_about_value, at ipa-cp.c:5186

2019-12-18 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92794

--- Comment #5 from fxue at gcc dot gnu.org ---
Author: fxue
Date: Thu Dec 19 02:54:40 2019
New Revision: 279561

URL: https://gcc.gnu.org/viewcvs?rev=279561&root=gcc&view=rev
Log:
Handle aggregate pass-through for self-recursive call (PR ipa/92794)

2019-12-19  Feng Xue  

PR ipa/92794
* ipa-cp.c (self_recursive_agg_pass_through_p): New function.
(intersect_with_plats): Use error_mark_node as place holder
when aggregate jump function is simple pass-through for
self-recursive call.
(intersect_with_agg_replacements): Likewise.
(intersect_aggregates_with_edge): Likewise.
(find_aggregate_values_for_callers_subset): Likewise.

2019-12-19  Feng Xue  

PR ipa/92794
* gcc.dg/ipa/92794.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/ipa/pr92794.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ipa-cp.c
trunk/gcc/testsuite/ChangeLog

[Bug ipa/92794] [10 Regression] ICE in decide_about_value, at ipa-cp.c:5186

2019-12-18 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92794

--- Comment #7 from fxue at gcc dot gnu.org ---
I tested it locally, passed. You can have a try to confirm that.

[Bug middle-end/93041] GCC 10 removes an infinite loop and causes a null pointer to dereferenced

2019-12-23 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93041

fxue at gcc dot gnu.org changed:

   What|Removed |Added

 CC||fxue at gcc dot gnu.org

--- Comment #3 from fxue at gcc dot gnu.org ---
For gcc10, by default, a loop containing an exit, although it might not be a
real exit, is considered as finite, which is controlled by a newly introduced
option -finite-loops. To be compatible with old behavior, you can explicitly
add -fno-finite-loops.

[Bug tree-optimization/93084] [10 regression] Infinite loop in ipa-cp when building clang with LTO+PGO

2019-12-29 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93084

fxue at gcc dot gnu.org changed:

   What|Removed |Added

 CC||fxue at gcc dot gnu.org

--- Comment #5 from fxue at gcc dot gnu.org ---
I guess some situation is missed in self_recursively_generated_p(), this causes
propagation along scc explode.

[Bug tree-optimization/93084] [10 regression] Infinite loop in ipa-cp when building clang with LTO+PGO

2019-12-29 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93084

--- Comment #6 from fxue at gcc dot gnu.org ---
Could you share how you build clang with PGO, and train workload?

[Bug tree-optimization/93084] [10 regression] Infinite loop in ipa-cp when building clang with LTO+PGO

2020-01-01 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93084

--- Comment #8 from fxue at gcc dot gnu.org ---
I checked llvm source code, the recursive call lies in Constant
*llvm::ConstantFoldInsertValueInstruction(), but in dump, I noticed that call
edge is
_ZN4llvm34ConstantFoldInsertValueInstructionEPNS_8ConstantES1_NS_8ArrayRefIjEE/1977266
->
_ZN4llvm34ConstantFoldInsertValueInstructionEPNS_8ConstantES1_NS_8ArrayRefIjEE.localalias/13443902,
which means caller and callee are different graph nodes? 

If so, self_recursively_generated_p () will return false, and cause infinite
propagation, please refer to the code:

  if (!src->val || CS->CALLER != CS->CALLEE->FUNCTION_SYMBOL() ()
  || src->val == val)
return false;

Another question is that this call edge is in scc, but becomes non-self
recursive due to some transformations. And in
propagate_vals_across_arith_jfunc(), we check a self-recursive call by
comparing source ipcp_lattice with target ipcp_lattice, with the assumption
that caller and callee of a self recursive call should have identical
ipcp_lattices.

  if (SRC_LAT != DEST_LAT || param_ipa_cp_max_recursive_depth < 1)
return dest_lat->set_contains_variable ();

Then is there a case that a ipcp_lattice be shared by different cgraph nodes?

[Bug tree-optimization/93084] [10 regression] Infinite loop in ipa-cp when building clang with LTO+PGO

2020-01-01 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93084

--- Comment #9 from fxue at gcc dot gnu.org ---
xxx.localalias is gcc-generated as a noninterposable alias to xxx. But I guess
target node returned by xxx.localalias->function_symbol() is not xxx. A simple
thing we can do is to write a simple case to force generation of .localalias
and test that.

[Bug tree-optimization/93084] [10 regression] Infinite loop in ipa-cp when building clang with LTO+PGO

2020-01-03 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93084

--- Comment #12 from fxue at gcc dot gnu.org ---
Identified the cause, it's my bug, will give a fix soon.

[Bug tree-optimization/93084] [10 regression] Infinite loop in ipa-cp when building clang with LTO+PGO

2020-01-07 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93084

--- Comment #13 from fxue at gcc dot gnu.org ---
Author: fxue
Date: Wed Jan  8 02:55:00 2020
New Revision: 279987

URL: https://gcc.gnu.org/viewcvs?rev=279987&root=gcc&view=rev
Log:
Find matched aggregate lattice for self-recursive CP (PR ipa/93084)

2020-01-08  Feng Xue  

PR ipa/93084
* ipa-cp.c (self_recursively_generated_p): Find matched aggregate
lattice for a value to check.
(propagate_vals_across_arith_jfunc): Add an assertion to ensure
finite propagation in self-recursive scc.

2020-01-08  Feng Xue  

PR ipa/93084
* gcc.dg/ipa/ipa-clone-3.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/ipa/ipa-clone-3.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ipa-cp.c
trunk/gcc/testsuite/ChangeLog

[Bug lto/93166] [10 Regression] ICE in get_info_about_necessary_edges, at ipa-cp.c:4137 since r278893

2020-01-16 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93166

--- Comment #3 from fxue at gcc dot gnu.org ---
(In reply to Martin Jambor from comment #2)
> I have analyzed this ICE and came to the conclusion that the assert is
> wrong for polymorphic context lattices - e.g. in the reported case we
> always pass the same class to first parameter, which in the recursive
> call then serves as a basis to ancestor JF for the second parameter.
> 
> When propagating polymorphic contexts within SCCs we allow creating
> new values because for any sane input their number will be limited by
> class hierarchy (and potential insane input limited by
> param_ipa_cp_value_list_size).  I think that is OK too.
> 
> So we can either simply remove the assert or make it active only for
> tree lattices.  At the moment I'd prefer the former, but Feng, if this
> assert proved valuable in development the recursive function
> versioning patch, I'll be happy to keep it.  What do you think?

Sorry for late response due to trip. I'll check it.

[Bug lto/93166] [10 Regression] ICE in get_info_about_necessary_edges, at ipa-cp.c:4137 since r278893

2020-01-19 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93166

--- Comment #4 from fxue at gcc dot gnu.org ---
Created attachment 47676
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47676&action=edit
all-in-one test case

[Bug lto/93166] [10 Regression] ICE in get_info_about_necessary_edges, at ipa-cp.c:4137 since r278893

2020-01-19 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93166

--- Comment #5 from fxue at gcc dot gnu.org ---
To add a specialized class for tree lattices is a way, but will complicate the
code. We can simple remove the assertion. And a one-file test case was made
from original files.

[Bug lto/93166] [10 Regression] ICE in get_info_about_necessary_edges, at ipa-cp.c:4137 since r278893

2020-01-25 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93166

--- Comment #7 from fxue at gcc dot gnu.org ---
(In reply to Jeffrey A. Law from comment #6)
> I've got state, so I'll take this as well.

Here is a patch at https://gcc.gnu.org/ml/gcc-patches/2020-01/msg00068.html,
waiting for review from someone.

[Bug ipa/93429] New: Missed IPA-CP on by-ref argument directly passed through from caller

2020-01-25 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93429

Bug ID: 93429
   Summary: Missed IPA-CP on by-ref argument directly passed
through from caller
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fxue at gcc dot gnu.org
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Here is a case,

   f1 (int *p1)
   {
 ... = *p1;
 ...
   }

   f2 (int *p2)
   {
  *p2 = 2;
  f1 (p2);
   }

It is easy to that in f1(), *p1 should be 2 after a simple propagation from
f2() to f1(). But current IPA never do that if argument to f1() is a simple
pass-through of a parameter of f2(), as p2 -> p1.

[Bug ipa/93707] New: ICE in perlbench from SPEC2017

2020-02-12 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93707

Bug ID: 93707
   Summary: ICE in perlbench from SPEC2017
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: ipa
  Assignee: unassigned at gcc dot gnu.org
  Reporter: fxue at gcc dot gnu.org
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Compiling options "-flto --param ipa-cp-eval-threshold=1" will trigger an ICE
in the GCC and perlbench benchmark in Spec2017.

during IPA pass: cp
lto1: internal compiler error: in find_more_scalar_values_for_callers_subset,
at ipa-cp.c:4709
0x1698187 find_more_scalar_values_for_callers_subset
../.././gcc/ipa-cp.c:4709
0x169f7d3 decide_about_value
../.././gcc/ipa-cp.c:5490
0x169fdc3 decide_whether_version_node
../.././gcc/ipa-cp.c:5537
0x169fdc3 ipcp_decision_stage
../.././gcc/ipa-cp.c:5718
0x169fdc3 ipcp_driver
../.././gcc/ipa-cp.c:5901

[Bug ipa/93707] ICE in perlbench from SPEC2017

2020-02-12 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93707

fxue at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2020-02-12
   Assignee|unassigned at gcc dot gnu.org  |fxue at gcc dot gnu.org
 Ever confirmed|0   |1

[Bug ipa/93707] ICE in perlbench from SPEC2017

2020-02-12 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93707

--- Comment #1 from fxue at gcc dot gnu.org ---
Created attachment 47825
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47825&action=edit
A simplified case

[Bug ipa/93707] ICE in perlbench from SPEC2017

2020-02-12 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93707

--- Comment #2 from fxue at gcc dot gnu.org ---
For a self-recursive function, a for-all-contexts clone could generate an edge
whose callee is not the function. Thus, to check whether an edge stands for a
recursive call during cloning, we should not use ordinary way of comparing
caller and callee of the edge.

[Bug ipa/93799] [10 Regression] ice in propagate_vals_across_arith_jfunc, at ipa-cp.c:2039

2020-02-18 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93799

--- Comment #2 from fxue at gcc dot gnu.org ---
Duplicate of pr93763

[Bug ipa/93823] [10 Regression] ICE: in find_more_scalar_values_for_callers_subset, at ipa-cp.c:4709 due to -fipa-cp

2020-02-19 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93823

--- Comment #2 from fxue at gcc dot gnu.org ---
Duplicate of pr93707

[Bug ipa/91089] IPA-cp does not setup proper cost model for switch default case in function versioning

2019-09-17 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91089

--- Comment #3 from fxue at gcc dot gnu.org ---
Author: fxue
Date: Tue Sep 17 12:30:08 2019
New Revision: 275802

URL: https://gcc.gnu.org/viewcvs?rev=275802&root=gcc&view=rev
Log:
PR ipa/91089 - Setup predicate for switch default case in IPA

2019-09-17  Feng Xue  

PR ipa/91089
* doc/invoke.texi (ipa-max-switch-predicate-bounds): Document new
option.
* params.def (PARAM_IPA_MAX_SWITCH_PREDICATE_BOUNDS): New.
* ipa-fnsummary.c (set_switch_stmt_execution_predicate): Add predicate
for switch default case using range analysis information.

2019-09-17  Feng Xue  

PR ipa/91089
* gcc.dg/ipa/pr91089.c: New test.


Added:
trunk/gcc/testsuite/gcc.dg/ipa/pr91089.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/doc/invoke.texi
trunk/gcc/ipa-fnsummary.c
trunk/gcc/params.def
trunk/gcc/testsuite/ChangeLog

[Bug ipa/91088] IPA-cp cost evaluation is too conservative for "if (f(param) cmp const_val)" condition

2019-10-16 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91088

--- Comment #4 from fxue at gcc dot gnu.org ---
Author: fxue
Revision: 277054
Modified property: svn:log

Modified: svn:log at Wed Oct 16 07:41:24 2019
--
--- svn:log (original)
+++ svn:log Wed Oct 16 07:41:24 2019
@@ -1,1 +1,36 @@
-generalized IPA predicate on parameter
+Generalized IPA predicate on parameter reference
+
+2019-10-16  Feng Xue  
+
+PR ipa/91088
+* doc/invoke.texi (ipa-max-param-expr-ops): Document new option.
+* params.def (PARAM_IPA_MAX_PARAM_EXPR_OPS): New.
+* ipa-predicat.h (struct expr_eval_op): New struct.
+(expr_eval_ops): New typedef.
+(struct condition): Add type and param_ops fields, remove size field.
+(add_condition): Replace size parameter with type parameter, add
+param_ops parameter.
+* ipa-predicat.c (expr_eval_ops_equal_p): New function.
+(predicate::add_clause): Add comparisons on type and param_ops.
+(dump_condition): Add debug dump for param_ops.
+(remap_after_inlining): Adjust call arguments to add_condition.
+(add_condition): Replace size parameter with type parameter, add
+param_ops parameter. Unshare constant value used in conditions.
+* ipa-fnsummary.c (evaluate_conditions_for_known_args): Fold
+parameter expressions using param_ops.
+(decompose_param_expr):  New function.
+(set_cond_stmt_execution_predicate): Use call to decompose_param_expr
+to replace call to unmodified_parm_or_parm_agg_item.
+(set_switch_stmt_execution_predicate): Likewise.
+(will_be_nonconstant_expr_predicate): Likewise. Replace usage of size
+with type.
+(inline_read_section): Read param_ops from summary stream.
+(ipa_fn_summary_write): Write param_ops to summary stream.
+
+2019-10-16  Feng Xue  
+
+PR ipa/91088
+* gcc.dg/ipa/pr91088.c: New test.
+* gcc.dg/ipa/pr91089.c: Add sub-test for range analysis.
+* g++.dg/tree-ssa/ivopts-3.C: Force a function to be noinline.
+

[Bug testsuite/92125] New test gcc.dg/ipa/pr91088.c introduced in r277054 fails

2019-10-17 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92125

--- Comment #2 from fxue at gcc dot gnu.org ---
Author: fxue
Date: Thu Oct 17 09:55:37 2019
New Revision: 277095

URL: https://gcc.gnu.org/viewcvs?rev=277095&root=gcc&view=rev
Log:
PR testsuite/92125

2019-10-17  Feng Xue  

PR testsuite/92125
* gcc.dg/ipa/pr91088.c: Change char conversion to bitand.


Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/ipa/pr91088.c

[Bug tree-optimization/89713] Optimize away an empty loop whose finiteness can not be analytically determined

2019-06-12 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89713

--- Comment #5 from fxue at gcc dot gnu.org ---
Author: fxue
Date: Thu Jun 13 04:17:42 2019
New Revision: 272234

URL: https://gcc.gnu.org/viewcvs?rev=272234&root=gcc&view=rev
Log:
PR tree-optimization/89713 - Assume loop with an exit is finite

gcc/ChangeLog:

* doc/invoke.texi (-ffinite-loops): Document new option.
* common.opt (-ffinite-loops): New option.
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Mark
IFN_GOACC_LOOP calls as necessary.
* tree-ssa-loop-niter.c (finite_loop_p): Assume loop with an exit
is finite.
* omp-offload.c (oacc_xform_loop): Skip lowering if return value of
IFN_GOACC_LOOP call is not used.
* opts.c (default_options_table): Enable -ffinite-loops at -O2+.

gcc/testsuite/ChangeLog:

* g++.dg/tree-ssa/empty-loop.C: New test.
* gcc.dg/tree-ssa/dce-2.c: New test.
* gcc.dg/const-1.c: Add -fno-finite-loops option.
* gcc.dg/graphite/graphite.exp: Likewise.
* gcc.dg/loop-unswitch-1.c: Likewise.
* gcc.dg/predict-9.c: Likewise.
* gcc.dg/pure-2.c: Likewise.
* gcc.dg/tree-ssa/20040211-1.c: Likewise.
* gcc.dg/tree-ssa/loop-10.c: Likewise.
* gcc.dg/tree-ssa/split-path-6.c: Likewise.
* gcc.dg/tree-ssa/ssa-thread-12.c: Likewise.

libgomp/ChangeLog:

* testsuite/libgomp.oacc-c-c++-common/pr84955-1.c: New test.

Added:
trunk/gcc/testsuite/g++.dg/tree-ssa/empty-loop.C
trunk/gcc/testsuite/gcc.dg/tree-ssa/dce-2.c
trunk/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955-1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/common.opt
trunk/gcc/doc/invoke.texi
trunk/gcc/omp-offload.c
trunk/gcc/opts.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/const-1.c
trunk/gcc/testsuite/gcc.dg/graphite/graphite.exp
trunk/gcc/testsuite/gcc.dg/loop-unswitch-1.c
trunk/gcc/testsuite/gcc.dg/predict-9.c
trunk/gcc/testsuite/gcc.dg/pure-2.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/20040211-1.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/loop-10.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/split-path-6.c
trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-12.c
trunk/gcc/tree-ssa-dce.c
trunk/gcc/tree-ssa-loop-niter.c
trunk/libgomp/ChangeLog

[Bug ipa/90401] Missed propagation of by-ref constant argument to callee function

2019-06-13 Thread fxue at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90401

--- Comment #3 from fxue at gcc dot gnu.org ---
Author: fxue
Date: Fri Jun 14 02:34:48 2019
New Revision: 272282

URL: https://gcc.gnu.org/viewcvs?rev=272282&root=gcc&view=rev
Log:
PR ipa/90401

gcc/ChangeLog:

* ipa-prop.c (add_to_agg_contents_list): New function.
(clobber_by_agg_contents_list_p): Likewise.
(extract_mem_content): Likewise.
(get_place_in_agg_contents_list): Delete.
(determine_known_aggregate_parts): Renamed from
determine_locally_known_aggregate_parts.  New parameter
aa_walk_budget_p.

gcc/testsuite/ChangeLog:

* gcc.dg/ipa/ipcp-agg-10.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/ipa/ipcp-agg-10.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/ipa-prop.c
trunk/gcc/testsuite/ChangeLog