Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
This patch makes processing of transitive relations configurable at
dom_oracle creation.
* tree-vrp.cc (execute_fast_vrp): Do not use transitive relations.
* value-query.cc (range_query::create_relation_oracle): Add
parameter to enable transitive relations.
* value-query.h (range_query::create_relation_oracle): Likewise.
* value-relation.h (dom_oracle::dom_oracle): Likewise.
* value-relation.cc (dom_oracle::dom_oracle): Likewise.
(dom_oracle::register_transitives): Check transitive flag.
|
|
With more oracles incoming, rename the range_query oracle () method to
relation (), and remove the redundant 'relation' text from register and query
methods, resulting in calls that look like:
relation ()->record (...) and
relation ()->query (...)
* gimple-range-cache.cc (ranger_cache::dump_bb): Use m_relation.
(ranger_cache::fill_block_cache): Likewise
* gimple-range-fold.cc (fur_stmt::get_phi_operand): Use new names.
(fur_depend::register_relation): Likewise.
(fold_using_range::range_of_phi): Likewise.
* gimple-range-path.cc (path_range_query::path_range_query): Likewise.
(path_range_query::~path_range_query): Likewise.
(ath_range_query::compute_ranges): Likewise.
(jt_fur_source::register_relation): Likewise.
(jt_fur_source::query_relation): Likewise.
(path_range_query::maybe_register_phi_relation): Likewise.
* gimple-range-path.h (get_path_oracle): Likewise.
* gimple-range.cc (gimple_ranger::gimple_ranger): Likewise.
(gimple_ranger::~gimple_ranger): Likewise.
* value-query.cc (range_query::create_relation_oracle): Likewise.
(range_query::destroy_relation_oracle): Likewise.
(range_query::share_oracles): Likewise.
(range_query::range_query): Likewise.
* value-query.h (value_query::relation): Rename from oracle.
(m_relation): Rename from m_oracle.
* value-relation.cc (relation_oracle::query): Rename from
query_relation.
(equiv_oracle::query): Likewise.
(equiv_oracle::record): Rename from register_relation.
(relation_oracle::record): Likewise.
(dom_oracle::record): Likewise.
(dom_oracle::query): Rename from query_relation.
(path_oracle::record): Rename from register_relation.
(path_oracle::query): Rename from query_relation.
* value-relation.h (*::record): Rename from register_relation.
(*::query): Rename from query_relation.
|
|
This eliminates the need to check if the relation oracle pointer is NULL
before every call by providing a default oracle which does nothing.
REmove unused routines, and Unify register_relation method names.
* gimple-range-cache.cc (ranger_cache::dump_bb): Remove check for
NULL oracle pointer.
(ranger_cache::fill_block_cache): Likewise.
* gimple-range-fold.cc (fur_stmt::get_phi_operand): Likewise.
(fur_depend::fur_depend): Likewise.
(fur_depend::register_relation): Likewise, use qury_relation.
(fold_using_range::range_of_phi): Likewise.
(fold_using_range::relation_fold_and_or): Likewise.
* gimple-range-fold.h (fur_source::m_oracle): Delete. Oracle
can be accessed dirctly via m_query now.
* gimple-range-path.cc (path_range_query::path_range_query):
Adjust for oracle reference pointer.
(path_range_query::compute_ranges): Likewise.
(jt_fur_source::jt_fur_source): Adjust for no m_oracle member.
(jt_fur_source::register_relation): Do not check for NULL
pointer.
(jt_fur_source::query_relation): Likewise.
* gimple-range.cc (gimple_ranger::gimple_ranger): Adjust for
reference pointer.
* value-query.cc (default_relation_oracle): New.
(range_query::create_relation_oracle): Relocate from header.
Ensure not being added to global query.
(range_query::destroy_relation_oracle): Relocate from header.
(range_query::range_query): Initailize to default oracle.
(ange_query::~range_query): Call destroy_relation_oracle.
* value-query.h (class range_query): Adjust prototypes.
(range_query::create_relation_oracle): Move to source file.
(range_query::destroy_relation_oracle): Move to source file.
* value-relation.cc (relation_oracle::validate_relation): Delete.
(relation_oracle::register_stmt): Rename to register_relation.
(relation_oracle::register_edge): Likewise.
* value-relation.h (register_stmt): Rename to register_relation and
provide default function in base class.
(register_edge): Likewise.
(relation_oracle::validate_relation): Delete.
(relation_oracle::query_relation): Provide default in base class.
(relation_oracle::dump): Likewise.
(relation_oracle::equiv_set): Likewise.
(default_relation_oracle): New extenal reference.
(partial_equiv_set, add_partial_equiv): Move to protected.
|
|
Move relation queries from range_query object into the relation oracle.
* gimple-range-cache.cc (ranger_cache::ranger_cache): Call
create_relation_oracle.
(ranger_cache::~ranger_cache): Call destroy_relation_oracle.
* gimple-range-fold.cc (fur_stmt::get_phi_operand): Check for
relation oracle bnefore calling query_relation.
(fold_using_range::range_of_phi): Likewise.
* gimple-range-path.cc (path_range_query::~path_range_query): Set
relation oracle pointer to NULL when done.
* gimple-range.cc (gimple_ranger::~gimple_ranger): Likewise.
* value-query.cc (range_query::~range_query): Ensure any
relation oracle is destroyed.
(range_query::query_relation): relocate to relation_oracle object.
* value-query.h (class range_query): Adjust method proototypes.
(range_query::create_relation_oracle): New.
(range_query::destroy_relation_oracle): New.
* value-relation.cc (relation_oracle::query_relation): Relocate
from range query class.
* value-relation.h (Call relation_oracle): New prototypes.
|
|
|
|
A floating point equivalence may not properly reflect both signs of
zero, so be pessimsitic and ensure both signs are included.
PR tree-optimization/111694
gcc/
* gimple-range-cache.cc (ranger_cache::fill_block_cache): Adjust
equivalence range.
* value-relation.cc (adjust_equivalence_range): New.
* value-relation.h (adjust_equivalence_range): New prototype.
gcc/testsuite/
* gcc.dg/pr111694.c: New.
|
|
Turns out we didnt need this as there is no unordered relations
managed by the oracle.
* gimple-range-gori.cc (gori_compute::compute_operand1_range): Do
not call get_identity_relation.
(gori_compute::compute_operand2_range): Ditto.
* value-relation.cc (get_identity_relation): Remove.
* value-relation.h (get_identity_relation): Remove protyotype.
|
|
We've been assuming x == x s VREL_EQ in GORI, but this is not always going to
be true with floating point. Provide an API to return the relation.
* gimple-range-gori.cc (gori_compute::compute_operand1_range):
Use identity relation.
(gori_compute::compute_operand2_range): Ditto.
* value-relation.cc (get_identity_relation): New.
* value-relation.h (get_identity_relation): New prototype.
|
|
If either of the SSA names in a comparison do not have any equivalences
or relations, we can short-circuit the check slightly.
* value-relation.cc (dom_oracle::query_relation): Check early for lack
of any relation.
* value-relation.h (equiv_oracle::has_equiv_p): New.
|
|
First, class value_relation should not sanitize records. just create
what is asked.
Second., if there is not a relation record, compute_operand was
creating one for op1 == op2 if op1 and op2 were the same symbol. This
is not the correct way to communicate the information, as that record
will continue to be passed along the GORI unwind chain.
Instead, simply pass that information locally to the opX_range routine
for only the current statement.
PR tree-optimization/109265
PR tree-optimization/109274
gcc/
* gimple-range-gori.cc (gori_compute::compute_operand_range): Do
not create a relation record is op1 and op2 are the same symbol.
(gori_compute::compute_operand1_range): Pass op1 == op2 to the
handler for this stmt, but create a new record only if this statement
generates a relation based on the ranges.
(gori_compute::compute_operand2_range): Ditto.
* value-relation.h (value_relation::set_relation): Always create the
record that is requested.
gcc/testsuite/
* gcc.dg/pr109274.c: New.
* gfortran.dg/pr109265.f90: New.
|
|
I've noticed a comment typo in tree-vrp.cc and decided to quickly
skim aspell -c on the ranger sources (with quick I on everything that
looked ok or roughly ok).
But not being a native English speaker, I could get stuff wrong.
2023-03-23 Jakub Jelinek <jakub@redhat.com>
* value-range.cc (irange::irange_union, irange::intersect): Fix
comment spelling bugs.
* gimple-range-trace.cc (range_tracer::do_header): Likewise.
* gimple-range-trace.h: Likewise.
* gimple-range-edge.cc: Likewise.
(gimple_outgoing_range_stmt_p,
gimple_outgoing_range::switch_edge_range,
gimple_outgoing_range::edge_range_p): Likewise.
* gimple-range.cc (gimple_ranger::prefill_stmt_dependencies,
gimple_ranger::fold_stmt, gimple_ranger::register_transitive_infer,
assume_query::assume_query, assume_query::calculate_phi): Likewise.
* gimple-range-edge.h: Likewise.
* value-range.h (Value_Range::set, Value_Range::lower_bound,
Value_Range::upper_bound, frange::set_undefined): Likewise.
* gimple-range-gori.h (range_def_chain::depend, gori_map::m_outgoing,
gori_compute): Likewise.
* gimple-range-fold.h (fold_using_range): Likewise.
* gimple-range-path.cc (path_range_query::compute_ranges_in_phis):
Likewise.
* gimple-range-gori.cc (range_def_chain::in_chain_p,
range_def_chain::dump, gori_map::calculate_gori,
gori_compute::compute_operand_range_switch,
gori_compute::logical_combine, gori_compute::refine_using_relation,
gori_compute::compute_operand1_range, gori_compute::may_recompute_p):
Likewise.
* gimple-range.h: Likewise.
(enable_ranger): Likewise.
* range-op.h (empty_range_varying): Likewise.
* value-query.h (value_query): Likewise.
* gimple-range-cache.cc (block_range_cache::set_bb_range,
block_range_cache::dump, ssa_global_cache::clear_global_range,
temporal_cache::temporal_value, temporal_cache::current_p,
ranger_cache::range_of_def, ranger_cache::propagate_updated_value,
ranger_cache::range_from_dom, ranger_cache::register_inferred_value):
Likewise.
* gimple-range-fold.cc (fur_edge::get_phi_operand,
fur_stmt::get_operand, gimple_range_adjustment,
fold_using_range::range_of_phi,
fold_using_range::relation_fold_and_or): Likewise.
* value-range-storage.h (irange_storage_slot::MAX_INTS): Likewise.
* value-query.cc (range_query::value_of_expr,
range_query::value_on_edge, range_query::query_relation): Likewise.
* tree-vrp.cc (remove_unreachable::remove_and_update_globals,
intersect_range_with_nonzero_bits): Likewise.
* gimple-range-infer.cc (gimple_infer_range::check_assume_func,
exit_range): Likewise.
* value-relation.h: Likewise.
(equiv_oracle, relation_trio::relation_trio, value_relation,
value_relation::value_relation, pe_min): Likewise.
* range-op-float.cc (range_operator_float::rv_fold,
frange_arithmetic, foperator_unordered_equal::op1_range,
foperator_div::rv_fold): Likewise.
* gimple-range-op.cc (cfn_clz::fold_range): Likewise.
* value-relation.cc (equiv_oracle::query_relation,
equiv_oracle::register_equiv, equiv_oracle::add_equiv_to_block,
value_relation::apply_transitive, relation_chain_head::find_relation,
dom_oracle::query_relation, dom_oracle::find_relation_block,
dom_oracle::find_relation_dom, path_oracle::register_equiv): Likewise.
* range-op.cc (range_operator::wi_fold_in_parts_equiv,
create_possibly_reversed_range, adjust_op1_for_overflow,
operator_mult::wi_fold, operator_exact_divide::op1_range,
operator_cast::lhs_op1_relation, operator_cast::fold_pair,
operator_cast::fold_range, operator_abs::wi_fold, range_op_cast_tests,
range_op_lshift_tests): Likewise.
|
|
We currently allow VARYING lhs GORI calculations to continue if there is
a relation present in the hope it will eventually better refine a result.
This adds a check that the relation is relevant to the outgoing range
calculation first. If it is not relevant, stop calculating.
PR tree-optimization/109192
* gimple-range-gori.cc (gori_compute::compute_operand_range):
Terminate gori calculations if a relation is not relevant.
* value-relation.h (value_relation::set_relation): Allow
equality between op1 and op2 if they are the same.
|
|
When relation trios were added to GORI, there was only one use. As they are
utilized more by range-ops, it is apparent that the implelemtation was
not complete. This patch fleshes it out completely so that every GORI
operation has a complete relation trio.
* gimple-range-gori.cc (gori_compute::compute_operand_range): Do
not abort calculations if there is a valid relation available.
(gori_compute::refine_using_relation): Pass correct relation trio.
(gori_compute::compute_operand1_range): Create trio and use it.
(gori_compute::compute_operand2_range): Ditto.
* range-op.cc (operator_plus::op1_range): Use correct trio member.
(operator_minus::op1_range): Use correct trio member.
* value-relation.cc (value_relation::create_trio): New.
* value-relation.h (value_relation::create_trio): New prototype.
|
|
|
|
There are 3 possible relations range-ops might care about, but only the one
most likely to be needed is supplied. This patch provides a new class
relation_trio which allows 3 relations to be passed in a single word.
fold_range (), op1_range (), and op2_range () are adjusted to take a
relation_trio class instead of a relation_kind, then the routine can
extract which relation it wants to work with.
* gimple-range-fold.cc (fold_using_range::range_of_range_op):
Provide relation_trio class.
* gimple-range-gori.cc (gori_compute::refine_using_relation):
Provide relation_trio class.
(gori_compute::refine_using_relation): Ditto.
(gori_compute::compute_operand1_range): Provide lhs_op2 and
op1_op2 relations via relation_trio class.
(gori_compute::compute_operand2_range): Ditto.
* gimple-range-op.cc (gimple_range_op_handler::calc_op1): Use
relation_trio instead of relation_kind.
(gimple_range_op_handler::calc_op2): Ditto.
(*::fold_range): Ditto.
* gimple-range-op.h (gimple_range_op::calc_op1): Adjust prototypes.
(gimple_range_op::calc_op2): Adjust prototypes.
* range-op-float.cc (*::fold_range): Use relation_trio instead of
relation_kind.
(*::op1_range): Ditto.
(*::op2_range): Ditto.
* range-op.cc (*::fold_range): Use relation_trio instead of
relation_kind.
(*::op1_range): Ditto.
(*::op2_range): Ditto.
* range-op.h (class range_operator): Adjust prototypes.
(class range_operator_float): Ditto.
(class range_op_handler): Adjust prototypes.
(relop_early_resolve): Pickup op1_op2 relation from relation_trio.
* value-relation.cc (VREL_LAST): Adjust use to be one past the end of
the enum.
(relation_oracle::validate_relation): Use relation_trio in call
to fold_range.
* value-relation.h (enum relation_kind_t): Add VREL_LAST as
final element.
(class relation_trio): New.
(TRIO_VARYING, TRIO_SHIFT, TRIO_MASK): New.
|
|
The oracle will not register nonssense/useless relations, class
value_relation shouldn't either.
* value-relation.cc (value_relation::dump): Change message.
* value-relation.h (value_relation::set_relation): If op1 is the
same as op2 do not create a relation.
|
|
Instead of looping over an exposed equivalence bitmap, provide iterators
to loop over equivalences, partial equivalences, or both.
* gimple-range-cache.cc (ranger_cache::fill_block_cache): Use
iterator.
* value-relation.cc
(equiv_relation_iterator::equiv_relation_iterator): New.
(equiv_relation_iterator::next): New.
(equiv_relation_iterator::get_name): New.
* value-relation.h (class relation_oracle): Privatize some methods.
(class equiv_relation_iterator): New.
(FOR_EACH_EQUIVALENCE): New.
(FOR_EACH_PARTIAL_EQUIV): New.
(FOR_EACH_PARTIAL_AND_FULL_EQUIV): New.
|
|
This provides enhancements to the equivalence oracle to also track
partial equivalences. They are tracked similar to equivalences, except
it tracks a 'slice' of another ssa name. 8, 16, 32 and 64 bit slices are
tracked. This will allow casts and mask of the same value to compare
equal.
* value-relation.cc (equiv_chain::dump): Don't print empty
equivalences.
(equiv_oracle::equiv_oracle): Allocate a partial equiv table.
(equiv_oracle::~equiv_oracle): Release the partial equiv table.
(equiv_oracle::add_partial_equiv): New.
(equiv_oracle::partial_equiv_set): New.
(equiv_oracle::partial_equiv): New.
(equiv_oracle::query_relation): Check for partial equivs too.
(equiv_oracle::dump): Also dump partial equivs.
(dom_oracle::register_relation): Handle partial equivs.
(dom_oracle::query_relation): Check for partial equivs.
* value-relation.h (enum relation_kind_t): Add partial equivs.
(relation_partial_equiv_p): New.
(relation_equiv_p): New.
(class pe_slice): New.
(class equiv_oracle): Add prototypes.
(pe_to_bits): New.
(bits_to_pe): New.
(pe_min): New.
|
|
If a relation is available, calculate overflow and normal ranges. Then
apply as appropriate.
gcc/
* range-op.cc (plus_minus_ranges): New.
(adjust_op1_for_overflow): New.
(operator_plus::op1_range): Use new adjustment.
(operator_plus::op2_range): Ditto.
(operator_minus::op1_range): Ditto.
* value-relation.h (relation_lt_le_gt_ge_p): New.
gcc/testsuite/
* gcc.dg/tree-ssa/pr79095.c: Test evrp pass rather than vrp1.
|
|
* value-relation.cc (class value_relation): Move to .h file.
(value_relation::set_relation): Ditto.
(value_relation::value_relation): ditto.
* value-relation.h (class value_relation): Move from .cc file.
(value_relation::set_relation): Ditto
(value_relation::value_relation): Ditto.
|
|
When we cross a backedge in the path solver, we reset the path
relations and nuke the root oracle. However, we forget to reset it
for the next path. This is causing us to miss threads because
subsequent paths will have no root oracle to use.
With this patch we get 201 more threads in the threadfull passes in my
.ii files and 118 more overall (DOM gets less because threadfull runs
before).
Normally, I'd recommend this for the GCC 12 branch, but considering
how sensitive other passes are to jump threading, and that there is no
PR associated with this, perhaps we should leave this out. Up to the
release maintainers of course.
gcc/ChangeLog:
* gimple-range-path.cc
(path_range_query::compute_ranges_in_block): Remove
set_root_oracle call.
(path_range_query::compute_ranges): Pass ranger oracle to
reset_path.
* value-relation.cc (path_oracle::reset_path): Set root oracle.
* value-relation.h (path_oracle::reset_path): Add root oracle
argument.
|
|
Provide a relation oracle API which validates a relation between 2 ranges.
This allows relation queries that are symbolicly true to be overridden
by range specific information. ie. x == x is true symbolically, but for
floating point a NaN may invalidate this assumption.
* value-relation.cc (relation_to_code): New vector.
(relation_oracle::validate_relation): New.
(set_relation): Allow ssa1 == ssa2 to be registered.
* value-relation.h (validate_relation): New prototype.
(query_relation): Make internal variant protected.
|
|
gcc/ChangeLog:
* value-relation.h: Add "final" and "override" to relation_oracle
vfunc implementations as appropriate.
Signed-off-by: David Malcolm <dmalcolm@redhat.com>
|
|
Re-using some common things like EQ_EXPR and other relationals made
certain things easier, but complicated debugging and added extra overhead
when accessing lookup tables. With forthcoming additional relation types,
it makes more sense to simple have a distinct relation kind.
* gimple-range-fold.cc (fold_using_range::range_of_phi): Use new VREL_*
enumerated values.
* gimple-range-path.cc (maybe_register_phi_relation): Ditto.
* range-op.cc (*::lhs_op1_relation): Return relation_kind, and use
new VREL enumerated values.
(*::lhs_op2_relation): Ditto.
(*::op1_op2_relation): Ditto.
(*::fold_range): Use new VREL enumerated values.
(minus_op1_op2_relation_effect): Ditto.
(range_relational_tests): Ditto.
* range-op.h (fold_range, op1_range, op2_range): Use VREL_VARYING.
(lhs_op1_relation, lhs_op2_relation, op1_op2_relation): Return
relation_kind.
(*_op1_op2_relation): Return relation_kind.
(relop_early_resolve): Use VREL_UNDEFINED.
* value-query.cc (range_query::query_relation): Use VREL_VARYING.
* value-relation.cc (VREL_LAST): Change enumerated value.
(vrel_range_assert): Delete.
(print_relation): Remove range assert.
(rr_negate_table): Adjust table to use new enumerated values..
(relation_negate): Remove range assert.
(rr_swap_table): Adjust.
(relation_swap): Remove range assert.
(rr_intersect_table): Adjust.
(relation_intersect): Remove range assert.
(rr_union_table): Adjust.
(relation_union): Remove range assert.
(rr_transitive_table): Adjust.
(relation_transitive): Remove range assert.
(equiv_oracle::query_relation): Use new VREL enumerated values.
(equiv_oracle::register_relation): Ditto.
(relation_oracle::register_stmt): Ditto.
(dom_oracle::set_one_relation): Ditto.
(dom_oracle::register_transitives): Ditto.
(dom_oracle::query_relation): Ditto.
(path_oracle::register_relation): Ditto.
(path_oracle::query_relation): Ditto.
* value-relation.h (enum relation_kind_t): New relation_kind.
(*_op1_op2_relation): Adjust prototypes.
|
|
Like in r10-7215-g700d4cb08c88aec37c13e21e63dd61fd698baabc 2 years ago,
I've run
grep -v 'long long\|optab optab\|template template\|double double' *.{[chS],cc} */*.{[chS],cc} *.def config/*/* 2>/dev/null | grep ' \([a-zA-Z]\+\) \1 '
and for the cases that looked clearly wrong changed them, mostly by removing
one of the duplicated words but in some cases with other changes.
2022-03-07 Jakub Jelinek <jakub@redhat.com>
gcc/
* tree-ssa-propagate.cc: Fix up duplicated word issue in a comment.
* config/riscv/riscv.cc: Likewise.
* config/darwin.h: Likewise.
* config/i386/i386.cc: Likewise.
* config/aarch64/thunderx3t110.md: Likewise.
* config/aarch64/fractional-cost.h: Likewise.
* config/vax/vax.cc: Likewise.
* config/rs6000/pcrel-opt.md: Likewise.
* config/rs6000/predicates.md: Likewise.
* ctfc.h: Likewise.
* tree-ssa-uninit.cc: Likewise.
* value-relation.h: Likewise.
* gimple-range-gori.cc: Likewise.
* ipa-polymorphic-call.cc: Likewise.
* pointer-query.cc: Likewise.
* ipa-sra.cc: Likewise.
* internal-fn.cc: Likewise.
* varasm.cc: Likewise.
* gimple-ssa-warn-access.cc: Likewise.
gcc/analyzer/
* store.cc: Fix up duplicated word issue in a comment.
* analyzer.cc: Likewise.
* engine.cc: Likewise.
* sm-taint.cc: Likewise.
gcc/c-family/
* c-attribs.cc: Fix up duplicated word issue in a comment.
gcc/cp/
* cvt.cc: Fix up duplicated word issue in a comment.
* pt.cc: Likewise.
* module.cc: Likewise.
* coroutines.cc: Likewise.
gcc/fortran/
* trans-expr.cc: Fix up duplicated word issue in a comment.
* gfortran.h: Likewise.
* scanner.cc: Likewise.
gcc/jit/
* libgccjit.h: Fix up duplicated word issue in a comment.
|
|
As discussed in PR103721, the problem here is that we are crossing a
backedge and causing us to use relations from a previous iteration of a
loop.
This handles the testcases in both PR103721 and PR104067 which are variants
of the same thing.
Tested on x86-64 Linux with the usual regstrap as well as verifying the
thread count before and after the patch. The number of threads is
reduced by a miniscule amount.
gcc/ChangeLog:
PR tree-optimization/103721
* gimple-range-path.cc
(path_range_query::relations_may_be_invalidated): New.
(path_range_query::compute_ranges_in_block): Reset relations if
they may be invalidated.
(path_range_query::maybe_register_phi_relation): Exit if relations
may be invalidated on incoming edge.
(path_range_query::compute_phi_relations): Pass incoming PHI edge
to maybe_register_phi_relation.
* gimple-range-path.h (relations_may_be_invalidated): New.
(maybe_register_phi_relation): Pass edge instead of tree.
* tree-ssa-threadbackward.cc (back_threader::back_threader):
Mark DFS edges.
* value-relation.cc (path_oracle::path_oracle): Call
mark_dfs_back_edges.
(path_oracle::register_relation): Add SSA names to m_registered
bitmap.
(path_oracle::reset_path): Clear m_registered bitmap.
* value-relation.h (path_oracle::set_root_oracle): New.
gcc/testsuite/ChangeLog:
* gcc.dg/pr103721-2.c: New test.
* gcc.dg/pr103721.c: New test.
|
|
When equivalencies sets are merged, each member of the set should be queried
to ensure its still valid rather than a bulk union.
* value-relation.cc (relation_oracle::valid_equivs): Query and add
if valid members of a set.
(equiv_oracle::register_equiv): Call valid_equivs rather than
bitmap direct operations.
(path_oracle::register_equiv): Ditto.
* value-relation.h (relation_oracle::valid_equivs): New prototype.
|
|
In pathological cases, the number of transitive relations being added is
potentially quadratic. Lookups for relations in a block is linear in
nature, so simply limit the number of relations to some reasonable number.
PR tree-optimization/104038
* doc/invoke.texi (relation-block-limit): New.
* params.opt (relation-block-limit): New.
* value-relation.cc (dom_oracle::register_relation): Check for NULL
record before invoking transitive registery.
(dom_oracle::set_one_relation): Check limit before creating record.
(dom_oracle::register_transitives): Stop when no record created.
* value-relation.h (relation_chain_head::m_num_relations): New.
|
|
|
|
The problem here is that we are incorrectly threading 41->20->21 here:
<bb 35> [local count: 56063504182]:
_134 = M.10_120 + 1;
if (_71 <= _134)
goto <bb 19>; [11.00%]
else
goto <bb 41>; [89.00%]
...
...
...
<bb 41> [local count: 49896518755]:
<bb 20> [local count: 56063503181]:
# lb_75 = PHI <_134(41), 1(18)>
_117 = mstep_49 + lb_75;
_118 = _117 + -1;
_119 = mstep_49 + _118;
M.10_120 = MIN_EXPR <_119, _71>;
if (lb_75 > M.10_120)
goto <bb 21>; [11.00%]
else
goto <bb 22>; [89.00%]
First, lb_17 == _134 because of the PHI.
Second, _134 > M.10_120 because of _134 = M.10_120 + 1.
We then assume that lb_75 > M.10_120, but this is incorrect because
M.10_120 was killed along the path.
This incorrect thread causes the miscompilation in 527.cam4_r.
Tested on x86-64 and ppc64le Linux.
gcc/ChangeLog:
PR tree-optimization/103061
* value-relation.cc (path_oracle::path_oracle): Initialize
m_killed_defs.
(path_oracle::killing_def): Set m_killed_defs.
(path_oracle::query_relation): Do not look at the root oracle for
killed defs.
* value-relation.h (class path_oracle): Add m_killed_defs.
|
|
The equivalence oracle creates a new equiv set at each def point,
killing any incoming equivalences, however in the path sensitive
oracle we create brand new equivalences at each PHI:
BB4:
BB8:
x_5 = PHI <y_8(4)>
Here we note that x_5 == y_8 at the end of the path.
The current code is intersecting this new equivalence with previously
known equivalences coming into the path. This is incorrect, as this
is a new definition. This patch kills any known equivalence before we
register a new one.
This hasn't caused problems so far, but upcoming changes to the
pipeline has us threading more aggressively and triggering corner
cases where this causes incorrect code.
I have tested this patch with the usual regstrap cycle. I have also
hacked a compiler comparing the old and new behavior to see if we were
previously threading paths where the decision was made due to invalid
equivalences. Luckily, there were no such paths, but there were 22
paths in a set of .ii files where disregarding incoming relations
allowed us to thread the path. This is a miniscule improvement,
but we moved a handful of thredable paths earlier in the pipeline,
which is always good.
Tested on x86-64 Linux.
Co-authored-by: Andrew MacLeod <amacleod@redhat.com>
gcc/ChangeLog:
* gimple-range-path.cc (path_range_query::compute_phi_relations):
Kill any global relations we may know before registering a new
one.
* value-relation.cc (path_oracle::killing_def): New.
* value-relation.h (path_oracle::killing_def): New.
|
|
Create a new equivalency set at each def point killing any equivalencies
coming into the block from back edges. Do not add equivalences for PHI
arguments defined in this block.
* value-relation.cc (equiv_oracle::register_initial_def): New.
(equiv_oracle::register_relation): Call register_initial_def.
(equiv_oracle::add_equiv_to_block): New. Split register_relation.
(relation_oracle::register_stmt): Check def block of PHI arguments.
* value-relation.h (equiv_oracle): Add new prototypes.
|
|
This provides a path_oracle class which can optionally be used in conjunction
with another oracle to track relations on a path as it is walked.
* value-relation.cc (class equiv_chain): Move to header file.
(path_oracle::path_oracle): New.
(path_oracle::~path_oracle): New.
(path_oracle::register_relation): New.
(path_oracle::query_relation): New.
(path_oracle::reset_path): New.
(path_oracle::dump): New.
* value-relation.h (class equiv_chain): Move to here.
(class path_oracle): New.
|
|
Standardize equiv_oracle API onto the new relation_oracle virtual base, and
then have dom_oracle inherit from that.
equiv_set always returns an equivalency set now, never NULL.
EQ_EXPR requires symmetry now. Each SSA name must be in the other equiv set.
Shuffle some routines around, simplify.
* gimple-range-cache.cc (ranger_cache::ranger_cache): Create a DOM
based oracle.
* gimple-range-fold.cc (fur_depend::register_relation): Use
register_stmt/edge routines.
* value-relation.cc (equiv_chain::find): Relocate from equiv_oracle.
(equiv_oracle::equiv_oracle): Create self equivalence cache.
(equiv_oracle::~equiv_oracle): Release same.
(equiv_oracle::equiv_set): Return entry from self equiv cache if there
are no equivalences.
(equiv_oracle::find_equiv_block): Move list find to equiv_chain.
(equiv_oracle::register_relation): Rename from register_equiv.
(relation_chain_head::find_relation): Relocate from dom_oracle.
(relation_oracle::register_stmt): New.
(relation_oracle::register_edge): New.
(dom_oracle::*): Rename from relation_oracle.
(dom_oracle::register_relation): Adjust to call equiv_oracle.
(dom_oracle::set_one_relation): Split from register_relation.
(dom_oracle::register_transitives): Consolidate 2 methods.
(dom_oracle::find_relation_block): Move core to relation_chain.
(dom_oracle::query_relation): Rename from find_relation_dom and adjust.
* value-relation.h (class relation_oracle): New pure virtual base.
(class equiv_oracle): Inherit from relation_oracle and adjust.
(class dom_oracle): Rename from old relation_oracle and adjust.
|
|
Tested on x86-64 Linux.
gcc/ChangeLog:
* value-relation.cc (relation_oracle::debug): New.
* value-relation.h (relation_oracle::debug): New.
|
|
When registering relations in the oracle, search for other relations which
imply new transitive relations.
gcc/
* value-relation.cc (rr_transitive_table): New.
(relation_transitive): New.
(value_relation::swap): Remove.
(value_relation::apply_transitive): New.
(relation_oracle::relation_oracle): Allocate a new tmp bitmap.
(relation_oracle::register_relation): Call register_transitives.
(relation_oracle::register_transitives): New.
* value-relation.h (relation_oracle): Add new temporary bitmap and
methods.
gcc/testsuite/
* gcc.dg/predict-1.c: Disable evrp.
* gcc.dg/tree-ssa/evrp-trans.c: New.
|
|
This code provides a both an equivalence and relation oracle which can be
accessed via a range_query object. This initial code drop includes the
oracles and access them, but does not utilize them yet.
* Makefile.in (OBJS): Add value-relation.o.
* gimple-range.h: Adjust include files.
* tree-data-ref.c: Adjust include file order.
* value-query.cc (range_query::get_value_range): Default to no oracle.
(range_query::query_relation): New.
(range_query::query_relation): New.
* value-query.h (class range_query): Adjust.
* value-relation.cc: New.
* value-relation.h: New.
|