2009-11-25 11:55:54 +01:00
|
|
|
/* Source code for an implementation of the Omega test, an integer
|
|
|
|
programming algorithm for dependence analysis, by William Pugh,
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
appeared in Supercomputing '91 and CACM Aug 92.
|
|
|
|
|
|
|
|
This code has no license restrictions, and is considered public
|
|
|
|
domain.
|
|
|
|
|
2014-01-02 23:23:26 +01:00
|
|
|
Changes copyright (C) 2005-2014 Free Software Foundation, Inc.
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
Contributed by Sebastian Pop <sebastian.pop@inria.fr>
|
|
|
|
|
|
|
|
This file is part of GCC.
|
|
|
|
|
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free
|
2007-07-26 10:37:01 +02:00
|
|
|
Software Foundation; either version 3, or (at your option) any later
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
version.
|
|
|
|
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-07-26 10:37:01 +02:00
|
|
|
along with GCC; see the file COPYING3. If not see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
/* For a detailed description, see "Constraint-Based Array Dependence
|
|
|
|
Analysis" William Pugh, David Wonnacott, TOPLAS'98 and David
|
|
|
|
Wonnacott's thesis:
|
|
|
|
ftp://ftp.cs.umd.edu/pub/omega/davewThesis/davewThesis.ps.gz
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "coretypes.h"
|
|
|
|
#include "tree.h"
|
diagnostic-core.h: New.
* diagnostic-core.h: New. Contents moved from diagnostic.h and
toplev.h.
* diagnostic.c: Don't include toplev.h.
(progname): Define. Moved from toplev.c.
(seen_error): New function.
* diagnostic.h: Include diagnostic-core.h.
(diagnostic_t, emit_diagnostic): Don't declare here.
* toplev.c (progname): Move to toplev.c.
(emit_debug_global_declarations, compile_file, finalize,
do_compile, toplev_main): Use seen_error.
* toplev.h: Include diagnostic-core.h.
(trim_filename, GCC_DIAG_STYLE, ATTRIBUTE_GCC_DIAG,
internal_error, warning, warning_at, error, error_n, error_at,
fatal_error, pedwarn, permerror, sorry, inform, inform_n,
verbatim, fnotice, progname): Move to diagnostic-core.h.
* builtins.c: Include diagnostic-core.h instead of diagnostic.h.
(expand_builtin_expect): Use seen_error.
* c-decl.c: Include diagnostic-core.h instead of diagnostic.h.
(c_make_fname_decl, c_write_global_declarations): Use seen_error.
* c-format.c: Include diagnostic-core.h instead of diagnostic.h.
* c-gimplify.c: Include diagnostic-core.h instead of diagnostic.h.
* c-lang.c: Include diagnostic-core.h instead of diagnostic.h.
* c-lex.c (c_lex_with_flags, interpret_float): Don't increment
errorcount for errors.
* c-opts.c (c_common_finish): Use seen_error.
* cgraph.c: Include diagnostic-core.h instead of diagnostic.h.
* cgraphunit.c (verify_cgraph_node, verify_cgraph,
cgraph_output_pending_asms, cgraph_optimize): Use seen_error.
* coverage.c: Include diagnostic-core.h instead of diagnostic.h.
(get_coverage_counts): Use seen_error.
* dwarf2out.c (dwarf2out_finish): Use seen_error.
* gimplify.c (gimplify_var_or_parm_decl, gimple_push_cleanup,
gimplify_body): Use seen_error.
* ipa-inline.c (cgraph_early_inlining): Use seen_error.
* ipa-pure-const.c (gate_pure_const): Use seen_error.
* ipa-reference.c (gate_reference): Use seen_error.
* jump.c: Include diagnostic-core.h instead of diagnostic.h.
* lambda-code.c: Include diagnostic-core.h instead of
diagnostic.h.
* lto-cgraph.c: Include diagnostic-core.h instead of diagnostic.h.
* lto-compress.c: Include diagnostic-core.h instead of
diagnostic.h.
* lto-section-in.c: Include diagnostic-core.h instead of
diagnostic.h.
* lto-streamer-out.c: Include diagnostic-core.h instead of
diagnostic.h.
* lto-streamer.c: Include diagnostic-core.h instead of
diagnostic.h.
(gate_lto_out): Use seen_error.
* matrix-reorg.c: Include diagnostic-core.h instead of
diagnostic.h.
* omega.c: Include diagnostic-core.h instead of diagnostic.h.
* omp-low.c: Include diagnostic-core.h instead of diagnostic.h.
(gate_expand_omp, lower_omp_1): Use seen_error.
* passes.c: Include diagnostic-core.h instead of diagnostic.h.
(rest_of_decl_compilation, rest_of_type_compilation,
gate_rest_of_compilation, ipa_write_summaries): Use seen_error.
* tree-cfg.c (label_to_block_fn): Use seen_error.
* tree-inline.c (optimize_inline_calls): Use seen_error.
* tree-mudflap.c (mudflap_finish_file): Use
seen_error.
* tree-optimize.c (gate_all_optimizations,
gate_all_early_local_passes, gate_all_early_optimizations): Use
seen_error.
* tree-ssa-structalias.c (gate_ipa_pta): Use seen_error.
* varpool.c: Include diagnostic-core.h instead of diagnostic.h.
(varpool_remove_unreferenced_decls,
varpool_assemble_pending_decls): Use seen_error.
* Makefile.in (DIAGNOSTIC_CORE_H): Define.
(TOPLEV_H, DIAGNOSTIC_H): Update.
(c-decl.o, c-lang.o, c-format.o, lto-compress.o, lto-cgraph.o,
lto-streamer-out.o, lto-section-in.o, lto-streamer.o,
c-gimplify.o, omp-low.o, omega.o, diagnostic.o, passes.o,
builtins.o, jump.o, cgraph.o, varpool.o, matrix-reorg.o,
coverage.o, lambda-code.o): Update dependencies.
cp:
* call.c: Include diagnostic-core.h instead of diagnostic.h.
* cp-lang.c: Don't include diagnostic.h
* name-lookup.c: Include diagnostic-core.h instead of
diagnostic.h.
(cp_emit_debug_info_for_using): Use seen_error.
* optimize.c: Include diagnostic-core.h instead of diagnostic.h.
* parser.c: Include diagnostic-core.h instead of diagnostic.h.
* pt.c (iterative_hash_template_arg): Use seen_error.
* repo.c: Include diagnostic-core.h instead of diagnostic.h.
* typeck2.c: Include diagnostic-core.h instead of diagnostic.h.
* Make-lang.in (cp/cp-lang.o, cp/typeck2.o, cp/call.o, cp/repo.o,
cp/optimize.o, cp/parser.o, cp/name-lookup.o): Update
dependencies.
lto:
* lto.c: Include diagnostic-core.h instead of diagnostic.h.
(read_cgraph_and_symbols, lto_main): Use seen_error.
* Make-lang.in (lto/lto.o): Update dependencies.
objc:
* objc-act.c: Include diagnostic-core.h instead of diagnostic.h.
* Make-lang.in (objc/objc-act.o): Update dependencies.
From-SVN: r159947
2010-05-27 22:16:07 +02:00
|
|
|
#include "diagnostic-core.h"
|
system.h (dump_file): Do not define.
gcc/
* system.h (dump_file): Do not define.
* tree-pass.h: Include dumpfile.h, which is a new file containing...
(enum tree_dump_index, TDF_*, get_dump_file_name, dump_enabled_p,
dump_initialized_p, dump_begin, dump_end, dump_node, dump_switch_p,
dump_flag_name, dump_file, dump_flags, dump_file_name,
get_dump_file_info, struct dump_file_info): all of this, moved to...
* dumpfile.h: Here, new file.
* tree-dump.h: Include dumpfile.h, but not tree-pass.h.
(dump_stmt): Remove prototype for C++ specific function.
(dump_enumerated_decls): Move prototype from here...
* tree-flow.h (dump_enumerated_decls): ... to here.
(get_ref_base_and_extent) Move prototype from here ...
* tree.h (get_ref_base_and_extent) ... to here.
* tree-ssa-live.c: Do not inclde tree-pretty-print.h, because
gimple-pretty-print.h is enough. Do not include tree-dump.h,
include timevar.h and dumpfile.h instead.
(struct numbered_tree_d, compare_decls_by_uid,
dump_enumerated_decls_push, dump_enumerated_decls): Move from here ...
* tree-dfa.c:(struct numbered_tree_d, compare_decls_by_uid,
dump_enumerated_decls_push, dump_enumerated_decls):... to here.
Do not include timevar.h.
* tree.c: Do not include timevar.h.
* tree-cfg.c: Do not include langhooks.h, tree-pretty-print.h, and
timevar.h.
(dump_cfg_stats): Use current_function_name.
(gimple_cfg2vcg): Likewise.
(dump_function_to_file): Likewise.
* df-scan.c: Do not include tree-pass.h and timevar.h.
Include dumpfile.h.
(df_entry_block_bitmap_verify, df_exit_block_bitmap_verify): Do not
use print_current_pass.
* df-problems.c: Include dumpfile.h.
Always define REG_DEAD_DEBUGGING, avoid #ifdef code, because it
leads to errors in the code not selected.
(df_note_compute): Do not print_rtl_with_bb here. Fix compilation
bug if REG_DEAD_DEBUGGING is not 0, get_insns is not available here.
* lcm.c: Include dumpfile.h.
Remove obsolete include of insn-attr.h.
* dojump.c (do_compare_rtx_and_jump): Remove failure printing for
missing probability notes.
* stmt.c: Include dumpfile.h.
(emit_case_decision_tree): Re-enable printing expand details only
if TDF_DETAILS.
* alias.c, auto-inc-dec.c, bb-reorder.c, caller-save.c, cfg.c,
cfgcleanup.c, cfgexpand.c, cfgloop.c, cfgloopmanip.c, cgraph.c,
cgraphclones.c, cgraphunit.c, combine.c, combine-stack-adj.c,
coverage.c, cprop.c, cse.c, cselib.c, dbgcnt.c, dce.c, df-core.c,
dse.c, dwarf2out.c, emit-rtl.c, except.c, expr.c, final.c,
function.c, fwprop.c, gcse.c, gimple-fold.c,
gimple-pretty-print.c, gimple-ssa-strength-reduction.c,
gimplify.c, graphite-blocking.c, graphite-clast-to-gimple.c,
graphite-dependences.c, graphite-interchange.c,
graphite-optimize-isl.c, graphite-poly.c,
graphite-sese-to-poly.c, haifa-sched.c, hw-doloop.c, ifcvt.c,
ipa.c, ipa-cp.c, ipa-inline-analysis.c, ipa-inline.c,
ipa-inline-transform.c, ipa-prop.c, ipa-pure-const.c,
ipa-reference.c, ipa-split.c, ipa-utils.c, ira.c, ira-emit.c,
jump.c, loop-doloop.c, loop-init.c, loop-invariant.c, loop-iv.c,
loop-unroll.c, loop-unswitch.c, lower-subreg.c,
lto-section-out.c, lto-streamer-in.c, matrix-reorg.c, mcf.c,
mode-switching.c, modulo-sched.c, omega.c, omp-low.c, passes.c,
plugin.c, postreload.c, postreload-gcse.c, predict.c, print-rtl.c,
print-tree.c, profile.c, recog.c, ree.c, regcprop.c, reginfo.c,
regmove.c, regrename.c, reg-stack.c, reload1.c, reorg.c,
sched-rgn.c, sched-vis.c, sel-sched.c, sel-sched-ir.c,
store-motion.c, tracer.c, trans-mem.c, tree-affine.c,
tree-call-cdce.c, tree-cfgcleanup.c, tree-chrec.c,
tree-data-ref.c, tree-diagnostic.c, tree-dump.c,
tree-eh.c, tree-flow-inline.h, tree-if-conv.c, tree-into-ssa.c,
tree-mudflap.c, tree-nrv.c, tree-object-size.c,
tree-optimize.c, tree-outof-ssa.c, tree-predcom.c,
tree-pretty-print.c, tree-profile.c, tree-scalar-evolution.c,
tree-sra.c, tree-ssa-address.c, tree-ssa-alias.c, tree-ssa.c,
tree-ssa-ccp.c, tree-ssa-coalesce.c, tree-ssa-copy.c,
tree-ssa-copyrename.c,, tree-ssa-dce.c, tree-ssa-dom.c,
tree-ssa-dse.c, tree-ssa-forwprop.c, tree-ssa-ifcombine.c,
tree-ssa-loop.c, tree-ssa-loop-ch.c, tree-ssa-loop-im.c,
tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c,
tree-ssa-loop-manip.c, tree-ssa-loop-niter.c,
tree-ssa-loop-prefetch.c, tree-ssa-loop-unswitch.c,
tree-ssa-math-opts.c, tree-ssa-operands.c, tree-ssa-phiopt.c,
tree-ssa-phiprop.c, tree-ssa-pre.c, tree-ssa-propagate.c,
tree-ssa-reassoc.c, tree-ssa-sccvn.c, tree-ssa-sink.c,
tree-ssa-structalias.c, tree-ssa-tail-merge.c, tree-ssa-ter.c,
tree-ssa-threadedge.c, tree-ssa-threadupdate.c,
tree-ssa-uncprop.c, tree-ssa-uninit.c,
tree-switch-conversion.c, tree-tailcall.c,
tree-vect-data-refs.c, tree-vect-loop.c,
tree-vect-loop-manip.c, tree-vectorizer.c,
tree-vect-patterns.c, tree-vect-slp.c, tree-vect-stmts.c,
tree-vrp.c, value-prof.c, var-tracking.c, web.c: Include tree-pass.h
only if needed. If tree-pass.h is included, do not include timevar.h
and dumpfile.h. If tree-pass.h is not included but dump_file, or
dump_flags, or the TDF_* flags are used, include dumpfile.h.
If gimple-pretty-print.h is included, don't include tree-pretty-print.h.
Remove assorted unnecessary includes.
* config/mn10300/mn10300.c, config/c6x/c6x.c, config/ia64/ia64.c,
config/arm/arm.c, config/bfin/bfin.c, config/frv/frv.c,
config/spu/spu.c, config/mep/mep.c, config/i386/i386.c:
Include dumpfile.h.
* config/rl78/rl78.c: Include dumpfile.h instead of tree-pass.h.
* arm/t-arm, avr/t-avr, i386/t-i386, ia64/t-ia64, mep/t-mep,
spu/t-spu-elf: Fix dependencies.
c-family/
* c-gimplify.c: Include dumpfile.h instead of tree-dump.h.
* c-ada-spec.c: Likewise.
* c-dump.c (dump_stmt): Move to cp/dump.c, the only user.
c/
* c-decl.c: Include dumpfile.h instead of tree-dump.h.
* Make-lang.in: Fix dependencies.
cp/
* dump.c (dump_stmt): Moved here from c-dump.c.
* optimize.c: Include dumpfile.h instead of tree-dump.h.
* class.c: Likewise.
* decl2.c: Likewise.
* Make-lang.in: Fix dependencies.
fortran/
* f95-lang.c: Include dumpfile.h instead of tree-dump.h.
* Make-lang.in: Fix dependencies.
java/
* java-gimplify.c Include dumpfile.h instead of tree-dump.h
* Make-lang.in: Fix dependencies.
lto/
* lto.c: Do not include timevar.h.
* Make-lang.in: Fix dependencies.
ada/
* gcc-interface/utils.c: Include timevar.h.
* Make-lang.in: Fix dependencies.
From-SVN: r189519
2012-07-16 13:32:42 +02:00
|
|
|
#include "dumpfile.h"
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
#include "omega.h"
|
|
|
|
|
|
|
|
/* When set to true, keep substitution variables. When set to false,
|
|
|
|
resurrect substitution variables (convert substitutions back to EQs). */
|
|
|
|
static bool omega_reduce_with_subs = true;
|
|
|
|
|
|
|
|
/* When set to true, omega_simplify_problem checks for problem with no
|
|
|
|
solutions, calling verify_omega_pb. */
|
|
|
|
static bool omega_verify_simplification = false;
|
|
|
|
|
|
|
|
/* When set to true, only produce a single simplified result. */
|
|
|
|
static bool omega_single_result = false;
|
|
|
|
|
|
|
|
/* Set return_single_result to 1 when omega_single_result is true. */
|
|
|
|
static int return_single_result = 0;
|
|
|
|
|
|
|
|
/* Hash table for equations generated by the solver. */
|
|
|
|
#define HASH_TABLE_SIZE PARAM_VALUE (PARAM_OMEGA_HASH_TABLE_SIZE)
|
|
|
|
#define MAX_KEYS PARAM_VALUE (PARAM_OMEGA_MAX_KEYS)
|
|
|
|
static eqn hash_master;
|
|
|
|
static int next_key;
|
|
|
|
static int hash_version = 0;
|
|
|
|
|
|
|
|
/* Set to true for making the solver enter in approximation mode. */
|
|
|
|
static bool in_approximate_mode = false;
|
|
|
|
|
|
|
|
/* When set to zero, the solver is allowed to add new equalities to
|
|
|
|
the problem to be solved. */
|
|
|
|
static int conservative = 0;
|
|
|
|
|
|
|
|
/* Set to omega_true when the problem was successfully reduced, set to
|
|
|
|
omega_unknown when the solver is unable to determine an answer. */
|
|
|
|
static enum omega_result omega_found_reduction;
|
|
|
|
|
|
|
|
/* Set to true when the solver is allowed to add omega_red equations. */
|
|
|
|
static bool create_color = false;
|
|
|
|
|
|
|
|
/* Set to nonzero when the problem to be solved can be reduced. */
|
|
|
|
static int may_be_red = 0;
|
|
|
|
|
|
|
|
/* When false, there should be no substitution equations in the
|
|
|
|
simplified problem. */
|
|
|
|
static int please_no_equalities_in_simplified_problems = 0;
|
|
|
|
|
|
|
|
/* Variables names for pretty printing. */
|
|
|
|
static char wild_name[200][40];
|
|
|
|
|
|
|
|
/* Pointer to the void problem. */
|
|
|
|
static omega_pb no_problem = (omega_pb) 0;
|
|
|
|
|
|
|
|
/* Pointer to the problem to be solved. */
|
|
|
|
static omega_pb original_problem = (omega_pb) 0;
|
|
|
|
|
|
|
|
|
|
|
|
/* Return the integer A divided by B. */
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
int_div (int a, int b)
|
|
|
|
{
|
|
|
|
if (a > 0)
|
|
|
|
return a/b;
|
|
|
|
else
|
|
|
|
return -((-a + b - 1)/b);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return the integer A modulo B. */
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
int_mod (int a, int b)
|
|
|
|
{
|
|
|
|
return a - b * int_div (a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Test whether equation E is red. */
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
omega_eqn_is_red (eqn e, int desired_res)
|
|
|
|
{
|
|
|
|
return (desired_res == omega_simplify && e->color == omega_red);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return a string for VARIABLE. */
|
|
|
|
|
|
|
|
static inline char *
|
|
|
|
omega_var_to_str (int variable)
|
|
|
|
{
|
|
|
|
if (0 <= variable && variable <= 20)
|
|
|
|
return wild_name[variable];
|
|
|
|
|
|
|
|
if (-20 < variable && variable < 0)
|
|
|
|
return wild_name[40 + variable];
|
|
|
|
|
|
|
|
/* Collapse all the entries that would have overflowed. */
|
|
|
|
return wild_name[21];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return a string for variable I in problem PB. */
|
|
|
|
|
|
|
|
static inline char *
|
|
|
|
omega_variable_to_str (omega_pb pb, int i)
|
|
|
|
{
|
|
|
|
return omega_var_to_str (pb->var[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Do nothing function: used for default initializations. */
|
|
|
|
|
|
|
|
void
|
|
|
|
omega_no_procedure (omega_pb pb ATTRIBUTE_UNUSED)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void (*omega_when_reduced) (omega_pb) = omega_no_procedure;
|
|
|
|
|
|
|
|
/* Print to FILE from PB equation E with all its coefficients
|
|
|
|
multiplied by C. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
omega_print_term (FILE *file, omega_pb pb, eqn e, int c)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
bool first = true;
|
|
|
|
int n = pb->num_vars;
|
|
|
|
int went_first = -1;
|
|
|
|
|
|
|
|
for (i = 1; i <= n; i++)
|
|
|
|
if (c * e->coef[i] > 0)
|
|
|
|
{
|
|
|
|
first = false;
|
|
|
|
went_first = i;
|
|
|
|
|
|
|
|
if (c * e->coef[i] == 1)
|
|
|
|
fprintf (file, "%s", omega_variable_to_str (pb, i));
|
|
|
|
else
|
|
|
|
fprintf (file, "%d * %s", c * e->coef[i],
|
|
|
|
omega_variable_to_str (pb, i));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 1; i <= n; i++)
|
|
|
|
if (i != went_first && c * e->coef[i] != 0)
|
|
|
|
{
|
|
|
|
if (!first && c * e->coef[i] > 0)
|
|
|
|
fprintf (file, " + ");
|
|
|
|
|
|
|
|
first = false;
|
|
|
|
|
|
|
|
if (c * e->coef[i] == 1)
|
|
|
|
fprintf (file, "%s", omega_variable_to_str (pb, i));
|
|
|
|
else if (c * e->coef[i] == -1)
|
|
|
|
fprintf (file, " - %s", omega_variable_to_str (pb, i));
|
|
|
|
else
|
|
|
|
fprintf (file, "%d * %s", c * e->coef[i],
|
|
|
|
omega_variable_to_str (pb, i));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!first && c * e->coef[0] > 0)
|
|
|
|
fprintf (file, " + ");
|
|
|
|
|
|
|
|
if (first || c * e->coef[0] != 0)
|
|
|
|
fprintf (file, "%d", c * e->coef[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print to FILE the equation E of problem PB. */
|
|
|
|
|
|
|
|
void
|
|
|
|
omega_print_eqn (FILE *file, omega_pb pb, eqn e, bool test, int extra)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int n = pb->num_vars + extra;
|
|
|
|
bool is_lt = test && e->coef[0] == -1;
|
|
|
|
bool first;
|
|
|
|
|
|
|
|
if (test)
|
|
|
|
{
|
|
|
|
if (e->touched)
|
|
|
|
fprintf (file, "!");
|
|
|
|
|
|
|
|
else if (e->key != 0)
|
|
|
|
fprintf (file, "%d: ", e->key);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (e->color == omega_red)
|
|
|
|
fprintf (file, "[");
|
|
|
|
|
|
|
|
first = true;
|
|
|
|
|
|
|
|
for (i = is_lt ? 1 : 0; i <= n; i++)
|
|
|
|
if (e->coef[i] < 0)
|
|
|
|
{
|
|
|
|
if (!first)
|
|
|
|
fprintf (file, " + ");
|
|
|
|
else
|
|
|
|
first = false;
|
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
fprintf (file, "%d", -e->coef[i]);
|
|
|
|
else if (e->coef[i] == -1)
|
|
|
|
fprintf (file, "%s", omega_variable_to_str (pb, i));
|
|
|
|
else
|
|
|
|
fprintf (file, "%d * %s", -e->coef[i],
|
|
|
|
omega_variable_to_str (pb, i));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (first)
|
|
|
|
{
|
|
|
|
if (is_lt)
|
|
|
|
{
|
|
|
|
fprintf (file, "1");
|
|
|
|
is_lt = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
fprintf (file, "0");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (test == 0)
|
|
|
|
fprintf (file, " = ");
|
|
|
|
else if (is_lt)
|
|
|
|
fprintf (file, " < ");
|
|
|
|
else
|
|
|
|
fprintf (file, " <= ");
|
|
|
|
|
|
|
|
first = true;
|
|
|
|
|
|
|
|
for (i = 0; i <= n; i++)
|
|
|
|
if (e->coef[i] > 0)
|
|
|
|
{
|
|
|
|
if (!first)
|
|
|
|
fprintf (file, " + ");
|
|
|
|
else
|
|
|
|
first = false;
|
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
fprintf (file, "%d", e->coef[i]);
|
|
|
|
else if (e->coef[i] == 1)
|
|
|
|
fprintf (file, "%s", omega_variable_to_str (pb, i));
|
|
|
|
else
|
|
|
|
fprintf (file, "%d * %s", e->coef[i],
|
|
|
|
omega_variable_to_str (pb, i));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (first)
|
|
|
|
fprintf (file, "0");
|
|
|
|
|
|
|
|
if (e->color == omega_red)
|
|
|
|
fprintf (file, "]");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print to FILE all the variables of problem PB. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
omega_print_vars (FILE *file, omega_pb pb)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
fprintf (file, "variables = ");
|
|
|
|
|
|
|
|
if (pb->safe_vars > 0)
|
|
|
|
fprintf (file, "protected (");
|
|
|
|
|
|
|
|
for (i = 1; i <= pb->num_vars; i++)
|
|
|
|
{
|
|
|
|
fprintf (file, "%s", omega_variable_to_str (pb, i));
|
|
|
|
|
|
|
|
if (i == pb->safe_vars)
|
|
|
|
fprintf (file, ")");
|
|
|
|
|
|
|
|
if (i < pb->num_vars)
|
|
|
|
fprintf (file, ", ");
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf (file, "\n");
|
|
|
|
}
|
|
|
|
|
Add uniform debug dump function names.
Add some overloaded functions that provide uniform debug dump
function names. These names are:
debug: the general debug dumper
debug_verbose: for more details
debug_raw: for the gory details
debug_head: for the heads of declarations, e.g. function heads
debug_body: for the bodies of declarations, e.g. function bodies
Not all types have the last four versions.
The debug functions come in two flavors, those that take pointers
to the type, and those that take references to the type. The first
handles printing of '<nil>' for null pointers. The second assumes
a valid reference, and prints the content.
Example uses are as follows:
cp_token t, *p;
debug (t);
debug (p);
From the debugger, use
call debug (t)
The functions sets implemented are:
debug (only)
basic_block_def, const bitmap_head_def, cp_binding_level,
cp_parser, cp_token, data_reference, die_struct, edge_def,
gimple_statement_d, ira_allocno, ira_allocno_copy, live_range,
lra_live_range, omega_pb_d, pt_solution, const rtx_def, sreal,
tree_live_info_d, _var_map,
vec<cp_token, va_gc>, vec<data_reference_p>, vec<ddr_p>,
vec<rtx>, vec<tree, va_gc>,
debug and debug_raw
simple_bitmap_def
debug and debug_verbose
expr_def, struct loop, vinsn_def
debug, debug_raw, debug_verbose, debug_head, debug_body
const tree_node
This patch is somewhat different from the original plan at
gcc.gnu.org/wiki/cxx-conversion/debugging-dumps. The reason
is that gdb has an incomplete implementation of C++ call syntax;
requiring explicit specification of template arguments and explicit
specification of function arguments even when they have default
values. So, the original plan would have required typing
call dump <cp_token> (t, 0, 0, stderr)
which is undesireable. Instead instead of templates, we overload
plain functions. This adds a small burden of manually adding
the pointer version of dump for each type. Instead of default
function arguments, we simply assume the default values. Most of
the underlying dump functions did not use the options and indent
parameters anyway. Several provide FILE* parameters, but we expect
debugging to use stderr anyway. So, the explicit specification of
arguments was not as valuable as we thought initially. Finally,
a change of name from dump to debug reflect the implicit output
to stderr.
Index: gcc/ChangeLog
2013-03-28 Lawrence Crowl <crowl@google.com>
* Makefile.in: Add several missing include dependences.
(DUMPFILE_H): New.
(test-dump.o): New. This object is not added to any executable,
but is present for ad-hoc testing.
* bitmap.c
(debug (const bitmap_head_def &)): New.
(debug (const bitmap_head_def *)): New.
* bitmap.h
(extern debug (const bitmap_head_def &)): New.
(extern debug (const bitmap_head_def *)): New.
* cfg.c
(debug (edge_def &)): New.
(debug (edge_def *)): New.
* cfghooks.c
(debug (basic_block_def &)): New.
(debug (basic_block_def *)): New.
* dumpfile.h
(dump_node (const_tree, int, FILE *)): Correct source file.
* dwarf2out.c
(debug (die_struct &)): New.
(debug (die_struct *)): New.
* dwarf2out.h
(extern debug (die_struct &)): New.
(extern debug (die_struct *)): New.
* gimple-pretty-print.c
(debug (gimple_statement_d &)): New.
(debug (gimple_statement_d *)): New.
* gimple-pretty-print.h
(extern debug (gimple_statement_d &)): New.
(extern debug (gimple_statement_d *)): New.
* ira-build.c
(debug (ira_allocno_copy &)): New.
(debug (ira_allocno_copy *)): New.
(debug (ira_allocno &)): New.
(debug (ira_allocno *)): New.
* ira-int.h
(extern debug (ira_allocno_copy &)): New.
(extern debug (ira_allocno_copy *)): New.
(extern debug (ira_allocno &)): New.
(extern debug (ira_allocno *)): New.
* ira-lives.c
(debug (live_range &)): New.
(debug (live_range *)): New.
* lra-int.h
(debug (lra_live_range &)): New.
(debug (lra_live_range *)): New.
* lra-lives.c
(debug (lra_live_range &)): New.
(debug (lra_live_range *)): New.
* omega.c
(debug (omega_pb_d &)): New.
(debug (omega_pb_d *)): New.
* omega.h
(extern debug (omega_pb_d &)): New.
(extern debug (omega_pb_d *)): New.
* print-rtl.c
(debug (const rtx_def &)): New.
(debug (const rtx_def *)): New.
* print-tree.c
(debug_tree (tree): Move within file.
(debug_raw (const tree_node &)): New.
(debug_raw (const tree_node *)): New.
(dump_tree_via_hooks (const tree_node *, int)): New.
(debug (const tree_node &)): New.
(debug (const tree_node *)): New.
(debug_verbose (const tree_node &)): New.
(debug_verbose (const tree_node *)): New.
(debug_head (const tree_node &)): New.
(debug_head (const tree_node *)): New.
(debug_body (const tree_node &)): New.
(debug_body (const tree_node *)): New.
(debug_vec_tree (tree): Move and reimplement in terms of dump.
(debug (vec<tree, va_gc> &)): New.
(debug (vec<tree, va_gc> *)): New.
* rtl.h
(extern debug (const rtx_def &)): New.
(extern debug (const rtx_def *)): New.
* sbitmap.c
(debug_raw (simple_bitmap_def &)): New.
(debug_raw (simple_bitmap_def *)): New.
(debug (simple_bitmap_def &)): New.
(debug (simple_bitmap_def *)): New.
* sbitmap.h
(extern debug (simple_bitmap_def &)): New.
(extern debug (simple_bitmap_def *)): New.
(extern debug_raw (simple_bitmap_def &)): New.
(extern debug_raw (simple_bitmap_def *)): New.
* sel-sched-dump.c
(debug (vinsn_def &)): New.
(debug (vinsn_def *)): New.
(debug_verbose (vinsn_def &)): New.
(debug_verbose (vinsn_def *)): New.
(debug (expr_def &)): New.
(debug (expr_def *)): New.
(debug_verbose (expr_def &)): New.
(debug_verbose (expr_def *)): New.
(debug (vec<rtx> &)): New.
(debug (vec<rtx> *)): New.
* sel-sched-dump.h
(extern debug (vinsn_def &)): New.
(extern debug (vinsn_def *)): New.
(extern debug_verbose (vinsn_def &)): New.
(extern debug_verbose (vinsn_def *)): New.
(extern debug (expr_def &)): New.
(extern debug (expr_def *)): New.
(extern debug_verbose (expr_def &)): New.
(extern debug_verbose (expr_def *)): New.
(extern debug (vec<rtx> &)): New.
(extern debug (vec<rtx> *)): New.
* sel-sched-ir.h
(_list_iter_cond_expr): Make inline instead of static.
* sreal.c
(debug (sreal &)): New.
(debug (sreal *)): New.
* sreal.h
(extern debug (sreal &)): New.
(extern debug (sreal *)): New.
* tree.h
(extern debug_raw (const tree_node &)): New.
(extern debug_raw (const tree_node *)): New.
(extern debug (const tree_node &)): New.
(extern debug (const tree_node *)): New.
(extern debug_verbose (const tree_node &)): New.
(extern debug_verbose (const tree_node *)): New.
(extern debug_head (const tree_node &)): New.
(extern debug_head (const tree_node *)): New.
(extern debug_body (const tree_node &)): New.
(extern debug_body (const tree_node *)): New.
(extern debug (vec<tree, va_gc> &)): New.
(extern debug (vec<tree, va_gc> *)): New.
* tree-cfg.c
(debug (struct loop &)): New.
(debug (struct loop *)): New.
(debug_verbose (struct loop &)): New.
(debug_verbose (struct loop *)): New.
* tree-dump.c: Add header dependence.
* tree-flow.h
(extern debug (struct loop &)): New.
(extern debug (struct loop *)): New.
(extern debug_verbose (struct loop &)): New.
(extern debug_verbose (struct loop *)): New.
* tree-data-ref.c
(debug (data_reference &)): New.
(debug (data_reference *)): New.
(debug (vec<data_reference_p> &)): New.
(debug (vec<data_reference_p> *)): New.
(debug (vec<ddr_p> &)): New.
(debug (vec<ddr_p> *)): New.
* tree-data-ref.h
(extern debug (data_reference &)): New.
(extern debug (data_reference *)): New.
(extern debug (vec<data_reference_p> &)): New.
(extern debug (vec<data_reference_p> *)): New.
(extern debug (vec<ddr_p> &)): New.
(extern debug (vec<ddr_p> *)): New.
* tree-ssa-alias.c
(debug (pt_solution &)): New.
(debug (pt_solution *)): New.
* tree-ssa-alias.h
(extern debug (pt_solution &)): New.
(extern debug (pt_solution *)): New.
* tree-ssa-alias.c
(debug (_var_map &)): New.
(debug (_var_map *)): New.
(debug (tree_live_info_d &)): New.
(debug (tree_live_info_d *)): New.
* tree-ssa-alias.h
(extern debug (_var_map &)): New.
(extern debug (_var_map *)): New.
(extern debug (tree_live_info_d &)): New.
(extern debug (tree_live_info_d *)): New.
Index: gcc/cp/ChangeLog
2013-03-28 Lawrence Crowl <crowl@google.com>
* Make-lang.in
(CXX_PARSER_H): Add header dependence.
* cp-tree.h
(extern debug (cp_binding_level &)): New.
(extern debug (cp_binding_level *)): New.
* name-lookup.h
(debug (cp_binding_level &)): New.
(debug (cp_binding_level *)): New.
* parser.c
(debug (cp_parser &)): New.
(debug (cp_parser *)): New.
(debug (cp_token &)): New.
(debug (cp_token *)): New.
(debug (vec<cp_token, va_gc> &)): New.
(debug (vec<cp_token, va_gc> *)): New.
* parser.c: Add header dependence.
(extern debug (cp_parser &)): New.
(extern debug (cp_parser *)): New.
(extern debug (cp_token &)): New.
(extern debug (cp_token *)): New.
(extern debug (vec<cp_token, va_gc> &)): New.
(extern debug (vec<cp_token, va_gc> *)): New.
From-SVN: r197224
2013-03-29 04:42:21 +01:00
|
|
|
/* Dump problem PB. */
|
|
|
|
|
|
|
|
DEBUG_FUNCTION void
|
|
|
|
debug (omega_pb_d &ref)
|
|
|
|
{
|
|
|
|
omega_print_problem (stderr, &ref);
|
|
|
|
}
|
|
|
|
|
|
|
|
DEBUG_FUNCTION void
|
|
|
|
debug (omega_pb_d *ptr)
|
|
|
|
{
|
|
|
|
if (ptr)
|
|
|
|
debug (*ptr);
|
|
|
|
else
|
|
|
|
fprintf (stderr, "<nil>\n");
|
|
|
|
}
|
|
|
|
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
/* Debug problem PB. */
|
|
|
|
|
tree-vrp.c (debug_value_range, [...]): Annotate with DEBUG_FUNCTION.
* tree-vrp.c (debug_value_range, debug_all_value_ranges,
debug_asserts_for, debug_all_asserts): Annotate with DEBUG_FUNCTION.
* tree-into-ssa.c (debug_decl_set, debug_defs_stack, debug_currdefs,
debug_tree_ssa, debug_tree_ssa_stats, debug_def_blocks,
debug_names_replaced_by, debug_update_ssa): Likewise.
* sbitmap.c (debug_sbitmap): Likewise.
* genrecog.c (debug_decision, debug_decision_list): Likewise.
* tree-pretty-print.c (debug_generic_expr, debug_generic_stmt,
debug_tree_chain): Likewise.
* tree-loop-distribution.c (debug_rdg_partitions): Likewise.
* cgraph.c (debug_cgraph_node, debug_cgraph): Likewise.
* optabs.c (debug_optab_libfuncs): Likewise.
(verify_loop_closed_ssa): Likewise.
* value-prof.c (verify_histograms): Likewise.
* reload.c (debug_reload_to_stream, debug_reload): Likewise.
* bitmap.c (debug_bitmap_file, debug_bitmap, bitmap_print): Likewise.
* cfghooks.c (verify_flow_info): Likewise.
* fold-const.c (debug_fold_checksum): Likewise.
* omp-low.c (debug_omp_region, debug_all_omp_regions): Likewise.
* cfg.c (debug_regset, debug_flow_info, debug_bb, debug_bb_n):
Likewise.
* omega.c (debug_omega_problem): Likewise.
* cgraphunit.c (verify_cgraph_node, verify_cgraph): Likewise.
* tree-ssa-ccp.c (debug_lattice_value): Likewise.
* dominance.c (verify_dominators, debug_dominance_info,
debug_dominance_tree): Likewise.
* df-core.c (df_insn_uid_debug, df_insn_debug, df_insn_debug_regno,
* df_regno_debug, df_ref_debug,
debug_df_insn, debug_df_reg, debug_df_regno, debug_df_ref,
debug_df_defno, debug_df_useno, debug_df_chain): Likewise.
* tree-ssa-dom.c (debug_dominator_optimization_stats): Likewise.
* sel-sched.c (debug_state): Likewise.
* tree-ssa-alias.c (debug_alias_info, debug_points_to_info_for): Likewise.
* cfganal.c (print_edge_list, verify_edge_list): Likewise.
* dwarf2out.c (debug_dwarf_die, debug_dwarf): Likewise.
* tree-eh.c (verify_eh_edges, verify_eh_dispatch_edge): Likewise.
* gimple-pretty-print.c (debug_gimple_stmt, debug_gimple_seq): Likewise.
* c-pretty-print.c (debug_c_tree): Likewise.
* sel-sched-dump.c (debug_insn_rtx, debug_vinsn, debug_expr, debug_insn
debug_av_set, debug_lv_set, debug_ilist, debug_blist, debug_insn_vector,
debug_hard_reg_set, debug_mem_addr_value): Likewise.
* ebitmap.c (debug_ebitmap): Likewise.
* function.c (debug_find_var_in_block_tree): Likewise.
* print-rtl.c (debug_rtx): Likewise.
(debug_rtx_count): Likewise.
(debug_rtx_list, debug_rtx_range, debug_rtx_find): Likewise.
* stor-layout.c (debug_rli): Likewise.
* ipa.c (debug_cgraph_node_set, debug_varpool_node_set): Likewise.
* tree-data-ref.c (debug_data_references, debug_data_dependence_relations,
debug_data_reference, debug_data_dependence_relation, debug_rdg_vertex,
debug_rdg_component, debug_rdg): Likewise.
* tree-affine.c (debug_aff): Likewise.
* tree-dfa.c (debug_referenced_vars, debug_variable, debug_dfa_stats): Likewise.
* except.c (debug_eh_tree, verify_eh_tree): Likewise.
* emit-rtl.c (verify_rtl_sharing): Likewise.
* tree-ssa-pre.c (debug_pre_expr, debug_bitmap_set,
debug_value_expressions): Likewise.
* tree-ssa-live.c (debug_scope_block, debug_scope_blocks): Likewise.
* sese.c (debug_rename_map, debug_ivtype_map): Likewise.
* print-tree.c (debug_tree, debug_vec_tree): Likewise.
* cfglayout.c (verify_insn_chain): Likewise.
* graphite-clast-to-gimple.c (debug_clast_name_indexes,
debug_clast_stmt, debug_generated_program): Likewise.
* ggc-page.c (debug_print_page_list): Likewise.
* tree-ssa-ter.c (debug_ter): Likewise.
* graphite-dependences.c (debug_pddr): Likewise.
* sched-deps.c (debug_ds): Likewise.
* tree-ssa.c (verify_ssa): Likewise.
* graphite-poly.c (debug_scattering_function, debug_iteration_domain,
debug_scattering_functions, debug_iteration_domains, debug_pdr,
debug_pdrs, debug_pbb_domain, debug_pbb, debug_scop_context, debug_scop,
debug_cloog, debug_scop_params, debug_lst): Likewise.
* tree-inline.c (debug_find_tree): Likewise.
* graphite-ppl.c (debug_ppl_linear_expr, debug_ppl_polyhedron_matrix,
debug_ppl_powerset_matrix): Likewise.
* var-tracking.c (debug_dv): Likewise.
* system.h (DEBUG_FUNCTION, DEBUG_VARIABLE): Define.
* cfgloop.c (verify_loop_structure): Likewise.
* plugin.c (dump_active_plugins, debug_active_plugins): Likewise.
* c-common.c (verify_sequence_points): Likewise.
* sched-rgn.c (debug_regions, debug_region, debug_candidate,
debug_candidates, debug_rgn_dependencies): Likewise.
* tree-ssa-structalias.c (debug_constraint, debug_constraints,
* debug_constraint_graph, debug_solution_for_var,
debug_sa_points_to_info): Likewise.
* sched-vis.c (debug_insn_slim, debug_bb_slim, debug_bb_n_slim):
Likewie.
* tree-cfg.c (debug_cfg_stats, verify_stmts, debug_function,
debug_loops, debug_loop, debug_loop_num): Likewise.
* passes.c (debug_pass): Likewise.
(dump_properties): Likewise; add cfglayout property.
(debug_properties): Likewise.
* tree-ssa-reassoc.c (debug_ops_vector): Likewise.
* varpool.c (debug_varpool): Likewise.
* regcprop.c (debug_value_data): Likewise.
* tree-ssa-operands.c (verify_imm_links, debug_immediate_uses,
debug_immediate_uses_for): Likewise.
From-SVN: r160036
2010-05-29 22:31:45 +02:00
|
|
|
DEBUG_FUNCTION void
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
debug_omega_problem (omega_pb pb)
|
|
|
|
{
|
|
|
|
omega_print_problem (stderr, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print to FILE problem PB. */
|
|
|
|
|
|
|
|
void
|
|
|
|
omega_print_problem (FILE *file, omega_pb pb)
|
|
|
|
{
|
|
|
|
int e;
|
|
|
|
|
|
|
|
if (!pb->variables_initialized)
|
|
|
|
omega_initialize_variables (pb);
|
|
|
|
|
|
|
|
omega_print_vars (file, pb);
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_eqs; e++)
|
|
|
|
{
|
|
|
|
omega_print_eq (file, pb, &pb->eqs[e]);
|
|
|
|
fprintf (file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf (file, "Done with EQ\n");
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_geqs; e++)
|
|
|
|
{
|
|
|
|
omega_print_geq (file, pb, &pb->geqs[e]);
|
|
|
|
fprintf (file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf (file, "Done with GEQ\n");
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_subs; e++)
|
|
|
|
{
|
|
|
|
eqn eq = &pb->subs[e];
|
|
|
|
|
|
|
|
if (eq->color == omega_red)
|
|
|
|
fprintf (file, "[");
|
|
|
|
|
|
|
|
if (eq->key > 0)
|
|
|
|
fprintf (file, "%s := ", omega_var_to_str (eq->key));
|
|
|
|
else
|
|
|
|
fprintf (file, "#%d := ", eq->key);
|
|
|
|
|
|
|
|
omega_print_term (file, pb, eq, 1);
|
|
|
|
|
|
|
|
if (eq->color == omega_red)
|
|
|
|
fprintf (file, "]");
|
|
|
|
|
|
|
|
fprintf (file, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return the number of equations in PB tagged omega_red. */
|
|
|
|
|
|
|
|
int
|
|
|
|
omega_count_red_equations (omega_pb pb)
|
|
|
|
{
|
|
|
|
int e, i;
|
|
|
|
int result = 0;
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_eqs; e++)
|
|
|
|
if (pb->eqs[e].color == omega_red)
|
|
|
|
{
|
|
|
|
for (i = pb->num_vars; i > 0; i--)
|
|
|
|
if (pb->geqs[e].coef[i])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (i == 0 && pb->geqs[e].coef[0] == 1)
|
|
|
|
return 0;
|
|
|
|
else
|
|
|
|
result += 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_geqs; e++)
|
|
|
|
if (pb->geqs[e].color == omega_red)
|
|
|
|
result += 1;
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_subs; e++)
|
|
|
|
if (pb->subs[e].color == omega_red)
|
|
|
|
result += 2;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print to FILE all the equations in PB that are tagged omega_red. */
|
|
|
|
|
|
|
|
void
|
|
|
|
omega_print_red_equations (FILE *file, omega_pb pb)
|
|
|
|
{
|
|
|
|
int e;
|
|
|
|
|
|
|
|
if (!pb->variables_initialized)
|
|
|
|
omega_initialize_variables (pb);
|
|
|
|
|
|
|
|
omega_print_vars (file, pb);
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_eqs; e++)
|
|
|
|
if (pb->eqs[e].color == omega_red)
|
|
|
|
{
|
|
|
|
omega_print_eq (file, pb, &pb->eqs[e]);
|
|
|
|
fprintf (file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_geqs; e++)
|
|
|
|
if (pb->geqs[e].color == omega_red)
|
|
|
|
{
|
|
|
|
omega_print_geq (file, pb, &pb->geqs[e]);
|
|
|
|
fprintf (file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_subs; e++)
|
|
|
|
if (pb->subs[e].color == omega_red)
|
|
|
|
{
|
|
|
|
eqn eq = &pb->subs[e];
|
|
|
|
fprintf (file, "[");
|
|
|
|
|
|
|
|
if (eq->key > 0)
|
|
|
|
fprintf (file, "%s := ", omega_var_to_str (eq->key));
|
|
|
|
else
|
|
|
|
fprintf (file, "#%d := ", eq->key);
|
|
|
|
|
|
|
|
omega_print_term (file, pb, eq, 1);
|
|
|
|
fprintf (file, "]\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Pretty print PB to FILE. */
|
|
|
|
|
|
|
|
void
|
|
|
|
omega_pretty_print_problem (FILE *file, omega_pb pb)
|
|
|
|
{
|
|
|
|
int e, v, v1, v2, v3, t;
|
|
|
|
bool *live = XNEWVEC (bool, OMEGA_MAX_GEQS);
|
|
|
|
int stuffPrinted = 0;
|
|
|
|
bool change;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
none, le, lt
|
|
|
|
} partial_order_type;
|
|
|
|
|
2009-11-25 11:55:54 +01:00
|
|
|
partial_order_type **po = XNEWVEC (partial_order_type *,
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
OMEGA_MAX_VARS * OMEGA_MAX_VARS);
|
|
|
|
int **po_eq = XNEWVEC (int *, OMEGA_MAX_VARS * OMEGA_MAX_VARS);
|
|
|
|
int *last_links = XNEWVEC (int, OMEGA_MAX_VARS);
|
|
|
|
int *first_links = XNEWVEC (int, OMEGA_MAX_VARS);
|
|
|
|
int *chain_length = XNEWVEC (int, OMEGA_MAX_VARS);
|
|
|
|
int *chain = XNEWVEC (int, OMEGA_MAX_VARS);
|
|
|
|
int i, m;
|
|
|
|
bool multiprint;
|
|
|
|
|
|
|
|
if (!pb->variables_initialized)
|
|
|
|
omega_initialize_variables (pb);
|
|
|
|
|
|
|
|
if (pb->num_vars > 0)
|
|
|
|
{
|
|
|
|
omega_eliminate_redundant (pb, false);
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_eqs; e++)
|
|
|
|
{
|
|
|
|
if (stuffPrinted)
|
|
|
|
fprintf (file, "; ");
|
|
|
|
|
|
|
|
stuffPrinted = 1;
|
|
|
|
omega_print_eq (file, pb, &pb->eqs[e]);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_geqs; e++)
|
|
|
|
live[e] = true;
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
for (v = 1; v <= pb->num_vars; v++)
|
|
|
|
{
|
|
|
|
last_links[v] = first_links[v] = 0;
|
|
|
|
chain_length[v] = 0;
|
|
|
|
|
|
|
|
for (v2 = 1; v2 <= pb->num_vars; v2++)
|
|
|
|
po[v][v2] = none;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_geqs; e++)
|
|
|
|
if (live[e])
|
|
|
|
{
|
|
|
|
for (v = 1; v <= pb->num_vars; v++)
|
|
|
|
if (pb->geqs[e].coef[v] == 1)
|
|
|
|
first_links[v]++;
|
|
|
|
else if (pb->geqs[e].coef[v] == -1)
|
|
|
|
last_links[v]++;
|
|
|
|
|
|
|
|
v1 = pb->num_vars;
|
|
|
|
|
|
|
|
while (v1 > 0 && pb->geqs[e].coef[v1] == 0)
|
|
|
|
v1--;
|
|
|
|
|
|
|
|
v2 = v1 - 1;
|
|
|
|
|
|
|
|
while (v2 > 0 && pb->geqs[e].coef[v2] == 0)
|
|
|
|
v2--;
|
|
|
|
|
|
|
|
v3 = v2 - 1;
|
|
|
|
|
|
|
|
while (v3 > 0 && pb->geqs[e].coef[v3] == 0)
|
|
|
|
v3--;
|
|
|
|
|
|
|
|
if (pb->geqs[e].coef[0] > 0 || pb->geqs[e].coef[0] < -1
|
|
|
|
|| v2 <= 0 || v3 > 0
|
|
|
|
|| pb->geqs[e].coef[v1] * pb->geqs[e].coef[v2] != -1)
|
|
|
|
{
|
|
|
|
/* Not a partial order relation. */
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pb->geqs[e].coef[v1] == 1)
|
|
|
|
{
|
|
|
|
v3 = v2;
|
|
|
|
v2 = v1;
|
|
|
|
v1 = v3;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Relation is v1 <= v2 or v1 < v2. */
|
|
|
|
po[v1][v2] = ((pb->geqs[e].coef[0] == 0) ? le : lt);
|
|
|
|
po_eq[v1][v2] = e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (v = 1; v <= pb->num_vars; v++)
|
|
|
|
chain_length[v] = last_links[v];
|
|
|
|
|
|
|
|
/* Just in case pb->num_vars <= 0. */
|
|
|
|
change = false;
|
|
|
|
for (t = 0; t < pb->num_vars; t++)
|
|
|
|
{
|
|
|
|
change = false;
|
|
|
|
|
|
|
|
for (v1 = 1; v1 <= pb->num_vars; v1++)
|
|
|
|
for (v2 = 1; v2 <= pb->num_vars; v2++)
|
|
|
|
if (po[v1][v2] != none &&
|
|
|
|
chain_length[v1] <= chain_length[v2])
|
|
|
|
{
|
|
|
|
chain_length[v1] = chain_length[v2] + 1;
|
|
|
|
change = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Caught in cycle. */
|
|
|
|
gcc_assert (!change);
|
|
|
|
|
|
|
|
for (v1 = 1; v1 <= pb->num_vars; v1++)
|
|
|
|
if (chain_length[v1] == 0)
|
|
|
|
first_links[v1] = 0;
|
|
|
|
|
|
|
|
v = 1;
|
|
|
|
|
|
|
|
for (v1 = 2; v1 <= pb->num_vars; v1++)
|
|
|
|
if (chain_length[v1] + first_links[v1] >
|
|
|
|
chain_length[v] + first_links[v])
|
|
|
|
v = v1;
|
|
|
|
|
|
|
|
if (chain_length[v] + first_links[v] == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (stuffPrinted)
|
|
|
|
fprintf (file, "; ");
|
|
|
|
|
|
|
|
stuffPrinted = 1;
|
|
|
|
|
|
|
|
/* Chain starts at v. */
|
|
|
|
{
|
|
|
|
int tmp;
|
|
|
|
bool first = true;
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_geqs; e++)
|
|
|
|
if (live[e] && pb->geqs[e].coef[v] == 1)
|
|
|
|
{
|
|
|
|
if (!first)
|
|
|
|
fprintf (file, ", ");
|
|
|
|
|
|
|
|
tmp = pb->geqs[e].coef[v];
|
|
|
|
pb->geqs[e].coef[v] = 0;
|
|
|
|
omega_print_term (file, pb, &pb->geqs[e], -1);
|
|
|
|
pb->geqs[e].coef[v] = tmp;
|
|
|
|
live[e] = false;
|
|
|
|
first = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!first)
|
|
|
|
fprintf (file, " <= ");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find chain. */
|
|
|
|
chain[0] = v;
|
|
|
|
m = 1;
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
/* Print chain. */
|
|
|
|
for (v2 = 1; v2 <= pb->num_vars; v2++)
|
|
|
|
if (po[v][v2] && chain_length[v] == 1 + chain_length[v2])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (v2 > pb->num_vars)
|
|
|
|
break;
|
|
|
|
|
|
|
|
chain[m++] = v2;
|
|
|
|
v = v2;
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf (file, "%s", omega_variable_to_str (pb, chain[0]));
|
2009-11-25 11:55:54 +01:00
|
|
|
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
for (multiprint = false, i = 1; i < m; i++)
|
|
|
|
{
|
|
|
|
v = chain[i - 1];
|
|
|
|
v2 = chain[i];
|
|
|
|
|
|
|
|
if (po[v][v2] == le)
|
|
|
|
fprintf (file, " <= ");
|
|
|
|
else
|
|
|
|
fprintf (file, " < ");
|
|
|
|
|
|
|
|
fprintf (file, "%s", omega_variable_to_str (pb, v2));
|
|
|
|
live[po_eq[v][v2]] = false;
|
|
|
|
|
|
|
|
if (!multiprint && i < m - 1)
|
|
|
|
for (v3 = 1; v3 <= pb->num_vars; v3++)
|
|
|
|
{
|
|
|
|
if (v == v3 || v2 == v3
|
|
|
|
|| po[v][v2] != po[v][v3]
|
|
|
|
|| po[v2][chain[i + 1]] != po[v3][chain[i + 1]])
|
|
|
|
continue;
|
|
|
|
|
|
|
|
fprintf (file, ",%s", omega_variable_to_str (pb, v3));
|
|
|
|
live[po_eq[v][v3]] = false;
|
|
|
|
live[po_eq[v3][chain[i + 1]]] = false;
|
|
|
|
multiprint = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
multiprint = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
v = chain[m - 1];
|
|
|
|
/* Print last_links. */
|
|
|
|
{
|
|
|
|
int tmp;
|
|
|
|
bool first = true;
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_geqs; e++)
|
|
|
|
if (live[e] && pb->geqs[e].coef[v] == -1)
|
|
|
|
{
|
|
|
|
if (!first)
|
|
|
|
fprintf (file, ", ");
|
|
|
|
else
|
|
|
|
fprintf (file, " <= ");
|
|
|
|
|
|
|
|
tmp = pb->geqs[e].coef[v];
|
|
|
|
pb->geqs[e].coef[v] = 0;
|
|
|
|
omega_print_term (file, pb, &pb->geqs[e], 1);
|
|
|
|
pb->geqs[e].coef[v] = tmp;
|
|
|
|
live[e] = false;
|
|
|
|
first = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_geqs; e++)
|
|
|
|
if (live[e])
|
|
|
|
{
|
|
|
|
if (stuffPrinted)
|
|
|
|
fprintf (file, "; ");
|
|
|
|
stuffPrinted = 1;
|
|
|
|
omega_print_geq (file, pb, &pb->geqs[e]);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_subs; e++)
|
|
|
|
{
|
|
|
|
eqn eq = &pb->subs[e];
|
|
|
|
|
|
|
|
if (stuffPrinted)
|
|
|
|
fprintf (file, "; ");
|
|
|
|
|
|
|
|
stuffPrinted = 1;
|
|
|
|
|
|
|
|
if (eq->key > 0)
|
|
|
|
fprintf (file, "%s := ", omega_var_to_str (eq->key));
|
|
|
|
else
|
|
|
|
fprintf (file, "#%d := ", eq->key);
|
|
|
|
|
|
|
|
omega_print_term (file, pb, eq, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
free (live);
|
|
|
|
free (po);
|
|
|
|
free (po_eq);
|
|
|
|
free (last_links);
|
|
|
|
free (first_links);
|
|
|
|
free (chain_length);
|
|
|
|
free (chain);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Assign to variable I in PB the next wildcard name. The name of a
|
|
|
|
wildcard is a negative number. */
|
|
|
|
static int next_wild_card = 0;
|
|
|
|
|
|
|
|
static void
|
|
|
|
omega_name_wild_card (omega_pb pb, int i)
|
|
|
|
{
|
|
|
|
--next_wild_card;
|
|
|
|
if (next_wild_card < -PARAM_VALUE (PARAM_OMEGA_MAX_WILD_CARDS))
|
|
|
|
next_wild_card = -1;
|
|
|
|
pb->var[i] = next_wild_card;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return the index of the last protected (or safe) variable in PB,
|
|
|
|
after having added a new wildcard variable. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
omega_add_new_wild_card (omega_pb pb)
|
|
|
|
{
|
|
|
|
int e;
|
|
|
|
int i = ++pb->safe_vars;
|
|
|
|
pb->num_vars++;
|
|
|
|
|
|
|
|
/* Make a free place in the protected (safe) variables, by moving
|
|
|
|
the non protected variable pointed by "I" at the end, ie. at
|
|
|
|
offset pb->num_vars. */
|
|
|
|
if (pb->num_vars != i)
|
|
|
|
{
|
|
|
|
/* Move "I" for all the inequalities. */
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
if (pb->geqs[e].coef[i])
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
|
|
|
|
pb->geqs[e].coef[pb->num_vars] = pb->geqs[e].coef[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Move "I" for all the equalities. */
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
pb->eqs[e].coef[pb->num_vars] = pb->eqs[e].coef[i];
|
|
|
|
|
|
|
|
/* Move "I" for all the substitutions. */
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
pb->subs[e].coef[pb->num_vars] = pb->subs[e].coef[i];
|
|
|
|
|
|
|
|
/* Move the identifier. */
|
|
|
|
pb->var[pb->num_vars] = pb->var[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize at zero all the coefficients */
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
pb->geqs[e].coef[i] = 0;
|
|
|
|
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
pb->eqs[e].coef[i] = 0;
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
pb->subs[e].coef[i] = 0;
|
|
|
|
|
|
|
|
/* And give it a name. */
|
|
|
|
omega_name_wild_card (pb, i);
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Delete inequality E from problem PB that has N_VARS variables. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
omega_delete_geq (omega_pb pb, int e, int n_vars)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Deleting %d (last:%d): ", e, pb->num_geqs - 1);
|
|
|
|
omega_print_geq (dump_file, pb, &pb->geqs[e]);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (e < pb->num_geqs - 1)
|
|
|
|
omega_copy_eqn (&pb->geqs[e], &pb->geqs[pb->num_geqs - 1], n_vars);
|
|
|
|
|
|
|
|
pb->num_geqs--;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Delete extra inequality E from problem PB that has N_VARS
|
|
|
|
variables. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
omega_delete_geq_extra (omega_pb pb, int e, int n_vars)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Deleting %d: ",e);
|
|
|
|
omega_print_geq_extra (dump_file, pb, &pb->geqs[e]);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (e < pb->num_geqs - 1)
|
|
|
|
omega_copy_eqn (&pb->geqs[e], &pb->geqs[pb->num_geqs - 1], n_vars);
|
|
|
|
|
|
|
|
pb->num_geqs--;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Remove variable I from problem PB. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
omega_delete_variable (omega_pb pb, int i)
|
|
|
|
{
|
|
|
|
int n_vars = pb->num_vars;
|
|
|
|
int e;
|
|
|
|
|
|
|
|
if (omega_safe_var_p (pb, i))
|
|
|
|
{
|
|
|
|
int j = pb->safe_vars;
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
pb->geqs[e].coef[i] = pb->geqs[e].coef[j];
|
|
|
|
pb->geqs[e].coef[j] = pb->geqs[e].coef[n_vars];
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
pb->eqs[e].coef[i] = pb->eqs[e].coef[j];
|
|
|
|
pb->eqs[e].coef[j] = pb->eqs[e].coef[n_vars];
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
pb->subs[e].coef[i] = pb->subs[e].coef[j];
|
|
|
|
pb->subs[e].coef[j] = pb->subs[e].coef[n_vars];
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->var[i] = pb->var[j];
|
|
|
|
pb->var[j] = pb->var[n_vars];
|
|
|
|
}
|
|
|
|
else if (i < n_vars)
|
|
|
|
{
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].coef[n_vars])
|
|
|
|
{
|
|
|
|
pb->geqs[e].coef[i] = pb->geqs[e].coef[n_vars];
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
pb->eqs[e].coef[i] = pb->eqs[e].coef[n_vars];
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
pb->subs[e].coef[i] = pb->subs[e].coef[n_vars];
|
|
|
|
|
|
|
|
pb->var[i] = pb->var[n_vars];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (omega_safe_var_p (pb, i))
|
|
|
|
pb->safe_vars--;
|
|
|
|
|
|
|
|
pb->num_vars--;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Because the coefficients of an equation are sparse, PACKING records
|
|
|
|
indices for non null coefficients. */
|
|
|
|
static int *packing;
|
|
|
|
|
|
|
|
/* Set up the coefficients of PACKING, following the coefficients of
|
|
|
|
equation EQN that has NUM_VARS variables. */
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
setup_packing (eqn eqn, int num_vars)
|
|
|
|
{
|
|
|
|
int k;
|
|
|
|
int n = 0;
|
|
|
|
|
|
|
|
for (k = num_vars; k >= 0; k--)
|
|
|
|
if (eqn->coef[k])
|
|
|
|
packing[n++] = k;
|
|
|
|
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Computes a linear combination of EQ and SUB at VAR with coefficient
|
|
|
|
C, such that EQ->coef[VAR] is set to 0. TOP_VAR is the number of
|
|
|
|
non null indices of SUB stored in PACKING. */
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
omega_substitute_red_1 (eqn eq, eqn sub, int var, int c, bool *found_black,
|
|
|
|
int top_var)
|
|
|
|
{
|
|
|
|
if (eq->coef[var] != 0)
|
|
|
|
{
|
|
|
|
if (eq->color == omega_black)
|
|
|
|
*found_black = true;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int j, k = eq->coef[var];
|
|
|
|
|
|
|
|
eq->coef[var] = 0;
|
|
|
|
|
|
|
|
for (j = top_var; j >= 0; j--)
|
|
|
|
eq->coef[packing[j]] -= sub->coef[packing[j]] * k * c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Substitute in PB variable VAR with "C * SUB". */
|
|
|
|
|
|
|
|
static void
|
|
|
|
omega_substitute_red (omega_pb pb, eqn sub, int var, int c, bool *found_black)
|
|
|
|
{
|
|
|
|
int e, top_var = setup_packing (sub, pb->num_vars);
|
|
|
|
|
|
|
|
*found_black = false;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
if (sub->color == omega_red)
|
|
|
|
fprintf (dump_file, "[");
|
|
|
|
|
|
|
|
fprintf (dump_file, "substituting using %s := ",
|
|
|
|
omega_variable_to_str (pb, var));
|
|
|
|
omega_print_term (dump_file, pb, sub, -c);
|
|
|
|
|
|
|
|
if (sub->color == omega_red)
|
|
|
|
fprintf (dump_file, "]");
|
|
|
|
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_vars (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
eqn eqn = &(pb->eqs[e]);
|
|
|
|
|
|
|
|
omega_substitute_red_1 (eqn, sub, var, c, found_black, top_var);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
omega_print_eq (dump_file, pb, eqn);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
eqn eqn = &(pb->geqs[e]);
|
|
|
|
|
|
|
|
omega_substitute_red_1 (eqn, sub, var, c, found_black, top_var);
|
|
|
|
|
|
|
|
if (eqn->coef[var] && eqn->color == omega_red)
|
|
|
|
eqn->touched = 1;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
omega_print_geq (dump_file, pb, eqn);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
eqn eqn = &(pb->subs[e]);
|
|
|
|
|
|
|
|
omega_substitute_red_1 (eqn, sub, var, c, found_black, top_var);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "%s := ", omega_var_to_str (eqn->key));
|
|
|
|
omega_print_term (dump_file, pb, eqn, 1);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "---\n\n");
|
|
|
|
|
|
|
|
if (omega_safe_var_p (pb, var) && !omega_wildcard_p (pb, var))
|
|
|
|
*found_black = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Substitute in PB variable VAR with "C * SUB". */
|
|
|
|
|
|
|
|
static void
|
|
|
|
omega_substitute (omega_pb pb, eqn sub, int var, int c)
|
|
|
|
{
|
|
|
|
int e, j, j0;
|
|
|
|
int top_var = setup_packing (sub, pb->num_vars);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "substituting using %s := ",
|
|
|
|
omega_variable_to_str (pb, var));
|
|
|
|
omega_print_term (dump_file, pb, sub, -c);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_vars (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (top_var < 0)
|
|
|
|
{
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
pb->eqs[e].coef[var] = 0;
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].coef[var] != 0)
|
|
|
|
{
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
pb->geqs[e].coef[var] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
pb->subs[e].coef[var] = 0;
|
|
|
|
|
|
|
|
if (omega_safe_var_p (pb, var) && !omega_wildcard_p (pb, var))
|
|
|
|
{
|
|
|
|
int k;
|
|
|
|
eqn eqn = &(pb->subs[pb->num_subs++]);
|
|
|
|
|
|
|
|
for (k = pb->num_vars; k >= 0; k--)
|
|
|
|
eqn->coef[k] = 0;
|
|
|
|
|
|
|
|
eqn->key = pb->var[var];
|
|
|
|
eqn->color = omega_black;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (top_var == 0 && packing[0] == 0)
|
|
|
|
{
|
|
|
|
c = -sub->coef[0] * c;
|
|
|
|
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
pb->eqs[e].coef[0] += pb->eqs[e].coef[var] * c;
|
|
|
|
pb->eqs[e].coef[var] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].coef[var] != 0)
|
|
|
|
{
|
|
|
|
pb->geqs[e].coef[0] += pb->geqs[e].coef[var] * c;
|
|
|
|
pb->geqs[e].coef[var] = 0;
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
pb->subs[e].coef[0] += pb->subs[e].coef[var] * c;
|
|
|
|
pb->subs[e].coef[var] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (omega_safe_var_p (pb, var) && !omega_wildcard_p (pb, var))
|
|
|
|
{
|
|
|
|
int k;
|
|
|
|
eqn eqn = &(pb->subs[pb->num_subs++]);
|
|
|
|
|
|
|
|
for (k = pb->num_vars; k >= 1; k--)
|
|
|
|
eqn->coef[k] = 0;
|
|
|
|
|
|
|
|
eqn->coef[0] = c;
|
|
|
|
eqn->key = pb->var[var];
|
|
|
|
eqn->color = omega_black;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "---\n\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
fprintf (dump_file, "===\n\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
eqn eqn = &(pb->eqs[e]);
|
|
|
|
int k = eqn->coef[var];
|
|
|
|
|
|
|
|
if (k != 0)
|
|
|
|
{
|
|
|
|
k = c * k;
|
|
|
|
eqn->coef[var] = 0;
|
|
|
|
|
|
|
|
for (j = top_var; j >= 0; j--)
|
|
|
|
{
|
|
|
|
j0 = packing[j];
|
|
|
|
eqn->coef[j0] -= sub->coef[j0] * k;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
omega_print_eq (dump_file, pb, eqn);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
eqn eqn = &(pb->geqs[e]);
|
|
|
|
int k = eqn->coef[var];
|
|
|
|
|
|
|
|
if (k != 0)
|
|
|
|
{
|
|
|
|
k = c * k;
|
|
|
|
eqn->touched = 1;
|
|
|
|
eqn->coef[var] = 0;
|
|
|
|
|
|
|
|
for (j = top_var; j >= 0; j--)
|
|
|
|
{
|
|
|
|
j0 = packing[j];
|
|
|
|
eqn->coef[j0] -= sub->coef[j0] * k;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
omega_print_geq (dump_file, pb, eqn);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
eqn eqn = &(pb->subs[e]);
|
|
|
|
int k = eqn->coef[var];
|
|
|
|
|
|
|
|
if (k != 0)
|
|
|
|
{
|
|
|
|
k = c * k;
|
|
|
|
eqn->coef[var] = 0;
|
|
|
|
|
|
|
|
for (j = top_var; j >= 0; j--)
|
|
|
|
{
|
|
|
|
j0 = packing[j];
|
|
|
|
eqn->coef[j0] -= sub->coef[j0] * k;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "%s := ", omega_var_to_str (eqn->key));
|
|
|
|
omega_print_term (dump_file, pb, eqn, 1);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "---\n\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
fprintf (dump_file, "===\n\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (omega_safe_var_p (pb, var) && !omega_wildcard_p (pb, var))
|
|
|
|
{
|
|
|
|
int k;
|
|
|
|
eqn eqn = &(pb->subs[pb->num_subs++]);
|
|
|
|
c = -c;
|
|
|
|
|
|
|
|
for (k = pb->num_vars; k >= 0; k--)
|
|
|
|
eqn->coef[k] = c * (sub->coef[k]);
|
|
|
|
|
|
|
|
eqn->key = pb->var[var];
|
|
|
|
eqn->color = sub->color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Solve e = factor alpha for x_j and substitute. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
omega_do_mod (omega_pb pb, int factor, int e, int j)
|
|
|
|
{
|
|
|
|
int k, i;
|
|
|
|
eqn eq = omega_alloc_eqns (0, 1);
|
|
|
|
int nfactor;
|
|
|
|
bool kill_j = false;
|
|
|
|
|
|
|
|
omega_copy_eqn (eq, &pb->eqs[e], pb->num_vars);
|
|
|
|
|
|
|
|
for (k = pb->num_vars; k >= 0; k--)
|
|
|
|
{
|
|
|
|
eq->coef[k] = int_mod (eq->coef[k], factor);
|
|
|
|
|
|
|
|
if (2 * eq->coef[k] >= factor)
|
|
|
|
eq->coef[k] -= factor;
|
|
|
|
}
|
|
|
|
|
|
|
|
nfactor = eq->coef[j];
|
|
|
|
|
|
|
|
if (omega_safe_var_p (pb, j) && !omega_wildcard_p (pb, j))
|
|
|
|
{
|
|
|
|
i = omega_add_new_wild_card (pb);
|
|
|
|
eq->coef[pb->num_vars] = eq->coef[i];
|
|
|
|
eq->coef[j] = 0;
|
|
|
|
eq->coef[i] = -factor;
|
|
|
|
kill_j = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
eq->coef[j] = -factor;
|
|
|
|
if (!omega_wildcard_p (pb, j))
|
|
|
|
omega_name_wild_card (pb, j);
|
|
|
|
}
|
|
|
|
|
|
|
|
omega_substitute (pb, eq, j, nfactor);
|
|
|
|
|
|
|
|
for (k = pb->num_vars; k >= 0; k--)
|
|
|
|
pb->eqs[e].coef[k] = pb->eqs[e].coef[k] / factor;
|
|
|
|
|
|
|
|
if (kill_j)
|
|
|
|
omega_delete_variable (pb, j);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Mod-ing and normalizing produces:\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
omega_free_eqns (eq, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Multiplies by -1 inequality E. */
|
|
|
|
|
|
|
|
void
|
|
|
|
omega_negate_geq (omega_pb pb, int e)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = pb->num_vars; i >= 0; i--)
|
|
|
|
pb->geqs[e].coef[i] *= -1;
|
|
|
|
|
|
|
|
pb->geqs[e].coef[0]--;
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Returns OMEGA_TRUE when problem PB has a solution. */
|
|
|
|
|
|
|
|
static enum omega_result
|
|
|
|
verify_omega_pb (omega_pb pb)
|
|
|
|
{
|
|
|
|
enum omega_result result;
|
|
|
|
int e;
|
|
|
|
bool any_color = false;
|
2009-05-16 08:54:11 +02:00
|
|
|
omega_pb tmp_problem = XNEW (struct omega_pb_d);
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
omega_copy_problem (tmp_problem, pb);
|
|
|
|
tmp_problem->safe_vars = 0;
|
|
|
|
tmp_problem->num_subs = 0;
|
2009-11-25 11:55:54 +01:00
|
|
|
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].color == omega_red)
|
|
|
|
{
|
|
|
|
any_color = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (please_no_equalities_in_simplified_problems)
|
|
|
|
any_color = true;
|
|
|
|
|
|
|
|
if (any_color)
|
|
|
|
original_problem = no_problem;
|
|
|
|
else
|
|
|
|
original_problem = pb;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "verifying problem");
|
|
|
|
|
|
|
|
if (any_color)
|
|
|
|
fprintf (dump_file, " (color mode)");
|
|
|
|
|
|
|
|
fprintf (dump_file, " :\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
result = omega_solve_problem (tmp_problem, omega_unknown);
|
|
|
|
original_problem = no_problem;
|
|
|
|
free (tmp_problem);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
if (result != omega_false)
|
|
|
|
fprintf (dump_file, "verified problem\n");
|
|
|
|
else
|
|
|
|
fprintf (dump_file, "disproved problem\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add a new equality to problem PB at last position E. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
adding_equality_constraint (omega_pb pb, int e)
|
|
|
|
{
|
2009-11-25 11:55:54 +01:00
|
|
|
if (original_problem != no_problem
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& original_problem != pb
|
|
|
|
&& !conservative)
|
|
|
|
{
|
|
|
|
int i, j;
|
|
|
|
int e2 = original_problem->num_eqs++;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"adding equality constraint %d to outer problem\n", e2);
|
|
|
|
omega_init_eqn_zero (&original_problem->eqs[e2],
|
|
|
|
original_problem->num_vars);
|
|
|
|
|
|
|
|
for (i = pb->num_vars; i >= 1; i--)
|
|
|
|
{
|
|
|
|
for (j = original_problem->num_vars; j >= 1; j--)
|
|
|
|
if (original_problem->var[j] == pb->var[i])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (j <= 0)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "retracting\n");
|
|
|
|
original_problem->num_eqs--;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
original_problem->eqs[e2].coef[j] = pb->eqs[e].coef[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
original_problem->eqs[e2].coef[0] = pb->eqs[e].coef[0];
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
omega_print_problem (dump_file, original_problem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int *fast_lookup;
|
|
|
|
static int *fast_lookup_red;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
normalize_false,
|
|
|
|
normalize_uncoupled,
|
|
|
|
normalize_coupled
|
|
|
|
} normalize_return_type;
|
|
|
|
|
|
|
|
/* Normalizes PB by removing redundant constraints. Returns
|
|
|
|
normalize_false when the constraints system has no solution,
|
|
|
|
otherwise returns normalize_coupled or normalize_uncoupled. */
|
|
|
|
|
|
|
|
static normalize_return_type
|
|
|
|
normalize_omega_problem (omega_pb pb)
|
|
|
|
{
|
|
|
|
int e, i, j, k, n_vars;
|
|
|
|
int coupled_subscripts = 0;
|
|
|
|
|
|
|
|
n_vars = pb->num_vars;
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_geqs; e++)
|
|
|
|
{
|
|
|
|
if (!pb->geqs[e].touched)
|
|
|
|
{
|
|
|
|
if (!single_var_geq (&pb->geqs[e], n_vars))
|
|
|
|
coupled_subscripts = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int g, top_var, i0, hashCode;
|
|
|
|
int *p = &packing[0];
|
|
|
|
|
|
|
|
for (k = 1; k <= n_vars; k++)
|
|
|
|
if (pb->geqs[e].coef[k])
|
|
|
|
*(p++) = k;
|
|
|
|
|
|
|
|
top_var = (p - &packing[0]) - 1;
|
|
|
|
|
|
|
|
if (top_var == -1)
|
|
|
|
{
|
|
|
|
if (pb->geqs[e].coef[0] < 0)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
omega_print_geq (dump_file, pb, &pb->geqs[e]);
|
|
|
|
fprintf (dump_file, "\nequations have no solution \n");
|
|
|
|
}
|
|
|
|
return normalize_false;
|
|
|
|
}
|
|
|
|
|
|
|
|
omega_delete_geq (pb, e, n_vars);
|
|
|
|
e--;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if (top_var == 0)
|
|
|
|
{
|
|
|
|
int singlevar = packing[0];
|
|
|
|
|
|
|
|
g = pb->geqs[e].coef[singlevar];
|
|
|
|
|
|
|
|
if (g > 0)
|
|
|
|
{
|
|
|
|
pb->geqs[e].coef[singlevar] = 1;
|
|
|
|
pb->geqs[e].key = singlevar;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
g = -g;
|
|
|
|
pb->geqs[e].coef[singlevar] = -1;
|
|
|
|
pb->geqs[e].key = -singlevar;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g > 1)
|
|
|
|
pb->geqs[e].coef[0] = int_div (pb->geqs[e].coef[0], g);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int g2;
|
|
|
|
int hash_key_multiplier = 31;
|
|
|
|
|
|
|
|
coupled_subscripts = 1;
|
|
|
|
i0 = top_var;
|
|
|
|
i = packing[i0--];
|
|
|
|
g = pb->geqs[e].coef[i];
|
|
|
|
hashCode = g * (i + 3);
|
|
|
|
|
|
|
|
if (g < 0)
|
|
|
|
g = -g;
|
|
|
|
|
|
|
|
for (; i0 >= 0; i0--)
|
|
|
|
{
|
|
|
|
int x;
|
|
|
|
|
|
|
|
i = packing[i0];
|
|
|
|
x = pb->geqs[e].coef[i];
|
|
|
|
hashCode = hashCode * hash_key_multiplier * (i + 3) + x;
|
|
|
|
|
|
|
|
if (x < 0)
|
|
|
|
x = -x;
|
|
|
|
|
|
|
|
if (x == 1)
|
|
|
|
{
|
|
|
|
g = 1;
|
|
|
|
i0--;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g = gcd (x, g);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (; i0 >= 0; i0--)
|
|
|
|
{
|
|
|
|
int x;
|
|
|
|
i = packing[i0];
|
|
|
|
x = pb->geqs[e].coef[i];
|
|
|
|
hashCode = hashCode * hash_key_multiplier * (i + 3) + x;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g > 1)
|
|
|
|
{
|
|
|
|
pb->geqs[e].coef[0] = int_div (pb->geqs[e].coef[0], g);
|
|
|
|
i0 = top_var;
|
|
|
|
i = packing[i0--];
|
|
|
|
pb->geqs[e].coef[i] = pb->geqs[e].coef[i] / g;
|
|
|
|
hashCode = pb->geqs[e].coef[i] * (i + 3);
|
|
|
|
|
|
|
|
for (; i0 >= 0; i0--)
|
|
|
|
{
|
|
|
|
i = packing[i0];
|
|
|
|
pb->geqs[e].coef[i] = pb->geqs[e].coef[i] / g;
|
2009-11-25 11:55:54 +01:00
|
|
|
hashCode = hashCode * hash_key_multiplier * (i + 3)
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
+ pb->geqs[e].coef[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g2 = abs (hashCode);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Hash code = %d, eqn = ", hashCode);
|
|
|
|
omega_print_geq (dump_file, pb, &pb->geqs[e]);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
j = g2 % HASH_TABLE_SIZE;
|
|
|
|
|
|
|
|
do {
|
|
|
|
eqn proto = &(hash_master[j]);
|
|
|
|
|
|
|
|
if (proto->touched == g2)
|
|
|
|
{
|
|
|
|
if (proto->coef[0] == top_var)
|
|
|
|
{
|
|
|
|
if (hashCode >= 0)
|
|
|
|
for (i0 = top_var; i0 >= 0; i0--)
|
|
|
|
{
|
|
|
|
i = packing[i0];
|
|
|
|
|
|
|
|
if (pb->geqs[e].coef[i] != proto->coef[i])
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
for (i0 = top_var; i0 >= 0; i0--)
|
|
|
|
{
|
|
|
|
i = packing[i0];
|
|
|
|
|
|
|
|
if (pb->geqs[e].coef[i] != -proto->coef[i])
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i0 < 0)
|
|
|
|
{
|
|
|
|
if (hashCode >= 0)
|
|
|
|
pb->geqs[e].key = proto->key;
|
|
|
|
else
|
|
|
|
pb->geqs[e].key = -proto->key;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (proto->touched < 0)
|
|
|
|
{
|
|
|
|
omega_init_eqn_zero (proto, pb->num_vars);
|
|
|
|
if (hashCode >= 0)
|
|
|
|
for (i0 = top_var; i0 >= 0; i0--)
|
|
|
|
{
|
|
|
|
i = packing[i0];
|
|
|
|
proto->coef[i] = pb->geqs[e].coef[i];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
for (i0 = top_var; i0 >= 0; i0--)
|
|
|
|
{
|
|
|
|
i = packing[i0];
|
|
|
|
proto->coef[i] = -pb->geqs[e].coef[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
proto->coef[0] = top_var;
|
|
|
|
proto->touched = g2;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, " constraint key = %d\n",
|
|
|
|
next_key);
|
|
|
|
|
|
|
|
proto->key = next_key++;
|
|
|
|
|
|
|
|
/* Too many hash keys generated. */
|
|
|
|
gcc_assert (proto->key <= MAX_KEYS);
|
|
|
|
|
|
|
|
if (hashCode >= 0)
|
|
|
|
pb->geqs[e].key = proto->key;
|
|
|
|
else
|
|
|
|
pb->geqs[e].key = -proto->key;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
j = (j + 1) % HASH_TABLE_SIZE;
|
|
|
|
} while (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->geqs[e].touched = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
int eKey = pb->geqs[e].key;
|
|
|
|
int e2;
|
|
|
|
if (e > 0)
|
|
|
|
{
|
|
|
|
int cTerm = pb->geqs[e].coef[0];
|
|
|
|
e2 = fast_lookup[MAX_KEYS - eKey];
|
|
|
|
|
|
|
|
if (e2 < e && pb->geqs[e2].key == -eKey
|
|
|
|
&& pb->geqs[e2].color == omega_black)
|
|
|
|
{
|
|
|
|
if (pb->geqs[e2].coef[0] < -cTerm)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
omega_print_geq (dump_file, pb, &pb->geqs[e]);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_geq (dump_file, pb, &pb->geqs[e2]);
|
|
|
|
fprintf (dump_file,
|
|
|
|
"\nequations have no solution \n");
|
|
|
|
}
|
|
|
|
return normalize_false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pb->geqs[e2].coef[0] == -cTerm
|
2009-11-25 11:55:54 +01:00
|
|
|
&& (create_color
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|| pb->geqs[e].color == omega_black))
|
|
|
|
{
|
|
|
|
omega_copy_eqn (&pb->eqs[pb->num_eqs], &pb->geqs[e],
|
|
|
|
pb->num_vars);
|
|
|
|
if (pb->geqs[e].color == omega_black)
|
|
|
|
adding_equality_constraint (pb, pb->num_eqs);
|
|
|
|
pb->num_eqs++;
|
|
|
|
gcc_assert (pb->num_eqs <= OMEGA_MAX_EQS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
e2 = fast_lookup_red[MAX_KEYS - eKey];
|
|
|
|
|
|
|
|
if (e2 < e && pb->geqs[e2].key == -eKey
|
|
|
|
&& pb->geqs[e2].color == omega_red)
|
|
|
|
{
|
|
|
|
if (pb->geqs[e2].coef[0] < -cTerm)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
omega_print_geq (dump_file, pb, &pb->geqs[e]);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_geq (dump_file, pb, &pb->geqs[e2]);
|
|
|
|
fprintf (dump_file,
|
|
|
|
"\nequations have no solution \n");
|
|
|
|
}
|
|
|
|
return normalize_false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pb->geqs[e2].coef[0] == -cTerm && create_color)
|
|
|
|
{
|
|
|
|
omega_copy_eqn (&pb->eqs[pb->num_eqs], &pb->geqs[e],
|
|
|
|
pb->num_vars);
|
|
|
|
pb->eqs[pb->num_eqs].color = omega_red;
|
|
|
|
pb->num_eqs++;
|
|
|
|
gcc_assert (pb->num_eqs <= OMEGA_MAX_EQS);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
e2 = fast_lookup[MAX_KEYS + eKey];
|
|
|
|
|
2009-11-25 11:55:54 +01:00
|
|
|
if (e2 < e && pb->geqs[e2].key == eKey
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& pb->geqs[e2].color == omega_black)
|
|
|
|
{
|
|
|
|
if (pb->geqs[e2].coef[0] > cTerm)
|
|
|
|
{
|
|
|
|
if (pb->geqs[e].color == omega_black)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
c-typeck.c, [...]: Fix typos and follow spelling conventions in various warning/error/diagnostic...
* c-typeck.c, config/arm/arm.c, config/darwin.c,
config/sh/symbian.c, gcc.c, ipa-cp.c, ipa-inline.c, loop-iv.c,
omega.c, tree-ssa-loop-niter.c, treestruct.def: Fix typos and
follow spelling conventions in various
warning/error/diagnostic messages.
From-SVN: r125089
2007-05-26 14:17:52 +02:00
|
|
|
"Removing Redundant Equation: ");
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e2]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
fprintf (dump_file,
|
|
|
|
"[a] Made Redundant by: ");
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
pb->geqs[e2].coef[0] = cTerm;
|
|
|
|
omega_delete_geq (pb, e, n_vars);
|
|
|
|
e--;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
c-typeck.c, [...]: Fix typos and follow spelling conventions in various warning/error/diagnostic...
* c-typeck.c, config/arm/arm.c, config/darwin.c,
config/sh/symbian.c, gcc.c, ipa-cp.c, ipa-inline.c, loop-iv.c,
omega.c, tree-ssa-loop-niter.c, treestruct.def: Fix typos and
follow spelling conventions in various
warning/error/diagnostic messages.
From-SVN: r125089
2007-05-26 14:17:52 +02:00
|
|
|
fprintf (dump_file, "Removing Redundant Equation: ");
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
fprintf (dump_file, "[b] Made Redundant by: ");
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e2]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
omega_delete_geq (pb, e, n_vars);
|
|
|
|
e--;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
e2 = fast_lookup_red[MAX_KEYS + eKey];
|
|
|
|
|
|
|
|
if (e2 < e && pb->geqs[e2].key == eKey
|
|
|
|
&& pb->geqs[e2].color == omega_red)
|
|
|
|
{
|
|
|
|
if (pb->geqs[e2].coef[0] >= cTerm)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
c-typeck.c, [...]: Fix typos and follow spelling conventions in various warning/error/diagnostic...
* c-typeck.c, config/arm/arm.c, config/darwin.c,
config/sh/symbian.c, gcc.c, ipa-cp.c, ipa-inline.c, loop-iv.c,
omega.c, tree-ssa-loop-niter.c, treestruct.def: Fix typos and
follow spelling conventions in various
warning/error/diagnostic messages.
From-SVN: r125089
2007-05-26 14:17:52 +02:00
|
|
|
fprintf (dump_file, "Removing Redundant Equation: ");
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e2]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
fprintf (dump_file, "[c] Made Redundant by: ");
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
pb->geqs[e2].coef[0] = cTerm;
|
|
|
|
pb->geqs[e2].color = pb->geqs[e].color;
|
|
|
|
}
|
|
|
|
else if (pb->geqs[e].color == omega_red)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
c-typeck.c, [...]: Fix typos and follow spelling conventions in various warning/error/diagnostic...
* c-typeck.c, config/arm/arm.c, config/darwin.c,
config/sh/symbian.c, gcc.c, ipa-cp.c, ipa-inline.c, loop-iv.c,
omega.c, tree-ssa-loop-niter.c, treestruct.def: Fix typos and
follow spelling conventions in various
warning/error/diagnostic messages.
From-SVN: r125089
2007-05-26 14:17:52 +02:00
|
|
|
fprintf (dump_file, "Removing Redundant Equation: ");
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
fprintf (dump_file, "[d] Made Redundant by: ");
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e2]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
omega_delete_geq (pb, e, n_vars);
|
|
|
|
e--;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pb->geqs[e].color == omega_red)
|
|
|
|
fast_lookup_red[MAX_KEYS + eKey] = e;
|
|
|
|
else
|
|
|
|
fast_lookup[MAX_KEYS + eKey] = e;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
create_color = false;
|
|
|
|
return coupled_subscripts ? normalize_coupled : normalize_uncoupled;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Divide the coefficients of EQN by their gcd. N_VARS is the number
|
|
|
|
of variables in EQN. */
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
divide_eqn_by_gcd (eqn eqn, int n_vars)
|
|
|
|
{
|
|
|
|
int var, g = 0;
|
|
|
|
|
|
|
|
for (var = n_vars; var >= 0; var--)
|
|
|
|
g = gcd (abs (eqn->coef[var]), g);
|
|
|
|
|
|
|
|
if (g)
|
|
|
|
for (var = n_vars; var >= 0; var--)
|
|
|
|
eqn->coef[var] = eqn->coef[var] / g;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Rewrite some non-safe variables in function of protected
|
|
|
|
wildcard variables. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
cleanout_wildcards (omega_pb pb)
|
|
|
|
{
|
|
|
|
int e, i, j;
|
|
|
|
int n_vars = pb->num_vars;
|
|
|
|
bool renormalize = false;
|
|
|
|
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
for (i = n_vars; !omega_safe_var_p (pb, i); i--)
|
|
|
|
if (pb->eqs[e].coef[i] != 0)
|
|
|
|
{
|
i386.c, [...]: Fix comment typos.
* config/i386/i386.c, config/pa/pa.c, config/spu/spu.c,
df-problems.c, df-scan.c, domwalk.c, ebitmap.c, ebitmap.h,
fold-const.c, gcc.c, ipa-type-escape.c, omega.c, omega.h,
tree-ssa-coalesce.c, tree-ssa-live.c, tree-ssa-structalias.c,
tree-vrp.c: Fix comment typos. Follow spelling conventions.
* doc/tm.texi: Follow spelling conventions.
From-SVN: r125090
2007-05-26 15:00:47 +02:00
|
|
|
/* i is the last nonzero non-safe variable. */
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
for (j = i - 1; !omega_safe_var_p (pb, j); j--)
|
|
|
|
if (pb->eqs[e].coef[j] != 0)
|
|
|
|
break;
|
|
|
|
|
i386.c, [...]: Fix comment typos.
* config/i386/i386.c, config/pa/pa.c, config/spu/spu.c,
df-problems.c, df-scan.c, domwalk.c, ebitmap.c, ebitmap.h,
fold-const.c, gcc.c, ipa-type-escape.c, omega.c, omega.h,
tree-ssa-coalesce.c, tree-ssa-live.c, tree-ssa-structalias.c,
tree-vrp.c: Fix comment typos. Follow spelling conventions.
* doc/tm.texi: Follow spelling conventions.
From-SVN: r125090
2007-05-26 15:00:47 +02:00
|
|
|
/* j is the next nonzero non-safe variable, or points
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
to a safe variable: it is then a wildcard variable. */
|
|
|
|
|
|
|
|
/* Clean it out. */
|
|
|
|
if (omega_safe_var_p (pb, j))
|
|
|
|
{
|
|
|
|
eqn sub = &(pb->eqs[e]);
|
|
|
|
int c = pb->eqs[e].coef[i];
|
|
|
|
int a = abs (c);
|
|
|
|
int e2;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
|
|
|
"Found a single wild card equality: ");
|
|
|
|
omega_print_eq (dump_file, pb, &pb->eqs[e]);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e2 = pb->num_eqs - 1; e2 >= 0; e2--)
|
|
|
|
if (e != e2 && pb->eqs[e2].coef[i]
|
|
|
|
&& (pb->eqs[e2].color == omega_red
|
2009-11-25 11:55:54 +01:00
|
|
|
|| (pb->eqs[e2].color == omega_black
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& pb->eqs[e].color == omega_black)))
|
|
|
|
{
|
|
|
|
eqn eqn = &(pb->eqs[e2]);
|
|
|
|
int var, k;
|
|
|
|
|
|
|
|
for (var = n_vars; var >= 0; var--)
|
|
|
|
eqn->coef[var] *= a;
|
|
|
|
|
|
|
|
k = eqn->coef[i];
|
|
|
|
|
|
|
|
for (var = n_vars; var >= 0; var--)
|
|
|
|
eqn->coef[var] -= sub->coef[var] * k / c;
|
|
|
|
|
|
|
|
eqn->coef[i] = 0;
|
|
|
|
divide_eqn_by_gcd (eqn, n_vars);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e2 = pb->num_geqs - 1; e2 >= 0; e2--)
|
2009-11-25 11:55:54 +01:00
|
|
|
if (pb->geqs[e2].coef[i]
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& (pb->geqs[e2].color == omega_red
|
2009-11-25 11:55:54 +01:00
|
|
|
|| (pb->eqs[e].color == omega_black
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& pb->geqs[e2].color == omega_black)))
|
|
|
|
{
|
|
|
|
eqn eqn = &(pb->geqs[e2]);
|
|
|
|
int var, k;
|
|
|
|
|
|
|
|
for (var = n_vars; var >= 0; var--)
|
|
|
|
eqn->coef[var] *= a;
|
|
|
|
|
|
|
|
k = eqn->coef[i];
|
|
|
|
|
|
|
|
for (var = n_vars; var >= 0; var--)
|
|
|
|
eqn->coef[var] -= sub->coef[var] * k / c;
|
|
|
|
|
|
|
|
eqn->coef[i] = 0;
|
|
|
|
eqn->touched = 1;
|
|
|
|
renormalize = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e2 = pb->num_subs - 1; e2 >= 0; e2--)
|
2009-11-25 11:55:54 +01:00
|
|
|
if (pb->subs[e2].coef[i]
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& (pb->subs[e2].color == omega_red
|
2009-11-25 11:55:54 +01:00
|
|
|
|| (pb->subs[e2].color == omega_black
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& pb->eqs[e].color == omega_black)))
|
|
|
|
{
|
|
|
|
eqn eqn = &(pb->subs[e2]);
|
|
|
|
int var, k;
|
|
|
|
|
|
|
|
for (var = n_vars; var >= 0; var--)
|
|
|
|
eqn->coef[var] *= a;
|
|
|
|
|
|
|
|
k = eqn->coef[i];
|
|
|
|
|
|
|
|
for (var = n_vars; var >= 0; var--)
|
|
|
|
eqn->coef[var] -= sub->coef[var] * k / c;
|
|
|
|
|
|
|
|
eqn->coef[i] = 0;
|
|
|
|
divide_eqn_by_gcd (eqn, n_vars);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "cleaned-out wildcard: ");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (renormalize)
|
|
|
|
normalize_omega_problem (pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Swap values contained in I and J. */
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
swap (int *i, int *j)
|
|
|
|
{
|
|
|
|
int tmp;
|
|
|
|
tmp = *i;
|
|
|
|
*i = *j;
|
|
|
|
*j = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Swap values contained in I and J. */
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
bswap (bool *i, bool *j)
|
|
|
|
{
|
|
|
|
bool tmp;
|
|
|
|
tmp = *i;
|
|
|
|
*i = *j;
|
|
|
|
*j = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Make variable IDX unprotected in PB, by swapping its index at the
|
|
|
|
PB->safe_vars rank. */
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
omega_unprotect_1 (omega_pb pb, int *idx, bool *unprotect)
|
|
|
|
{
|
|
|
|
/* If IDX is protected... */
|
|
|
|
if (*idx < pb->safe_vars)
|
|
|
|
{
|
|
|
|
/* ... swap its index with the last non protected index. */
|
|
|
|
int j = pb->safe_vars;
|
|
|
|
int e;
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
swap (&pb->geqs[e].coef[*idx], &pb->geqs[e].coef[j]);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
swap (&pb->eqs[e].coef[*idx], &pb->eqs[e].coef[j]);
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
swap (&pb->subs[e].coef[*idx], &pb->subs[e].coef[j]);
|
|
|
|
|
|
|
|
if (unprotect)
|
|
|
|
bswap (&unprotect[*idx], &unprotect[j]);
|
|
|
|
|
|
|
|
swap (&pb->var[*idx], &pb->var[j]);
|
|
|
|
pb->forwarding_address[pb->var[*idx]] = *idx;
|
|
|
|
pb->forwarding_address[pb->var[j]] = j;
|
|
|
|
(*idx)--;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The variable at pb->safe_vars is also unprotected now. */
|
|
|
|
pb->safe_vars--;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* During the Fourier-Motzkin elimination some variables are
|
|
|
|
substituted with other variables. This function resurrects the
|
|
|
|
substituted variables in PB. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
resurrect_subs (omega_pb pb)
|
|
|
|
{
|
2009-11-25 11:55:54 +01:00
|
|
|
if (pb->num_subs > 0
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& please_no_equalities_in_simplified_problems == 0)
|
|
|
|
{
|
2009-11-28 17:21:00 +01:00
|
|
|
int i, e, m;
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
|
|
|
"problem reduced, bringing variables back to life\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 1; omega_safe_var_p (pb, i); i++)
|
|
|
|
if (omega_wildcard_p (pb, i))
|
|
|
|
omega_unprotect_1 (pb, &i, NULL);
|
|
|
|
|
|
|
|
m = pb->num_subs;
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (single_var_geq (&pb->geqs[e], pb->num_vars))
|
|
|
|
{
|
|
|
|
if (!omega_safe_var_p (pb, abs (pb->geqs[e].key)))
|
|
|
|
pb->geqs[e].key += (pb->geqs[e].key > 0 ? m : -m);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
pb->geqs[e].key = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = pb->num_vars; !omega_safe_var_p (pb, i); i--)
|
|
|
|
{
|
|
|
|
pb->var[i + m] = pb->var[i];
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
pb->geqs[e].coef[i + m] = pb->geqs[e].coef[i];
|
|
|
|
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
pb->eqs[e].coef[i + m] = pb->eqs[e].coef[i];
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
pb->subs[e].coef[i + m] = pb->subs[e].coef[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = pb->safe_vars + m; !omega_safe_var_p (pb, i); i--)
|
|
|
|
{
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
pb->geqs[e].coef[i] = 0;
|
|
|
|
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
pb->eqs[e].coef[i] = 0;
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
pb->subs[e].coef[i] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->num_vars += m;
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
pb->var[pb->safe_vars + 1 + e] = pb->subs[e].key;
|
|
|
|
omega_copy_eqn (&(pb->eqs[pb->num_eqs]), &(pb->subs[e]),
|
|
|
|
pb->num_vars);
|
|
|
|
pb->eqs[pb->num_eqs].coef[pb->safe_vars + 1 + e] = -1;
|
|
|
|
pb->eqs[pb->num_eqs].color = omega_black;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "brought back: ");
|
|
|
|
omega_print_eq (dump_file, pb, &pb->eqs[pb->num_eqs]);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->num_eqs++;
|
|
|
|
gcc_assert (pb->num_eqs <= OMEGA_MAX_EQS);
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->safe_vars += m;
|
|
|
|
pb->num_subs = 0;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "variables brought back to life\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanout_wildcards (pb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
implies (unsigned int a, unsigned int b)
|
|
|
|
{
|
|
|
|
return (a == (a & b));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Eliminate redundant equations in PB. When EXPENSIVE is true, an
|
|
|
|
extra step is performed. Returns omega_false when there exist no
|
|
|
|
solution, omega_true otherwise. */
|
|
|
|
|
|
|
|
enum omega_result
|
|
|
|
omega_eliminate_redundant (omega_pb pb, bool expensive)
|
|
|
|
{
|
|
|
|
int c, e, e1, e2, e3, p, q, i, k, alpha, alpha1, alpha2, alpha3;
|
|
|
|
bool *is_dead = XNEWVEC (bool, OMEGA_MAX_GEQS);
|
|
|
|
omega_pb tmp_problem;
|
|
|
|
|
|
|
|
/* {P,Z,N}EQS = {Positive,Zero,Negative} Equations. */
|
|
|
|
unsigned int *peqs = XNEWVEC (unsigned int, OMEGA_MAX_GEQS);
|
|
|
|
unsigned int *zeqs = XNEWVEC (unsigned int, OMEGA_MAX_GEQS);
|
|
|
|
unsigned int *neqs = XNEWVEC (unsigned int, OMEGA_MAX_GEQS);
|
|
|
|
|
|
|
|
/* PP = Possible Positives, PZ = Possible Zeros, PN = Possible Negatives */
|
|
|
|
unsigned int pp, pz, pn;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
c-typeck.c, [...]: Fix typos and follow spelling conventions in various warning/error/diagnostic...
* c-typeck.c, config/arm/arm.c, config/darwin.c,
config/sh/symbian.c, gcc.c, ipa-cp.c, ipa-inline.c, loop-iv.c,
omega.c, tree-ssa-loop-niter.c, treestruct.def: Fix typos and
follow spelling conventions in various
warning/error/diagnostic messages.
From-SVN: r125089
2007-05-26 14:17:52 +02:00
|
|
|
fprintf (dump_file, "in eliminate Redundant:\n");
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
int tmp = 1;
|
|
|
|
|
|
|
|
is_dead[e] = false;
|
|
|
|
peqs[e] = zeqs[e] = neqs[e] = 0;
|
|
|
|
|
|
|
|
for (i = pb->num_vars; i >= 1; i--)
|
|
|
|
{
|
|
|
|
if (pb->geqs[e].coef[i] > 0)
|
|
|
|
peqs[e] |= tmp;
|
|
|
|
else if (pb->geqs[e].coef[i] < 0)
|
|
|
|
neqs[e] |= tmp;
|
|
|
|
else
|
|
|
|
zeqs[e] |= tmp;
|
|
|
|
|
|
|
|
tmp <<= 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (e1 = pb->num_geqs - 1; e1 >= 0; e1--)
|
|
|
|
if (!is_dead[e1])
|
|
|
|
for (e2 = e1 - 1; e2 >= 0; e2--)
|
|
|
|
if (!is_dead[e2])
|
|
|
|
{
|
|
|
|
for (p = pb->num_vars; p > 1; p--)
|
|
|
|
for (q = p - 1; q > 0; q--)
|
|
|
|
if ((alpha = pb->geqs[e1].coef[p] * pb->geqs[e2].coef[q]
|
|
|
|
- pb->geqs[e2].coef[p] * pb->geqs[e1].coef[q]) != 0)
|
|
|
|
goto foundPQ;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
foundPQ:
|
2009-11-25 11:55:54 +01:00
|
|
|
pz = ((zeqs[e1] & zeqs[e2]) | (peqs[e1] & neqs[e2])
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
| (neqs[e1] & peqs[e2]));
|
|
|
|
pp = peqs[e1] | peqs[e2];
|
|
|
|
pn = neqs[e1] | neqs[e2];
|
|
|
|
|
|
|
|
for (e3 = pb->num_geqs - 1; e3 >= 0; e3--)
|
|
|
|
if (e3 != e1 && e3 != e2)
|
|
|
|
{
|
|
|
|
if (!implies (zeqs[e3], pz))
|
|
|
|
goto nextE3;
|
|
|
|
|
|
|
|
alpha1 = (pb->geqs[e2].coef[q] * pb->geqs[e3].coef[p]
|
|
|
|
- pb->geqs[e2].coef[p] * pb->geqs[e3].coef[q]);
|
|
|
|
alpha2 = -(pb->geqs[e1].coef[q] * pb->geqs[e3].coef[p]
|
|
|
|
- pb->geqs[e1].coef[p] * pb->geqs[e3].coef[q]);
|
|
|
|
alpha3 = alpha;
|
|
|
|
|
|
|
|
if (alpha1 * alpha2 <= 0)
|
|
|
|
goto nextE3;
|
|
|
|
|
|
|
|
if (alpha1 < 0)
|
|
|
|
{
|
|
|
|
alpha1 = -alpha1;
|
|
|
|
alpha2 = -alpha2;
|
|
|
|
alpha3 = -alpha3;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (alpha3 > 0)
|
|
|
|
{
|
|
|
|
/* Trying to prove e3 is redundant. */
|
2009-11-25 11:55:54 +01:00
|
|
|
if (!implies (peqs[e3], pp)
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|| !implies (neqs[e3], pn))
|
|
|
|
goto nextE3;
|
|
|
|
|
|
|
|
if (pb->geqs[e3].color == omega_black
|
|
|
|
&& (pb->geqs[e1].color == omega_red
|
|
|
|
|| pb->geqs[e2].color == omega_red))
|
|
|
|
goto nextE3;
|
|
|
|
|
|
|
|
for (k = pb->num_vars; k >= 1; k--)
|
|
|
|
if (alpha3 * pb->geqs[e3].coef[k]
|
|
|
|
!= (alpha1 * pb->geqs[e1].coef[k]
|
|
|
|
+ alpha2 * pb->geqs[e2].coef[k]))
|
|
|
|
goto nextE3;
|
|
|
|
|
|
|
|
c = (alpha1 * pb->geqs[e1].coef[0]
|
|
|
|
+ alpha2 * pb->geqs[e2].coef[0]);
|
|
|
|
|
|
|
|
if (c < alpha3 * (pb->geqs[e3].coef[0] + 1))
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
|
|
|
"found redundant inequality\n");
|
|
|
|
fprintf (dump_file,
|
|
|
|
"alpha1, alpha2, alpha3 = %d,%d,%d\n",
|
|
|
|
alpha1, alpha2, alpha3);
|
|
|
|
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e1]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e2]));
|
|
|
|
fprintf (dump_file, "\n=> ");
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e3]));
|
|
|
|
fprintf (dump_file, "\n\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
is_dead[e3] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Trying to prove e3 <= 0 and therefore e3 = 0,
|
|
|
|
or trying to prove e3 < 0, and therefore the
|
|
|
|
problem has no solutions. */
|
2009-11-25 11:55:54 +01:00
|
|
|
if (!implies (peqs[e3], pn)
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|| !implies (neqs[e3], pp))
|
|
|
|
goto nextE3;
|
|
|
|
|
|
|
|
if (pb->geqs[e1].color == omega_red
|
|
|
|
|| pb->geqs[e2].color == omega_red
|
|
|
|
|| pb->geqs[e3].color == omega_red)
|
|
|
|
goto nextE3;
|
|
|
|
|
|
|
|
/* verify alpha1*v1+alpha2*v2 = alpha3*v3 */
|
|
|
|
for (k = pb->num_vars; k >= 1; k--)
|
|
|
|
if (alpha3 * pb->geqs[e3].coef[k]
|
|
|
|
!= (alpha1 * pb->geqs[e1].coef[k]
|
|
|
|
+ alpha2 * pb->geqs[e2].coef[k]))
|
|
|
|
goto nextE3;
|
|
|
|
|
|
|
|
c = (alpha1 * pb->geqs[e1].coef[0]
|
|
|
|
+ alpha2 * pb->geqs[e2].coef[0]);
|
|
|
|
|
|
|
|
if (c < alpha3 * (pb->geqs[e3].coef[0]))
|
|
|
|
{
|
|
|
|
/* We just proved e3 < 0, so no solutions exist. */
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
|
|
|
"found implied over tight inequality\n");
|
|
|
|
fprintf (dump_file,
|
|
|
|
"alpha1, alpha2, alpha3 = %d,%d,%d\n",
|
|
|
|
alpha1, alpha2, -alpha3);
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e1]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e2]));
|
|
|
|
fprintf (dump_file, "\n=> not ");
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e3]));
|
|
|
|
fprintf (dump_file, "\n\n");
|
|
|
|
}
|
|
|
|
free (is_dead);
|
|
|
|
free (peqs);
|
|
|
|
free (zeqs);
|
|
|
|
free (neqs);
|
|
|
|
return omega_false;
|
|
|
|
}
|
|
|
|
else if (c < alpha3 * (pb->geqs[e3].coef[0] - 1))
|
|
|
|
{
|
|
|
|
/* We just proved that e3 <=0, so e3 = 0. */
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
|
|
|
"found implied tight inequality\n");
|
|
|
|
fprintf (dump_file,
|
|
|
|
"alpha1, alpha2, alpha3 = %d,%d,%d\n",
|
|
|
|
alpha1, alpha2, -alpha3);
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e1]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e2]));
|
|
|
|
fprintf (dump_file, "\n=> inverse ");
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e3]));
|
|
|
|
fprintf (dump_file, "\n\n");
|
|
|
|
}
|
|
|
|
|
2009-11-25 11:55:54 +01:00
|
|
|
omega_copy_eqn (&pb->eqs[pb->num_eqs++],
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&pb->geqs[e3], pb->num_vars);
|
|
|
|
gcc_assert (pb->num_eqs <= OMEGA_MAX_EQS);
|
|
|
|
adding_equality_constraint (pb, pb->num_eqs - 1);
|
|
|
|
is_dead[e3] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nextE3:;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Delete the inequalities that were marked as dead. */
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (is_dead[e])
|
|
|
|
omega_delete_geq (pb, e, pb->num_vars);
|
|
|
|
|
|
|
|
if (!expensive)
|
|
|
|
goto eliminate_redundant_done;
|
|
|
|
|
2009-05-16 08:54:11 +02:00
|
|
|
tmp_problem = XNEW (struct omega_pb_d);
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
conservative++;
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
|
|
|
"checking equation %d to see if it is redundant: ", e);
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
omega_copy_problem (tmp_problem, pb);
|
|
|
|
omega_negate_geq (tmp_problem, e);
|
|
|
|
tmp_problem->safe_vars = 0;
|
|
|
|
tmp_problem->variables_freed = false;
|
|
|
|
|
|
|
|
if (omega_solve_problem (tmp_problem, omega_false) == omega_false)
|
|
|
|
omega_delete_geq (pb, e, pb->num_vars);
|
|
|
|
}
|
|
|
|
|
|
|
|
free (tmp_problem);
|
|
|
|
conservative--;
|
|
|
|
|
|
|
|
if (!omega_reduce_with_subs)
|
|
|
|
{
|
|
|
|
resurrect_subs (pb);
|
|
|
|
gcc_assert (please_no_equalities_in_simplified_problems
|
|
|
|
|| pb->num_subs == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
eliminate_redundant_done:
|
|
|
|
free (is_dead);
|
|
|
|
free (peqs);
|
|
|
|
free (zeqs);
|
|
|
|
free (neqs);
|
|
|
|
return omega_true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* For each inequality that has coefficients bigger than 20, try to
|
|
|
|
create a new constraint that cannot be derived from the original
|
|
|
|
constraint and that has smaller coefficients. Add the new
|
|
|
|
constraint at the end of geqs. Return the number of inequalities
|
|
|
|
that have been added to PB. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
smooth_weird_equations (omega_pb pb)
|
|
|
|
{
|
|
|
|
int e1, e2, e3, p, q, k, alpha, alpha1, alpha2, alpha3;
|
|
|
|
int c;
|
|
|
|
int v;
|
|
|
|
int result = 0;
|
|
|
|
|
|
|
|
for (e1 = pb->num_geqs - 1; e1 >= 0; e1--)
|
|
|
|
if (pb->geqs[e1].color == omega_black)
|
|
|
|
{
|
|
|
|
int g = 999999;
|
|
|
|
|
|
|
|
for (v = pb->num_vars; v >= 1; v--)
|
|
|
|
if (pb->geqs[e1].coef[v] != 0 && abs (pb->geqs[e1].coef[v]) < g)
|
|
|
|
g = abs (pb->geqs[e1].coef[v]);
|
|
|
|
|
|
|
|
/* Magic number. */
|
|
|
|
if (g > 20)
|
|
|
|
{
|
|
|
|
e3 = pb->num_geqs;
|
|
|
|
|
|
|
|
for (v = pb->num_vars; v >= 1; v--)
|
|
|
|
pb->geqs[e3].coef[v] = int_div (6 * pb->geqs[e1].coef[v] + g / 2,
|
|
|
|
g);
|
|
|
|
|
|
|
|
pb->geqs[e3].color = omega_black;
|
|
|
|
pb->geqs[e3].touched = 1;
|
|
|
|
/* Magic number. */
|
|
|
|
pb->geqs[e3].coef[0] = 9997;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Checking to see if we can derive: ");
|
|
|
|
omega_print_geq (dump_file, pb, &pb->geqs[e3]);
|
|
|
|
fprintf (dump_file, "\n from: ");
|
|
|
|
omega_print_geq (dump_file, pb, &pb->geqs[e1]);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e2 = pb->num_geqs - 1; e2 >= 0; e2--)
|
|
|
|
if (e1 != e2 && pb->geqs[e2].color == omega_black)
|
|
|
|
{
|
|
|
|
for (p = pb->num_vars; p > 1; p--)
|
|
|
|
{
|
|
|
|
for (q = p - 1; q > 0; q--)
|
|
|
|
{
|
|
|
|
alpha =
|
|
|
|
(pb->geqs[e1].coef[p] * pb->geqs[e2].coef[q] -
|
|
|
|
pb->geqs[e2].coef[p] * pb->geqs[e1].coef[q]);
|
|
|
|
if (alpha != 0)
|
|
|
|
goto foundPQ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
|
|
|
|
foundPQ:
|
|
|
|
|
|
|
|
alpha1 = (pb->geqs[e2].coef[q] * pb->geqs[e3].coef[p]
|
|
|
|
- pb->geqs[e2].coef[p] * pb->geqs[e3].coef[q]);
|
|
|
|
alpha2 = -(pb->geqs[e1].coef[q] * pb->geqs[e3].coef[p]
|
|
|
|
- pb->geqs[e1].coef[p] * pb->geqs[e3].coef[q]);
|
|
|
|
alpha3 = alpha;
|
|
|
|
|
|
|
|
if (alpha1 * alpha2 <= 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (alpha1 < 0)
|
|
|
|
{
|
|
|
|
alpha1 = -alpha1;
|
|
|
|
alpha2 = -alpha2;
|
|
|
|
alpha3 = -alpha3;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (alpha3 > 0)
|
|
|
|
{
|
|
|
|
/* Try to prove e3 is redundant: verify
|
|
|
|
alpha1*v1 + alpha2*v2 = alpha3*v3. */
|
|
|
|
for (k = pb->num_vars; k >= 1; k--)
|
|
|
|
if (alpha3 * pb->geqs[e3].coef[k]
|
|
|
|
!= (alpha1 * pb->geqs[e1].coef[k]
|
|
|
|
+ alpha2 * pb->geqs[e2].coef[k]))
|
|
|
|
goto nextE2;
|
|
|
|
|
|
|
|
c = alpha1 * pb->geqs[e1].coef[0]
|
|
|
|
+ alpha2 * pb->geqs[e2].coef[0];
|
|
|
|
|
|
|
|
if (c < alpha3 * (pb->geqs[e3].coef[0] + 1))
|
|
|
|
pb->geqs[e3].coef[0] = int_div (c, alpha3);
|
|
|
|
}
|
|
|
|
nextE2:;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pb->geqs[e3].coef[0] < 9997)
|
|
|
|
{
|
|
|
|
result++;
|
|
|
|
pb->num_geqs++;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
2008-06-06 07:42:00 +02:00
|
|
|
"Smoothing weird equations; adding:\n");
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
omega_print_geq (dump_file, pb, &pb->geqs[e3]);
|
|
|
|
fprintf (dump_file, "\nto:\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
fprintf (dump_file, "\n\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Replace tuples of inequalities, that define upper and lower half
|
|
|
|
spaces, with an equation. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
coalesce (omega_pb pb)
|
|
|
|
{
|
|
|
|
int e, e2;
|
|
|
|
int colors = 0;
|
2007-07-15 13:45:30 +02:00
|
|
|
bool *is_dead;
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
int found_something = 0;
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_geqs; e++)
|
|
|
|
if (pb->geqs[e].color == omega_red)
|
|
|
|
colors++;
|
|
|
|
|
|
|
|
if (colors < 2)
|
|
|
|
return;
|
|
|
|
|
2007-07-15 13:45:30 +02:00
|
|
|
is_dead = XNEWVEC (bool, OMEGA_MAX_GEQS);
|
|
|
|
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
for (e = 0; e < pb->num_geqs; e++)
|
|
|
|
is_dead[e] = false;
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_geqs; e++)
|
2009-11-25 11:55:54 +01:00
|
|
|
if (pb->geqs[e].color == omega_red
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& !pb->geqs[e].touched)
|
|
|
|
for (e2 = e + 1; e2 < pb->num_geqs; e2++)
|
2009-11-25 11:55:54 +01:00
|
|
|
if (!pb->geqs[e2].touched
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& pb->geqs[e].key == -pb->geqs[e2].key
|
2009-11-25 11:55:54 +01:00
|
|
|
&& pb->geqs[e].coef[0] == -pb->geqs[e2].coef[0]
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& pb->geqs[e2].color == omega_red)
|
|
|
|
{
|
|
|
|
omega_copy_eqn (&pb->eqs[pb->num_eqs++], &pb->geqs[e],
|
|
|
|
pb->num_vars);
|
|
|
|
gcc_assert (pb->num_eqs <= OMEGA_MAX_EQS);
|
|
|
|
found_something++;
|
|
|
|
is_dead[e] = true;
|
|
|
|
is_dead[e2] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (is_dead[e])
|
|
|
|
omega_delete_geq (pb, e, pb->num_vars);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS) && found_something)
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Coalesced pb->geqs into %d EQ's:\n",
|
|
|
|
found_something);
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
free (is_dead);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Eliminate red inequalities from PB. When ELIMINATE_ALL is
|
|
|
|
true, continue to eliminate all the red inequalities. */
|
|
|
|
|
|
|
|
void
|
|
|
|
omega_eliminate_red (omega_pb pb, bool eliminate_all)
|
|
|
|
{
|
|
|
|
int e, e2, e3, i, j, k, a, alpha1, alpha2;
|
|
|
|
int c = 0;
|
|
|
|
bool *is_dead = XNEWVEC (bool, OMEGA_MAX_GEQS);
|
|
|
|
int dead_count = 0;
|
|
|
|
int red_found;
|
|
|
|
omega_pb tmp_problem;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "in eliminate RED:\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pb->num_eqs > 0)
|
|
|
|
omega_simplify_problem (pb);
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
is_dead[e] = false;
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].color == omega_black && !is_dead[e])
|
|
|
|
for (e2 = e - 1; e2 >= 0; e2--)
|
2009-11-25 11:55:54 +01:00
|
|
|
if (pb->geqs[e2].color == omega_black
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& !is_dead[e2])
|
|
|
|
{
|
|
|
|
a = 0;
|
|
|
|
|
|
|
|
for (i = pb->num_vars; i > 1; i--)
|
|
|
|
for (j = i - 1; j > 0; j--)
|
|
|
|
if ((a = (pb->geqs[e].coef[i] * pb->geqs[e2].coef[j]
|
|
|
|
- pb->geqs[e2].coef[i] * pb->geqs[e].coef[j])) != 0)
|
|
|
|
goto found_pair;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
found_pair:
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
|
|
|
"found two equations to combine, i = %s, ",
|
|
|
|
omega_variable_to_str (pb, i));
|
|
|
|
fprintf (dump_file, "j = %s, alpha = %d\n",
|
|
|
|
omega_variable_to_str (pb, j), a);
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e2]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e3 = pb->num_geqs - 1; e3 >= 0; e3--)
|
|
|
|
if (pb->geqs[e3].color == omega_red)
|
|
|
|
{
|
2009-11-25 11:55:54 +01:00
|
|
|
alpha1 = (pb->geqs[e2].coef[j] * pb->geqs[e3].coef[i]
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
- pb->geqs[e2].coef[i] * pb->geqs[e3].coef[j]);
|
|
|
|
alpha2 = -(pb->geqs[e].coef[j] * pb->geqs[e3].coef[i]
|
|
|
|
- pb->geqs[e].coef[i] * pb->geqs[e3].coef[j]);
|
|
|
|
|
|
|
|
if ((a > 0 && alpha1 > 0 && alpha2 > 0)
|
|
|
|
|| (a < 0 && alpha1 < 0 && alpha2 < 0))
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
|
|
|
"alpha1 = %d, alpha2 = %d;"
|
|
|
|
"comparing against: ",
|
|
|
|
alpha1, alpha2);
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e3]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
for (k = pb->num_vars; k >= 0; k--)
|
|
|
|
{
|
2009-11-25 11:55:54 +01:00
|
|
|
c = (alpha1 * pb->geqs[e].coef[k]
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
+ alpha2 * pb->geqs[e2].coef[k]);
|
|
|
|
|
|
|
|
if (c != a * pb->geqs[e3].coef[k])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS) && k > 0)
|
|
|
|
fprintf (dump_file, " %s: %d, %d\n",
|
|
|
|
omega_variable_to_str (pb, k), c,
|
|
|
|
a * pb->geqs[e3].coef[k]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (k < 0
|
|
|
|
|| (k == 0 &&
|
|
|
|
((a > 0 && c < a * pb->geqs[e3].coef[k])
|
|
|
|
|| (a < 0 && c > a * pb->geqs[e3].coef[k]))))
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
dead_count++;
|
|
|
|
fprintf (dump_file,
|
|
|
|
"red equation#%d is dead "
|
|
|
|
"(%d dead so far, %d remain)\n",
|
|
|
|
e3, dead_count,
|
|
|
|
pb->num_geqs - dead_count);
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e2]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e3]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
is_dead[e3] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (is_dead[e])
|
|
|
|
omega_delete_geq (pb, e, pb->num_vars);
|
|
|
|
|
|
|
|
free (is_dead);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "in eliminate RED, easy tests done:\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (red_found = 0, e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].color == omega_red)
|
2013-07-22 17:20:11 +02:00
|
|
|
{
|
|
|
|
red_found = 1;
|
|
|
|
break;
|
|
|
|
}
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
if (!red_found)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "fast checks worked\n");
|
|
|
|
|
|
|
|
if (!omega_reduce_with_subs)
|
|
|
|
gcc_assert (please_no_equalities_in_simplified_problems
|
|
|
|
|| pb->num_subs == 0);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!omega_verify_simplification
|
|
|
|
&& verify_omega_pb (pb) == omega_false)
|
|
|
|
return;
|
|
|
|
|
|
|
|
conservative++;
|
2009-05-16 08:54:11 +02:00
|
|
|
tmp_problem = XNEW (struct omega_pb_d);
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].color == omega_red)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
|
|
|
"checking equation %d to see if it is redundant: ", e);
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[e]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
omega_copy_problem (tmp_problem, pb);
|
|
|
|
omega_negate_geq (tmp_problem, e);
|
|
|
|
tmp_problem->safe_vars = 0;
|
|
|
|
tmp_problem->variables_freed = false;
|
|
|
|
tmp_problem->num_subs = 0;
|
|
|
|
|
|
|
|
if (omega_solve_problem (tmp_problem, omega_false) == omega_false)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "it is redundant\n");
|
|
|
|
omega_delete_geq (pb, e, pb->num_vars);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "it is not redundant\n");
|
|
|
|
|
|
|
|
if (!eliminate_all)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "no need to check other red equations\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
conservative--;
|
|
|
|
free (tmp_problem);
|
|
|
|
/* omega_simplify_problem (pb); */
|
|
|
|
|
|
|
|
if (!omega_reduce_with_subs)
|
|
|
|
gcc_assert (please_no_equalities_in_simplified_problems
|
|
|
|
|| pb->num_subs == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Transform some wildcard variables to non-safe variables. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
chain_unprotect (omega_pb pb)
|
|
|
|
{
|
|
|
|
int i, e;
|
|
|
|
bool *unprotect = XNEWVEC (bool, OMEGA_MAX_VARS);
|
|
|
|
|
|
|
|
for (i = 1; omega_safe_var_p (pb, i); i++)
|
|
|
|
{
|
|
|
|
unprotect[i] = omega_wildcard_p (pb, i);
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
if (pb->subs[e].coef[i])
|
|
|
|
unprotect[i] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Doing chain reaction unprotection\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
|
|
|
|
for (i = 1; omega_safe_var_p (pb, i); i++)
|
|
|
|
if (unprotect[i])
|
|
|
|
fprintf (dump_file, "unprotecting %s\n",
|
|
|
|
omega_variable_to_str (pb, i));
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 1; omega_safe_var_p (pb, i); i++)
|
|
|
|
if (unprotect[i])
|
|
|
|
omega_unprotect_1 (pb, &i, unprotect);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "After chain reactions\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
free (unprotect);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Reduce problem PB. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
omega_problem_reduced (omega_pb pb)
|
|
|
|
{
|
|
|
|
if (omega_verify_simplification
|
2009-11-25 11:55:54 +01:00
|
|
|
&& !in_approximate_mode
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& verify_omega_pb (pb) == omega_false)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (PARAM_VALUE (PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS)
|
|
|
|
&& !omega_eliminate_redundant (pb, true))
|
|
|
|
return;
|
|
|
|
|
|
|
|
omega_found_reduction = omega_true;
|
|
|
|
|
|
|
|
if (!please_no_equalities_in_simplified_problems)
|
|
|
|
coalesce (pb);
|
|
|
|
|
2009-11-25 11:55:54 +01:00
|
|
|
if (omega_reduce_with_subs
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|| please_no_equalities_in_simplified_problems)
|
|
|
|
chain_unprotect (pb);
|
|
|
|
else
|
|
|
|
resurrect_subs (pb);
|
|
|
|
|
|
|
|
if (!return_single_result)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 1; omega_safe_var_p (pb, i); i++)
|
|
|
|
pb->forwarding_address[pb->var[i]] = i;
|
|
|
|
|
|
|
|
for (i = 0; i < pb->num_subs; i++)
|
|
|
|
pb->forwarding_address[pb->subs[i].key] = -i - 1;
|
|
|
|
|
|
|
|
(*omega_when_reduced) (pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "-------------------------------------------\n");
|
|
|
|
fprintf (dump_file, "problem reduced:\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
fprintf (dump_file, "-------------------------------------------\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Eliminates all the free variables for problem PB, that is all the
|
|
|
|
variables from FV to PB->NUM_VARS. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
omega_free_eliminations (omega_pb pb, int fv)
|
|
|
|
{
|
|
|
|
bool try_again = true;
|
|
|
|
int i, e, e2;
|
|
|
|
int n_vars = pb->num_vars;
|
|
|
|
|
|
|
|
while (try_again)
|
|
|
|
{
|
|
|
|
try_again = false;
|
|
|
|
|
|
|
|
for (i = n_vars; i > fv; i--)
|
|
|
|
{
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].coef[i])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (e < 0)
|
|
|
|
e2 = e;
|
|
|
|
else if (pb->geqs[e].coef[i] > 0)
|
|
|
|
{
|
|
|
|
for (e2 = e - 1; e2 >= 0; e2--)
|
|
|
|
if (pb->geqs[e2].coef[i] < 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (e2 = e - 1; e2 >= 0; e2--)
|
|
|
|
if (pb->geqs[e2].coef[i] > 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (e2 < 0)
|
|
|
|
{
|
|
|
|
int e3;
|
|
|
|
for (e3 = pb->num_subs - 1; e3 >= 0; e3--)
|
|
|
|
if (pb->subs[e3].coef[i])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (e3 >= 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
for (e3 = pb->num_eqs - 1; e3 >= 0; e3--)
|
|
|
|
if (pb->eqs[e3].coef[i])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (e3 >= 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "a free elimination of %s\n",
|
|
|
|
omega_variable_to_str (pb, i));
|
|
|
|
|
|
|
|
if (e >= 0)
|
|
|
|
{
|
|
|
|
omega_delete_geq (pb, e, n_vars);
|
|
|
|
|
|
|
|
for (e--; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].coef[i])
|
|
|
|
omega_delete_geq (pb, e, n_vars);
|
|
|
|
|
|
|
|
try_again = (i < n_vars);
|
|
|
|
}
|
|
|
|
|
|
|
|
omega_delete_variable (pb, i);
|
|
|
|
n_vars = pb->num_vars;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "\nafter free eliminations:\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Do free red eliminations. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
free_red_eliminations (omega_pb pb)
|
|
|
|
{
|
|
|
|
bool try_again = true;
|
|
|
|
int i, e, e2;
|
|
|
|
int n_vars = pb->num_vars;
|
|
|
|
bool *is_red_var = XNEWVEC (bool, OMEGA_MAX_VARS);
|
|
|
|
bool *is_dead_var = XNEWVEC (bool, OMEGA_MAX_VARS);
|
|
|
|
bool *is_dead_geq = XNEWVEC (bool, OMEGA_MAX_GEQS);
|
|
|
|
|
|
|
|
for (i = n_vars; i > 0; i--)
|
|
|
|
{
|
|
|
|
is_red_var[i] = false;
|
|
|
|
is_dead_var[i] = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
is_dead_geq[e] = false;
|
|
|
|
|
|
|
|
if (pb->geqs[e].color == omega_red)
|
|
|
|
for (i = n_vars; i > 0; i--)
|
|
|
|
if (pb->geqs[e].coef[i] != 0)
|
|
|
|
is_red_var[i] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
while (try_again)
|
|
|
|
{
|
|
|
|
try_again = false;
|
|
|
|
for (i = n_vars; i > 0; i--)
|
|
|
|
if (!is_red_var[i] && !is_dead_var[i])
|
|
|
|
{
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (!is_dead_geq[e] && pb->geqs[e].coef[i])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (e < 0)
|
|
|
|
e2 = e;
|
|
|
|
else if (pb->geqs[e].coef[i] > 0)
|
|
|
|
{
|
|
|
|
for (e2 = e - 1; e2 >= 0; e2--)
|
|
|
|
if (!is_dead_geq[e2] && pb->geqs[e2].coef[i] < 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (e2 = e - 1; e2 >= 0; e2--)
|
|
|
|
if (!is_dead_geq[e2] && pb->geqs[e2].coef[i] > 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (e2 < 0)
|
|
|
|
{
|
|
|
|
int e3;
|
|
|
|
for (e3 = pb->num_subs - 1; e3 >= 0; e3--)
|
|
|
|
if (pb->subs[e3].coef[i])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (e3 >= 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
for (e3 = pb->num_eqs - 1; e3 >= 0; e3--)
|
|
|
|
if (pb->eqs[e3].coef[i])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (e3 >= 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "a free red elimination of %s\n",
|
|
|
|
omega_variable_to_str (pb, i));
|
|
|
|
|
|
|
|
for (; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].coef[i])
|
|
|
|
is_dead_geq[e] = true;
|
|
|
|
|
|
|
|
try_again = true;
|
|
|
|
is_dead_var[i] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (is_dead_geq[e])
|
|
|
|
omega_delete_geq (pb, e, n_vars);
|
|
|
|
|
|
|
|
for (i = n_vars; i > 0; i--)
|
|
|
|
if (is_dead_var[i])
|
|
|
|
omega_delete_variable (pb, i);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "\nafter free red eliminations:\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
free (is_red_var);
|
|
|
|
free (is_dead_var);
|
|
|
|
free (is_dead_geq);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* For equation EQ of the form "0 = EQN", insert in PB two
|
|
|
|
inequalities "0 <= EQN" and "0 <= -EQN". */
|
|
|
|
|
|
|
|
void
|
|
|
|
omega_convert_eq_to_geqs (omega_pb pb, int eq)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "Converting Eq to Geqs\n");
|
|
|
|
|
|
|
|
/* Insert "0 <= EQN". */
|
|
|
|
omega_copy_eqn (&pb->geqs[pb->num_geqs], &pb->eqs[eq], pb->num_vars);
|
|
|
|
pb->geqs[pb->num_geqs].touched = 1;
|
|
|
|
pb->num_geqs++;
|
|
|
|
|
|
|
|
/* Insert "0 <= -EQN". */
|
|
|
|
omega_copy_eqn (&pb->geqs[pb->num_geqs], &pb->eqs[eq], pb->num_vars);
|
|
|
|
pb->geqs[pb->num_geqs].touched = 1;
|
|
|
|
|
|
|
|
for (i = 0; i <= pb->num_vars; i++)
|
|
|
|
pb->geqs[pb->num_geqs].coef[i] *= -1;
|
|
|
|
|
|
|
|
pb->num_geqs++;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Eliminates variable I from PB. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
omega_do_elimination (omega_pb pb, int e, int i)
|
|
|
|
{
|
|
|
|
eqn sub = omega_alloc_eqns (0, 1);
|
|
|
|
int c;
|
|
|
|
int n_vars = pb->num_vars;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "eliminating variable %s\n",
|
|
|
|
omega_variable_to_str (pb, i));
|
|
|
|
|
|
|
|
omega_copy_eqn (sub, &pb->eqs[e], pb->num_vars);
|
|
|
|
c = sub->coef[i];
|
|
|
|
sub->coef[i] = 0;
|
|
|
|
if (c == 1 || c == -1)
|
|
|
|
{
|
|
|
|
if (pb->eqs[e].color == omega_red)
|
|
|
|
{
|
|
|
|
bool fB;
|
|
|
|
omega_substitute_red (pb, sub, i, c, &fB);
|
|
|
|
if (fB)
|
|
|
|
omega_convert_eq_to_geqs (pb, e);
|
|
|
|
else
|
|
|
|
omega_delete_variable (pb, i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
omega_substitute (pb, sub, i, c);
|
|
|
|
omega_delete_variable (pb, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int a = abs (c);
|
|
|
|
int e2 = e;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "performing non-exact elimination, c = %d\n", c);
|
|
|
|
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
if (pb->eqs[e].coef[i])
|
|
|
|
{
|
|
|
|
eqn eqn = &(pb->eqs[e]);
|
|
|
|
int j, k;
|
|
|
|
for (j = n_vars; j >= 0; j--)
|
|
|
|
eqn->coef[j] *= a;
|
|
|
|
k = eqn->coef[i];
|
|
|
|
eqn->coef[i] = 0;
|
2009-04-24 17:31:38 +02:00
|
|
|
if (sub->color == omega_red)
|
|
|
|
eqn->color = omega_red;
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
for (j = n_vars; j >= 0; j--)
|
|
|
|
eqn->coef[j] -= sub->coef[j] * k / c;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].coef[i])
|
|
|
|
{
|
|
|
|
eqn eqn = &(pb->geqs[e]);
|
|
|
|
int j, k;
|
|
|
|
|
|
|
|
if (sub->color == omega_red)
|
|
|
|
eqn->color = omega_red;
|
|
|
|
|
|
|
|
for (j = n_vars; j >= 0; j--)
|
|
|
|
eqn->coef[j] *= a;
|
|
|
|
|
|
|
|
eqn->touched = 1;
|
|
|
|
k = eqn->coef[i];
|
|
|
|
eqn->coef[i] = 0;
|
|
|
|
|
|
|
|
for (j = n_vars; j >= 0; j--)
|
|
|
|
eqn->coef[j] -= sub->coef[j] * k / c;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
if (pb->subs[e].coef[i])
|
|
|
|
{
|
|
|
|
eqn eqn = &(pb->subs[e]);
|
|
|
|
int j, k;
|
|
|
|
gcc_assert (0);
|
|
|
|
gcc_assert (sub->color == omega_black);
|
|
|
|
for (j = n_vars; j >= 0; j--)
|
|
|
|
eqn->coef[j] *= a;
|
|
|
|
k = eqn->coef[i];
|
|
|
|
eqn->coef[i] = 0;
|
|
|
|
for (j = n_vars; j >= 0; j--)
|
|
|
|
eqn->coef[j] -= sub->coef[j] * k / c;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_approximate_mode)
|
|
|
|
omega_delete_variable (pb, i);
|
|
|
|
else
|
|
|
|
omega_convert_eq_to_geqs (pb, e2);
|
|
|
|
}
|
|
|
|
|
|
|
|
omega_free_eqns (sub, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Helper function for printing "sorry, no solution". */
|
|
|
|
|
|
|
|
static inline enum omega_result
|
|
|
|
omega_problem_has_no_solution (void)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "\nequations have no solution \n");
|
|
|
|
|
|
|
|
return omega_false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Helper function: solve equations in PB one at a time, following the
|
|
|
|
DESIRED_RES result. */
|
|
|
|
|
|
|
|
static enum omega_result
|
|
|
|
omega_solve_eq (omega_pb pb, enum omega_result desired_res)
|
|
|
|
{
|
|
|
|
int i, j, e;
|
|
|
|
int g, g2;
|
|
|
|
g = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS) && pb->num_eqs > 0)
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "\nomega_solve_eq (%d, %d)\n",
|
|
|
|
desired_res, may_be_red);
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (may_be_red)
|
|
|
|
{
|
|
|
|
i = 0;
|
|
|
|
j = pb->num_eqs - 1;
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
eqn eq;
|
|
|
|
|
|
|
|
while (i <= j && pb->eqs[i].color == omega_red)
|
|
|
|
i++;
|
|
|
|
|
|
|
|
while (i <= j && pb->eqs[j].color == omega_black)
|
|
|
|
j--;
|
|
|
|
|
|
|
|
if (i >= j)
|
|
|
|
break;
|
|
|
|
|
|
|
|
eq = omega_alloc_eqns (0, 1);
|
|
|
|
omega_copy_eqn (eq, &pb->eqs[i], pb->num_vars);
|
|
|
|
omega_copy_eqn (&pb->eqs[i], &pb->eqs[j], pb->num_vars);
|
|
|
|
omega_copy_eqn (&pb->eqs[j], eq, pb->num_vars);
|
|
|
|
omega_free_eqns (eq, 1);
|
|
|
|
i++;
|
|
|
|
j--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Eliminate all EQ equations */
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
eqn eqn = &(pb->eqs[e]);
|
|
|
|
int sv;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "----\n");
|
|
|
|
|
|
|
|
for (i = pb->num_vars; i > 0; i--)
|
|
|
|
if (eqn->coef[i])
|
|
|
|
break;
|
|
|
|
|
|
|
|
g = eqn->coef[i];
|
|
|
|
|
|
|
|
for (j = i - 1; j > 0; j--)
|
|
|
|
if (eqn->coef[j])
|
|
|
|
break;
|
|
|
|
|
i386.c, [...]: Fix comment typos.
* config/i386/i386.c, config/pa/pa.c, config/spu/spu.c,
df-problems.c, df-scan.c, domwalk.c, ebitmap.c, ebitmap.h,
fold-const.c, gcc.c, ipa-type-escape.c, omega.c, omega.h,
tree-ssa-coalesce.c, tree-ssa-live.c, tree-ssa-structalias.c,
tree-vrp.c: Fix comment typos. Follow spelling conventions.
* doc/tm.texi: Follow spelling conventions.
From-SVN: r125090
2007-05-26 15:00:47 +02:00
|
|
|
/* i is the position of last nonzero coefficient,
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
g is the coefficient of i,
|
i386.c, [...]: Fix comment typos.
* config/i386/i386.c, config/pa/pa.c, config/spu/spu.c,
df-problems.c, df-scan.c, domwalk.c, ebitmap.c, ebitmap.h,
fold-const.c, gcc.c, ipa-type-escape.c, omega.c, omega.h,
tree-ssa-coalesce.c, tree-ssa-live.c, tree-ssa-structalias.c,
tree-vrp.c: Fix comment typos. Follow spelling conventions.
* doc/tm.texi: Follow spelling conventions.
From-SVN: r125090
2007-05-26 15:00:47 +02:00
|
|
|
j is the position of next nonzero coefficient. */
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
if (j == 0)
|
|
|
|
{
|
|
|
|
if (eqn->coef[0] % g != 0)
|
|
|
|
return omega_problem_has_no_solution ();
|
|
|
|
|
|
|
|
eqn->coef[0] = eqn->coef[0] / g;
|
|
|
|
eqn->coef[i] = 1;
|
|
|
|
pb->num_eqs--;
|
|
|
|
omega_do_elimination (pb, e, i);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (j == -1)
|
|
|
|
{
|
|
|
|
if (eqn->coef[0] != 0)
|
|
|
|
return omega_problem_has_no_solution ();
|
|
|
|
|
|
|
|
pb->num_eqs--;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g < 0)
|
|
|
|
g = -g;
|
|
|
|
|
|
|
|
if (g == 1)
|
|
|
|
{
|
|
|
|
pb->num_eqs--;
|
|
|
|
omega_do_elimination (pb, e, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int k = j;
|
|
|
|
bool promotion_possible =
|
|
|
|
(omega_safe_var_p (pb, j)
|
|
|
|
&& pb->safe_vars + 1 == i
|
|
|
|
&& !omega_eqn_is_red (eqn, desired_res)
|
|
|
|
&& !in_approximate_mode);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS) && promotion_possible)
|
|
|
|
fprintf (dump_file, " Promotion possible\n");
|
|
|
|
|
|
|
|
normalizeEQ:
|
|
|
|
if (!omega_safe_var_p (pb, j))
|
|
|
|
{
|
|
|
|
for (; g != 1 && !omega_safe_var_p (pb, j); j--)
|
|
|
|
g = gcd (abs (eqn->coef[j]), g);
|
|
|
|
g2 = g;
|
|
|
|
}
|
|
|
|
else if (!omega_safe_var_p (pb, i))
|
|
|
|
g2 = g;
|
|
|
|
else
|
|
|
|
g2 = 0;
|
|
|
|
|
|
|
|
for (; g != 1 && j > 0; j--)
|
|
|
|
g = gcd (abs (eqn->coef[j]), g);
|
|
|
|
|
|
|
|
if (g > 1)
|
|
|
|
{
|
|
|
|
if (eqn->coef[0] % g != 0)
|
|
|
|
return omega_problem_has_no_solution ();
|
|
|
|
|
|
|
|
for (j = 0; j <= pb->num_vars; j++)
|
|
|
|
eqn->coef[j] /= g;
|
|
|
|
|
|
|
|
g2 = g2 / g;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g2 > 1)
|
|
|
|
{
|
|
|
|
int e2;
|
|
|
|
|
|
|
|
for (e2 = e - 1; e2 >= 0; e2--)
|
|
|
|
if (pb->eqs[e2].coef[i])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (e2 == -1)
|
|
|
|
for (e2 = pb->num_geqs - 1; e2 >= 0; e2--)
|
|
|
|
if (pb->geqs[e2].coef[i])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (e2 == -1)
|
|
|
|
for (e2 = pb->num_subs - 1; e2 >= 0; e2--)
|
|
|
|
if (pb->subs[e2].coef[i])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (e2 == -1)
|
|
|
|
{
|
|
|
|
bool change = false;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Ha! We own it! \n");
|
|
|
|
omega_print_eq (dump_file, pb, eqn);
|
|
|
|
fprintf (dump_file, " \n");
|
|
|
|
}
|
|
|
|
|
|
|
|
g = eqn->coef[i];
|
|
|
|
g = abs (g);
|
|
|
|
|
|
|
|
for (j = i - 1; j >= 0; j--)
|
|
|
|
{
|
|
|
|
int t = int_mod (eqn->coef[j], g);
|
|
|
|
|
|
|
|
if (2 * t >= g)
|
|
|
|
t -= g;
|
|
|
|
|
|
|
|
if (t != eqn->coef[j])
|
|
|
|
{
|
|
|
|
eqn->coef[j] = t;
|
|
|
|
change = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!change)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "So what?\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
{
|
|
|
|
omega_name_wild_card (pb, i);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
omega_print_eq (dump_file, pb, eqn);
|
|
|
|
fprintf (dump_file, " \n");
|
|
|
|
}
|
|
|
|
|
|
|
|
e++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (promotion_possible)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "promoting %s to safety\n",
|
|
|
|
omega_variable_to_str (pb, i));
|
|
|
|
omega_print_vars (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->safe_vars++;
|
|
|
|
|
|
|
|
if (!omega_wildcard_p (pb, i))
|
|
|
|
omega_name_wild_card (pb, i);
|
|
|
|
|
|
|
|
promotion_possible = false;
|
|
|
|
j = k;
|
|
|
|
goto normalizeEQ;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g2 > 1 && !in_approximate_mode)
|
|
|
|
{
|
|
|
|
if (pb->eqs[e].color == omega_red)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "handling red equality\n");
|
|
|
|
|
|
|
|
pb->num_eqs--;
|
|
|
|
omega_do_elimination (pb, e, i);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
|
|
|
"adding equation to handle safe variable \n");
|
|
|
|
omega_print_eq (dump_file, pb, eqn);
|
|
|
|
fprintf (dump_file, "\n----\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
fprintf (dump_file, "\n----\n");
|
|
|
|
fprintf (dump_file, "\n----\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
i = omega_add_new_wild_card (pb);
|
|
|
|
pb->num_eqs++;
|
|
|
|
gcc_assert (pb->num_eqs <= OMEGA_MAX_EQS);
|
|
|
|
omega_init_eqn_zero (&pb->eqs[e + 1], pb->num_vars);
|
|
|
|
omega_copy_eqn (&pb->eqs[e + 1], eqn, pb->safe_vars);
|
|
|
|
|
|
|
|
for (j = pb->num_vars; j >= 0; j--)
|
|
|
|
{
|
|
|
|
pb->eqs[e + 1].coef[j] = int_mod (pb->eqs[e + 1].coef[j], g2);
|
|
|
|
|
|
|
|
if (2 * pb->eqs[e + 1].coef[j] >= g2)
|
|
|
|
pb->eqs[e + 1].coef[j] -= g2;
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->eqs[e + 1].coef[i] = g2;
|
|
|
|
e += 2;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
sv = pb->safe_vars;
|
|
|
|
if (g2 == 0)
|
|
|
|
sv = 0;
|
|
|
|
|
|
|
|
/* Find variable to eliminate. */
|
|
|
|
if (g2 > 1)
|
|
|
|
{
|
|
|
|
gcc_assert (in_approximate_mode);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "non-exact elimination: ");
|
|
|
|
omega_print_eq (dump_file, pb, eqn);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = pb->num_vars; i > sv; i--)
|
|
|
|
if (pb->eqs[e].coef[i] != 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
for (i = pb->num_vars; i > sv; i--)
|
|
|
|
if (pb->eqs[e].coef[i] == 1 || pb->eqs[e].coef[i] == -1)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (i > sv)
|
|
|
|
{
|
|
|
|
pb->num_eqs--;
|
|
|
|
omega_do_elimination (pb, e, i);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS) && g2 > 1)
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "result of non-exact elimination:\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int factor = (INT_MAX);
|
|
|
|
j = 0;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "doing moding\n");
|
|
|
|
|
|
|
|
for (i = pb->num_vars; i != sv; i--)
|
|
|
|
if ((pb->eqs[e].coef[i] & 1) != 0)
|
|
|
|
{
|
|
|
|
j = i;
|
|
|
|
i--;
|
|
|
|
|
|
|
|
for (; i != sv; i--)
|
|
|
|
if ((pb->eqs[e].coef[i] & 1) != 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (j != 0 && i == sv)
|
|
|
|
{
|
|
|
|
omega_do_mod (pb, 2, e, j);
|
|
|
|
e++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
for (i = pb->num_vars; i != sv; i--)
|
2009-11-25 11:55:54 +01:00
|
|
|
if (pb->eqs[e].coef[i] != 0
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& factor > abs (pb->eqs[e].coef[i]) + 1)
|
|
|
|
{
|
|
|
|
factor = abs (pb->eqs[e].coef[i]) + 1;
|
|
|
|
j = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (j == sv)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "should not have happened\n");
|
|
|
|
gcc_assert (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
omega_do_mod (pb, factor, e, j);
|
|
|
|
/* Go back and try this equation again. */
|
|
|
|
e++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->num_eqs = 0;
|
|
|
|
return omega_unknown;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Transform an inequation E to an equality, then solve DIFF problems
|
|
|
|
based on PB, and only differing by the constant part that is
|
|
|
|
diminished by one, trying to figure out which of the constants
|
|
|
|
satisfies PB. */
|
|
|
|
|
|
|
|
static enum omega_result
|
|
|
|
parallel_splinter (omega_pb pb, int e, int diff,
|
|
|
|
enum omega_result desired_res)
|
|
|
|
{
|
|
|
|
omega_pb tmp_problem;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Using parallel splintering\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
2009-05-16 08:54:11 +02:00
|
|
|
tmp_problem = XNEW (struct omega_pb_d);
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
omega_copy_eqn (&pb->eqs[0], &pb->geqs[e], pb->num_vars);
|
|
|
|
pb->num_eqs = 1;
|
|
|
|
|
|
|
|
for (i = 0; i <= diff; i++)
|
|
|
|
{
|
|
|
|
omega_copy_problem (tmp_problem, pb);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Splinter # %i\n", i);
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (omega_solve_problem (tmp_problem, desired_res) == omega_true)
|
|
|
|
{
|
|
|
|
free (tmp_problem);
|
|
|
|
return omega_true;
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->eqs[0].coef[0]--;
|
|
|
|
}
|
|
|
|
|
|
|
|
free (tmp_problem);
|
|
|
|
return omega_false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Helper function: solve equations one at a time. */
|
|
|
|
|
|
|
|
static enum omega_result
|
|
|
|
omega_solve_geq (omega_pb pb, enum omega_result desired_res)
|
|
|
|
{
|
|
|
|
int i, e;
|
|
|
|
int n_vars, fv;
|
|
|
|
enum omega_result result;
|
|
|
|
bool coupled_subscripts = false;
|
|
|
|
bool smoothed = false;
|
|
|
|
bool eliminate_again;
|
|
|
|
bool tried_eliminating_redundant = false;
|
|
|
|
|
|
|
|
if (desired_res != omega_simplify)
|
|
|
|
{
|
|
|
|
pb->num_subs = 0;
|
|
|
|
pb->safe_vars = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
solve_geq_start:
|
|
|
|
do {
|
|
|
|
gcc_assert (desired_res == omega_simplify || pb->num_subs == 0);
|
|
|
|
|
|
|
|
/* Verify that there are not too many inequalities. */
|
|
|
|
gcc_assert (pb->num_geqs <= OMEGA_MAX_GEQS);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "\nomega_solve_geq (%d,%d):\n",
|
|
|
|
desired_res, please_no_equalities_in_simplified_problems);
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
n_vars = pb->num_vars;
|
|
|
|
|
|
|
|
if (n_vars == 1)
|
|
|
|
{
|
|
|
|
enum omega_eqn_color u_color = omega_black;
|
|
|
|
enum omega_eqn_color l_color = omega_black;
|
|
|
|
int upper_bound = pos_infinity;
|
|
|
|
int lower_bound = neg_infinity;
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
int a = pb->geqs[e].coef[1];
|
|
|
|
int c = pb->geqs[e].coef[0];
|
|
|
|
|
|
|
|
/* Our equation is ax + c >= 0, or ax >= -c, or c >= -ax. */
|
|
|
|
if (a == 0)
|
|
|
|
{
|
|
|
|
if (c < 0)
|
|
|
|
return omega_problem_has_no_solution ();
|
|
|
|
}
|
|
|
|
else if (a > 0)
|
|
|
|
{
|
|
|
|
if (a != 1)
|
|
|
|
c = int_div (c, a);
|
|
|
|
|
|
|
|
if (lower_bound < -c
|
|
|
|
|| (lower_bound == -c
|
|
|
|
&& !omega_eqn_is_red (&pb->geqs[e], desired_res)))
|
|
|
|
{
|
|
|
|
lower_bound = -c;
|
|
|
|
l_color = pb->geqs[e].color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (a != -1)
|
|
|
|
c = int_div (c, -a);
|
|
|
|
|
|
|
|
if (upper_bound > c
|
2009-11-25 11:55:54 +01:00
|
|
|
|| (upper_bound == c
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& !omega_eqn_is_red (&pb->geqs[e], desired_res)))
|
|
|
|
{
|
|
|
|
upper_bound = c;
|
|
|
|
u_color = pb->geqs[e].color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "upper bound = %d\n", upper_bound);
|
|
|
|
fprintf (dump_file, "lower bound = %d\n", lower_bound);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lower_bound > upper_bound)
|
|
|
|
return omega_problem_has_no_solution ();
|
|
|
|
|
|
|
|
if (desired_res == omega_simplify)
|
|
|
|
{
|
|
|
|
pb->num_geqs = 0;
|
|
|
|
if (pb->safe_vars == 1)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (lower_bound == upper_bound
|
|
|
|
&& u_color == omega_black
|
|
|
|
&& l_color == omega_black)
|
|
|
|
{
|
|
|
|
pb->eqs[0].coef[0] = -lower_bound;
|
|
|
|
pb->eqs[0].coef[1] = 1;
|
|
|
|
pb->eqs[0].color = omega_black;
|
|
|
|
pb->num_eqs = 1;
|
|
|
|
return omega_solve_problem (pb, desired_res);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (lower_bound > neg_infinity)
|
|
|
|
{
|
|
|
|
pb->geqs[0].coef[0] = -lower_bound;
|
|
|
|
pb->geqs[0].coef[1] = 1;
|
|
|
|
pb->geqs[0].key = 1;
|
|
|
|
pb->geqs[0].color = l_color;
|
|
|
|
pb->geqs[0].touched = 0;
|
|
|
|
pb->num_geqs = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (upper_bound < pos_infinity)
|
|
|
|
{
|
|
|
|
pb->geqs[pb->num_geqs].coef[0] = upper_bound;
|
|
|
|
pb->geqs[pb->num_geqs].coef[1] = -1;
|
|
|
|
pb->geqs[pb->num_geqs].key = -1;
|
|
|
|
pb->geqs[pb->num_geqs].color = u_color;
|
|
|
|
pb->geqs[pb->num_geqs].touched = 0;
|
|
|
|
pb->num_geqs++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pb->num_vars = 0;
|
|
|
|
|
|
|
|
omega_problem_reduced (pb);
|
|
|
|
return omega_false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (original_problem != no_problem
|
|
|
|
&& l_color == omega_black
|
|
|
|
&& u_color == omega_black
|
|
|
|
&& !conservative
|
|
|
|
&& lower_bound == upper_bound)
|
|
|
|
{
|
|
|
|
pb->eqs[0].coef[0] = -lower_bound;
|
|
|
|
pb->eqs[0].coef[1] = 1;
|
|
|
|
pb->num_eqs = 1;
|
|
|
|
adding_equality_constraint (pb, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return omega_true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pb->variables_freed)
|
|
|
|
{
|
|
|
|
pb->variables_freed = true;
|
|
|
|
|
|
|
|
if (desired_res != omega_simplify)
|
|
|
|
omega_free_eliminations (pb, 0);
|
|
|
|
else
|
|
|
|
omega_free_eliminations (pb, pb->safe_vars);
|
|
|
|
|
|
|
|
n_vars = pb->num_vars;
|
|
|
|
|
|
|
|
if (n_vars == 1)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (normalize_omega_problem (pb))
|
|
|
|
{
|
|
|
|
case normalize_false:
|
|
|
|
return omega_false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case normalize_coupled:
|
|
|
|
coupled_subscripts = true;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case normalize_uncoupled:
|
|
|
|
coupled_subscripts = false;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
gcc_unreachable ();
|
|
|
|
}
|
|
|
|
|
|
|
|
n_vars = pb->num_vars;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "\nafter normalization:\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
fprintf (dump_file, "eliminating variable using Fourier-Motzkin.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
|
|
|
int parallel_difference = INT_MAX;
|
|
|
|
int best_parallel_eqn = -1;
|
|
|
|
int minC, maxC, minCj = 0;
|
|
|
|
int lower_bound_count = 0;
|
|
|
|
int e2, Le = 0, Ue;
|
|
|
|
bool possible_easy_int_solution;
|
|
|
|
int max_splinters = 1;
|
|
|
|
bool exact = false;
|
|
|
|
bool lucky_exact = false;
|
|
|
|
int best = (INT_MAX);
|
|
|
|
int j = 0, jLe = 0, jLowerBoundCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
eliminate_again = false;
|
|
|
|
|
|
|
|
if (pb->num_eqs > 0)
|
|
|
|
return omega_solve_problem (pb, desired_res);
|
|
|
|
|
|
|
|
if (!coupled_subscripts)
|
|
|
|
{
|
|
|
|
if (pb->safe_vars == 0)
|
|
|
|
pb->num_geqs = 0;
|
|
|
|
else
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (!omega_safe_var_p (pb, abs (pb->geqs[e].key)))
|
|
|
|
omega_delete_geq (pb, e, n_vars);
|
|
|
|
|
|
|
|
pb->num_vars = pb->safe_vars;
|
|
|
|
|
|
|
|
if (desired_res == omega_simplify)
|
|
|
|
{
|
|
|
|
omega_problem_reduced (pb);
|
|
|
|
return omega_false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return omega_true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (desired_res != omega_simplify)
|
|
|
|
fv = 0;
|
|
|
|
else
|
|
|
|
fv = pb->safe_vars;
|
|
|
|
|
|
|
|
if (pb->num_geqs == 0)
|
|
|
|
{
|
|
|
|
if (desired_res == omega_simplify)
|
|
|
|
{
|
|
|
|
pb->num_vars = pb->safe_vars;
|
|
|
|
omega_problem_reduced (pb);
|
|
|
|
return omega_false;
|
|
|
|
}
|
|
|
|
return omega_true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (desired_res == omega_simplify && n_vars == pb->safe_vars)
|
|
|
|
{
|
|
|
|
omega_problem_reduced (pb);
|
|
|
|
return omega_false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pb->num_geqs > OMEGA_MAX_GEQS - 30
|
|
|
|
|| pb->num_geqs > 2 * n_vars * n_vars + 4 * n_vars + 10)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"TOO MANY EQUATIONS; "
|
|
|
|
"%d equations, %d variables, "
|
|
|
|
"ELIMINATING REDUNDANT ONES\n",
|
|
|
|
pb->num_geqs, n_vars);
|
|
|
|
|
|
|
|
if (!omega_eliminate_redundant (pb, false))
|
|
|
|
return omega_false;
|
|
|
|
|
|
|
|
n_vars = pb->num_vars;
|
|
|
|
|
|
|
|
if (pb->num_eqs > 0)
|
|
|
|
return omega_solve_problem (pb, desired_res);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "END ELIMINATION OF REDUNDANT EQUATIONS\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (desired_res != omega_simplify)
|
|
|
|
fv = 0;
|
|
|
|
else
|
|
|
|
fv = pb->safe_vars;
|
|
|
|
|
|
|
|
for (i = n_vars; i != fv; i--)
|
|
|
|
{
|
|
|
|
int score;
|
|
|
|
int ub = -2;
|
|
|
|
int lb = -2;
|
|
|
|
bool lucky = false;
|
|
|
|
int upper_bound_count = 0;
|
|
|
|
|
|
|
|
lower_bound_count = 0;
|
|
|
|
minC = maxC = 0;
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].coef[i] < 0)
|
|
|
|
{
|
|
|
|
minC = MIN (minC, pb->geqs[e].coef[i]);
|
|
|
|
upper_bound_count++;
|
|
|
|
if (pb->geqs[e].coef[i] < -1)
|
|
|
|
{
|
|
|
|
if (ub == -2)
|
|
|
|
ub = e;
|
|
|
|
else
|
|
|
|
ub = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (pb->geqs[e].coef[i] > 0)
|
|
|
|
{
|
|
|
|
maxC = MAX (maxC, pb->geqs[e].coef[i]);
|
|
|
|
lower_bound_count++;
|
|
|
|
Le = e;
|
|
|
|
if (pb->geqs[e].coef[i] > 1)
|
|
|
|
{
|
|
|
|
if (lb == -2)
|
|
|
|
lb = e;
|
|
|
|
else
|
|
|
|
lb = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lower_bound_count == 0
|
|
|
|
|| upper_bound_count == 0)
|
|
|
|
{
|
|
|
|
lower_bound_count = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ub >= 0 && lb >= 0
|
|
|
|
&& pb->geqs[lb].key == -pb->geqs[ub].key)
|
|
|
|
{
|
|
|
|
int Lc = pb->geqs[lb].coef[i];
|
|
|
|
int Uc = -pb->geqs[ub].coef[i];
|
|
|
|
int diff =
|
|
|
|
Lc * pb->geqs[ub].coef[0] + Uc * pb->geqs[lb].coef[0];
|
|
|
|
lucky = (diff >= (Uc - 1) * (Lc - 1));
|
|
|
|
}
|
|
|
|
|
2009-11-25 11:55:54 +01:00
|
|
|
if (maxC == 1
|
|
|
|
|| minC == -1
|
|
|
|
|| lucky
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|| in_approximate_mode)
|
|
|
|
{
|
2009-11-28 17:21:00 +01:00
|
|
|
score = upper_bound_count * lower_bound_count;
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"For %s, exact, score = %d*%d, range = %d ... %d,"
|
|
|
|
"\nlucky = %d, in_approximate_mode=%d \n",
|
|
|
|
omega_variable_to_str (pb, i),
|
|
|
|
upper_bound_count,
|
2009-11-25 11:55:54 +01:00
|
|
|
lower_bound_count, minC, maxC, lucky,
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
in_approximate_mode);
|
|
|
|
|
|
|
|
if (!exact
|
|
|
|
|| score < best)
|
|
|
|
{
|
|
|
|
|
|
|
|
best = score;
|
|
|
|
j = i;
|
|
|
|
minCj = minC;
|
|
|
|
jLe = Le;
|
|
|
|
jLowerBoundCount = lower_bound_count;
|
|
|
|
exact = true;
|
|
|
|
lucky_exact = lucky;
|
|
|
|
if (score == 1)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!exact)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"For %s, non-exact, score = %d*%d,"
|
|
|
|
"range = %d ... %d \n",
|
|
|
|
omega_variable_to_str (pb, i),
|
|
|
|
upper_bound_count,
|
|
|
|
lower_bound_count, minC, maxC);
|
|
|
|
|
|
|
|
score = maxC - minC;
|
|
|
|
|
|
|
|
if (best > score)
|
|
|
|
{
|
|
|
|
best = score;
|
|
|
|
j = i;
|
|
|
|
minCj = minC;
|
|
|
|
jLe = Le;
|
|
|
|
jLowerBoundCount = lower_bound_count;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lower_bound_count == 0)
|
|
|
|
{
|
|
|
|
omega_free_eliminations (pb, pb->safe_vars);
|
|
|
|
n_vars = pb->num_vars;
|
|
|
|
eliminate_again = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = j;
|
|
|
|
minC = minCj;
|
|
|
|
Le = jLe;
|
|
|
|
lower_bound_count = jLowerBoundCount;
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].coef[i] > 0)
|
|
|
|
{
|
|
|
|
if (pb->geqs[e].coef[i] == -minC)
|
|
|
|
max_splinters += -minC - 1;
|
|
|
|
else
|
|
|
|
max_splinters +=
|
2011-08-01 23:53:07 +02:00
|
|
|
pos_mul_hwi ((pb->geqs[e].coef[i] - 1),
|
|
|
|
(-minC - 1)) / (-minC) + 1;
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* #ifdef Omega3 */
|
|
|
|
/* Trying to produce exact elimination by finding redundant
|
|
|
|
constraints. */
|
|
|
|
if (!exact && !tried_eliminating_redundant)
|
|
|
|
{
|
|
|
|
omega_eliminate_redundant (pb, false);
|
|
|
|
tried_eliminating_redundant = true;
|
|
|
|
eliminate_again = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
tried_eliminating_redundant = false;
|
|
|
|
/* #endif */
|
|
|
|
|
|
|
|
if (return_single_result && desired_res == omega_simplify && !exact)
|
|
|
|
{
|
|
|
|
omega_problem_reduced (pb);
|
|
|
|
return omega_true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* #ifndef Omega3 */
|
|
|
|
/* Trying to produce exact elimination by finding redundant
|
|
|
|
constraints. */
|
|
|
|
if (!exact && !tried_eliminating_redundant)
|
|
|
|
{
|
|
|
|
omega_eliminate_redundant (pb, false);
|
|
|
|
tried_eliminating_redundant = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
tried_eliminating_redundant = false;
|
|
|
|
/* #endif */
|
|
|
|
|
|
|
|
if (!exact)
|
|
|
|
{
|
|
|
|
int e1, e2;
|
|
|
|
|
|
|
|
for (e1 = pb->num_geqs - 1; e1 >= 0; e1--)
|
|
|
|
if (pb->geqs[e1].color == omega_black)
|
|
|
|
for (e2 = e1 - 1; e2 >= 0; e2--)
|
|
|
|
if (pb->geqs[e2].color == omega_black
|
|
|
|
&& pb->geqs[e1].key == -pb->geqs[e2].key
|
|
|
|
&& ((pb->geqs[e1].coef[0] + pb->geqs[e2].coef[0])
|
|
|
|
* (3 - single_var_geq (&pb->geqs[e1], pb->num_vars))
|
|
|
|
/ 2 < parallel_difference))
|
|
|
|
{
|
|
|
|
parallel_difference =
|
|
|
|
(pb->geqs[e1].coef[0] + pb->geqs[e2].coef[0])
|
|
|
|
* (3 - single_var_geq (&pb->geqs[e1], pb->num_vars))
|
|
|
|
/ 2;
|
|
|
|
best_parallel_eqn = e1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS)
|
|
|
|
&& best_parallel_eqn >= 0)
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
|
|
|
"Possible parallel projection, diff = %d, in ",
|
|
|
|
parallel_difference);
|
|
|
|
omega_print_geq (dump_file, pb, &(pb->geqs[best_parallel_eqn]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "going to eliminate %s, (%d,%d,%d)\n",
|
|
|
|
omega_variable_to_str (pb, i), i, minC,
|
|
|
|
lower_bound_count);
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
|
|
|
|
if (lucky_exact)
|
|
|
|
fprintf (dump_file, "(a lucky exact elimination)\n");
|
|
|
|
|
|
|
|
else if (exact)
|
|
|
|
fprintf (dump_file, "(an exact elimination)\n");
|
|
|
|
|
|
|
|
fprintf (dump_file, "Max # of splinters = %d\n", max_splinters);
|
|
|
|
}
|
|
|
|
|
|
|
|
gcc_assert (max_splinters >= 1);
|
|
|
|
|
|
|
|
if (!exact && desired_res == omega_simplify && best_parallel_eqn >= 0
|
|
|
|
&& parallel_difference <= max_splinters)
|
|
|
|
return parallel_splinter (pb, best_parallel_eqn, parallel_difference,
|
|
|
|
desired_res);
|
|
|
|
|
|
|
|
smoothed = false;
|
|
|
|
|
|
|
|
if (i != n_vars)
|
|
|
|
{
|
|
|
|
int t;
|
|
|
|
int j = pb->num_vars;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Swapping %d and %d\n", i, j);
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
swap (&pb->var[i], &pb->var[j]);
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].coef[i] != pb->geqs[e].coef[j])
|
|
|
|
{
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
t = pb->geqs[e].coef[i];
|
|
|
|
pb->geqs[e].coef[i] = pb->geqs[e].coef[j];
|
|
|
|
pb->geqs[e].coef[j] = t;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
if (pb->subs[e].coef[i] != pb->subs[e].coef[j])
|
|
|
|
{
|
|
|
|
t = pb->subs[e].coef[i];
|
|
|
|
pb->subs[e].coef[i] = pb->subs[e].coef[j];
|
|
|
|
pb->subs[e].coef[j] = t;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Swapping complete \n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
i = j;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "No swap needed\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->num_vars--;
|
|
|
|
n_vars = pb->num_vars;
|
|
|
|
|
|
|
|
if (exact)
|
|
|
|
{
|
|
|
|
if (n_vars == 1)
|
|
|
|
{
|
|
|
|
int upper_bound = pos_infinity;
|
|
|
|
int lower_bound = neg_infinity;
|
|
|
|
enum omega_eqn_color ub_color = omega_black;
|
|
|
|
enum omega_eqn_color lb_color = omega_black;
|
|
|
|
int topeqn = pb->num_geqs - 1;
|
|
|
|
int Lc = pb->geqs[Le].coef[i];
|
|
|
|
|
|
|
|
for (Le = topeqn; Le >= 0; Le--)
|
|
|
|
if ((Lc = pb->geqs[Le].coef[i]) == 0)
|
|
|
|
{
|
|
|
|
if (pb->geqs[Le].coef[1] == 1)
|
|
|
|
{
|
|
|
|
int constantTerm = -pb->geqs[Le].coef[0];
|
|
|
|
|
|
|
|
if (constantTerm > lower_bound ||
|
|
|
|
(constantTerm == lower_bound &&
|
|
|
|
!omega_eqn_is_red (&pb->geqs[Le], desired_res)))
|
|
|
|
{
|
|
|
|
lower_bound = constantTerm;
|
|
|
|
lb_color = pb->geqs[Le].color;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
if (pb->geqs[Le].color == omega_black)
|
|
|
|
fprintf (dump_file, " :::=> %s >= %d\n",
|
|
|
|
omega_variable_to_str (pb, 1),
|
|
|
|
constantTerm);
|
|
|
|
else
|
|
|
|
fprintf (dump_file,
|
|
|
|
" :::=> [%s >= %d]\n",
|
|
|
|
omega_variable_to_str (pb, 1),
|
|
|
|
constantTerm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int constantTerm = pb->geqs[Le].coef[0];
|
|
|
|
if (constantTerm < upper_bound ||
|
|
|
|
(constantTerm == upper_bound
|
|
|
|
&& !omega_eqn_is_red (&pb->geqs[Le],
|
|
|
|
desired_res)))
|
|
|
|
{
|
|
|
|
upper_bound = constantTerm;
|
|
|
|
ub_color = pb->geqs[Le].color;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
if (pb->geqs[Le].color == omega_black)
|
|
|
|
fprintf (dump_file, " :::=> %s <= %d\n",
|
|
|
|
omega_variable_to_str (pb, 1),
|
|
|
|
constantTerm);
|
|
|
|
else
|
|
|
|
fprintf (dump_file,
|
|
|
|
" :::=> [%s <= %d]\n",
|
|
|
|
omega_variable_to_str (pb, 1),
|
|
|
|
constantTerm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (Lc > 0)
|
|
|
|
for (Ue = topeqn; Ue >= 0; Ue--)
|
|
|
|
if (pb->geqs[Ue].coef[i] < 0
|
|
|
|
&& pb->geqs[Le].key != -pb->geqs[Ue].key)
|
|
|
|
{
|
|
|
|
int Uc = -pb->geqs[Ue].coef[i];
|
|
|
|
int coefficient = pb->geqs[Ue].coef[1] * Lc
|
|
|
|
+ pb->geqs[Le].coef[1] * Uc;
|
|
|
|
int constantTerm = pb->geqs[Ue].coef[0] * Lc
|
|
|
|
+ pb->geqs[Le].coef[0] * Uc;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
omega_print_geq_extra (dump_file, pb,
|
|
|
|
&(pb->geqs[Ue]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_geq_extra (dump_file, pb,
|
|
|
|
&(pb->geqs[Le]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (coefficient > 0)
|
|
|
|
{
|
|
|
|
constantTerm = -int_div (constantTerm, coefficient);
|
|
|
|
|
2009-11-25 11:55:54 +01:00
|
|
|
if (constantTerm > lower_bound
|
|
|
|
|| (constantTerm == lower_bound
|
|
|
|
&& (desired_res != omega_simplify
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|| (pb->geqs[Ue].color == omega_black
|
|
|
|
&& pb->geqs[Le].color == omega_black))))
|
|
|
|
{
|
|
|
|
lower_bound = constantTerm;
|
|
|
|
lb_color = (pb->geqs[Ue].color == omega_red
|
|
|
|
|| pb->geqs[Le].color == omega_red)
|
|
|
|
? omega_red : omega_black;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
if (pb->geqs[Ue].color == omega_red
|
|
|
|
|| pb->geqs[Le].color == omega_red)
|
|
|
|
fprintf (dump_file,
|
|
|
|
" ::=> [%s >= %d]\n",
|
|
|
|
omega_variable_to_str (pb, 1),
|
|
|
|
constantTerm);
|
|
|
|
else
|
|
|
|
fprintf (dump_file,
|
|
|
|
" ::=> %s >= %d\n",
|
|
|
|
omega_variable_to_str (pb, 1),
|
|
|
|
constantTerm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
constantTerm = int_div (constantTerm, -coefficient);
|
|
|
|
if (constantTerm < upper_bound
|
|
|
|
|| (constantTerm == upper_bound
|
|
|
|
&& pb->geqs[Ue].color == omega_black
|
|
|
|
&& pb->geqs[Le].color == omega_black))
|
|
|
|
{
|
|
|
|
upper_bound = constantTerm;
|
|
|
|
ub_color = (pb->geqs[Ue].color == omega_red
|
|
|
|
|| pb->geqs[Le].color == omega_red)
|
|
|
|
? omega_red : omega_black;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file
|
|
|
|
&& (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
if (pb->geqs[Ue].color == omega_red
|
|
|
|
|| pb->geqs[Le].color == omega_red)
|
|
|
|
fprintf (dump_file,
|
|
|
|
" ::=> [%s <= %d]\n",
|
|
|
|
omega_variable_to_str (pb, 1),
|
|
|
|
constantTerm);
|
|
|
|
else
|
|
|
|
fprintf (dump_file,
|
|
|
|
" ::=> %s <= %d\n",
|
|
|
|
omega_variable_to_str (pb, 1),
|
|
|
|
constantTerm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->num_geqs = 0;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
" therefore, %c%d <= %c%s%c <= %d%c\n",
|
|
|
|
lb_color == omega_red ? '[' : ' ', lower_bound,
|
|
|
|
(lb_color == omega_red && ub_color == omega_black)
|
|
|
|
? ']' : ' ',
|
|
|
|
omega_variable_to_str (pb, 1),
|
|
|
|
(lb_color == omega_black && ub_color == omega_red)
|
|
|
|
? '[' : ' ',
|
|
|
|
upper_bound, ub_color == omega_red ? ']' : ' ');
|
|
|
|
|
|
|
|
if (lower_bound > upper_bound)
|
|
|
|
return omega_false;
|
|
|
|
|
|
|
|
if (pb->safe_vars == 1)
|
|
|
|
{
|
|
|
|
if (upper_bound == lower_bound
|
|
|
|
&& !(ub_color == omega_red || lb_color == omega_red)
|
|
|
|
&& !please_no_equalities_in_simplified_problems)
|
|
|
|
{
|
|
|
|
pb->num_eqs++;
|
|
|
|
pb->eqs[0].coef[1] = -1;
|
|
|
|
pb->eqs[0].coef[0] = upper_bound;
|
|
|
|
|
|
|
|
if (ub_color == omega_red
|
|
|
|
|| lb_color == omega_red)
|
|
|
|
pb->eqs[0].color = omega_red;
|
|
|
|
|
|
|
|
if (desired_res == omega_simplify
|
|
|
|
&& pb->eqs[0].color == omega_black)
|
|
|
|
return omega_solve_problem (pb, desired_res);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (upper_bound != pos_infinity)
|
|
|
|
{
|
|
|
|
pb->geqs[0].coef[1] = -1;
|
|
|
|
pb->geqs[0].coef[0] = upper_bound;
|
|
|
|
pb->geqs[0].color = ub_color;
|
|
|
|
pb->geqs[0].key = -1;
|
|
|
|
pb->geqs[0].touched = 0;
|
|
|
|
pb->num_geqs++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lower_bound != neg_infinity)
|
|
|
|
{
|
|
|
|
pb->geqs[pb->num_geqs].coef[1] = 1;
|
|
|
|
pb->geqs[pb->num_geqs].coef[0] = -lower_bound;
|
|
|
|
pb->geqs[pb->num_geqs].color = lb_color;
|
|
|
|
pb->geqs[pb->num_geqs].key = 1;
|
|
|
|
pb->geqs[pb->num_geqs].touched = 0;
|
|
|
|
pb->num_geqs++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (desired_res == omega_simplify)
|
|
|
|
{
|
|
|
|
omega_problem_reduced (pb);
|
|
|
|
return omega_false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-11-25 11:55:54 +01:00
|
|
|
if (!conservative
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& (desired_res != omega_simplify
|
|
|
|
|| (lb_color == omega_black
|
|
|
|
&& ub_color == omega_black))
|
|
|
|
&& original_problem != no_problem
|
|
|
|
&& lower_bound == upper_bound)
|
|
|
|
{
|
|
|
|
for (i = original_problem->num_vars; i >= 0; i--)
|
|
|
|
if (original_problem->var[i] == pb->var[1])
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (i == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
e = original_problem->num_eqs++;
|
|
|
|
omega_init_eqn_zero (&original_problem->eqs[e],
|
|
|
|
original_problem->num_vars);
|
|
|
|
original_problem->eqs[e].coef[i] = -1;
|
|
|
|
original_problem->eqs[e].coef[0] = upper_bound;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
|
|
|
"adding equality %d to outer problem\n", e);
|
|
|
|
omega_print_problem (dump_file, original_problem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return omega_true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
eliminate_again = true;
|
|
|
|
|
|
|
|
if (lower_bound_count == 1)
|
|
|
|
{
|
|
|
|
eqn lbeqn = omega_alloc_eqns (0, 1);
|
|
|
|
int Lc = pb->geqs[Le].coef[i];
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "an inplace elimination\n");
|
|
|
|
|
|
|
|
omega_copy_eqn (lbeqn, &pb->geqs[Le], (n_vars + 1));
|
|
|
|
omega_delete_geq_extra (pb, Le, n_vars + 1);
|
|
|
|
|
|
|
|
for (Ue = pb->num_geqs - 1; Ue >= 0; Ue--)
|
|
|
|
if (pb->geqs[Ue].coef[i] < 0)
|
|
|
|
{
|
|
|
|
if (lbeqn->key == -pb->geqs[Ue].key)
|
|
|
|
omega_delete_geq_extra (pb, Ue, n_vars + 1);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int k;
|
|
|
|
int Uc = -pb->geqs[Ue].coef[i];
|
|
|
|
pb->geqs[Ue].touched = 1;
|
|
|
|
eliminate_again = false;
|
|
|
|
|
|
|
|
if (lbeqn->color == omega_red)
|
|
|
|
pb->geqs[Ue].color = omega_red;
|
|
|
|
|
|
|
|
for (k = 0; k <= n_vars; k++)
|
|
|
|
pb->geqs[Ue].coef[k] =
|
2011-08-01 23:53:07 +02:00
|
|
|
mul_hwi (pb->geqs[Ue].coef[k], Lc) +
|
|
|
|
mul_hwi (lbeqn->coef[k], Uc);
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
omega_print_geq (dump_file, pb,
|
|
|
|
&(pb->geqs[Ue]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
omega_free_eqns (lbeqn, 1);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int *dead_eqns = XNEWVEC (int, OMEGA_MAX_GEQS);
|
|
|
|
bool *is_dead = XNEWVEC (bool, OMEGA_MAX_GEQS);
|
|
|
|
int num_dead = 0;
|
|
|
|
int top_eqn = pb->num_geqs - 1;
|
|
|
|
lower_bound_count--;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "lower bound count = %d\n",
|
|
|
|
lower_bound_count);
|
|
|
|
|
|
|
|
for (Le = top_eqn; Le >= 0; Le--)
|
|
|
|
if (pb->geqs[Le].coef[i] > 0)
|
|
|
|
{
|
|
|
|
int Lc = pb->geqs[Le].coef[i];
|
|
|
|
for (Ue = top_eqn; Ue >= 0; Ue--)
|
|
|
|
if (pb->geqs[Ue].coef[i] < 0)
|
|
|
|
{
|
|
|
|
if (pb->geqs[Le].key != -pb->geqs[Ue].key)
|
|
|
|
{
|
|
|
|
int k;
|
|
|
|
int Uc = -pb->geqs[Ue].coef[i];
|
|
|
|
|
|
|
|
if (num_dead == 0)
|
|
|
|
e2 = pb->num_geqs++;
|
|
|
|
else
|
|
|
|
e2 = dead_eqns[--num_dead];
|
|
|
|
|
|
|
|
gcc_assert (e2 < OMEGA_MAX_GEQS);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
|
|
|
"Le = %d, Ue = %d, gen = %d\n",
|
|
|
|
Le, Ue, e2);
|
|
|
|
omega_print_geq_extra (dump_file, pb,
|
|
|
|
&(pb->geqs[Le]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_geq_extra (dump_file, pb,
|
|
|
|
&(pb->geqs[Ue]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
eliminate_again = false;
|
|
|
|
|
|
|
|
for (k = n_vars; k >= 0; k--)
|
|
|
|
pb->geqs[e2].coef[k] =
|
2011-08-01 23:53:07 +02:00
|
|
|
mul_hwi (pb->geqs[Ue].coef[k], Lc) +
|
|
|
|
mul_hwi (pb->geqs[Le].coef[k], Uc);
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
pb->geqs[e2].coef[n_vars + 1] = 0;
|
|
|
|
pb->geqs[e2].touched = 1;
|
|
|
|
|
2009-11-25 11:55:54 +01:00
|
|
|
if (pb->geqs[Ue].color == omega_red
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|| pb->geqs[Le].color == omega_red)
|
|
|
|
pb->geqs[e2].color = omega_red;
|
|
|
|
else
|
|
|
|
pb->geqs[e2].color = omega_black;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
omega_print_geq (dump_file, pb,
|
|
|
|
&(pb->geqs[e2]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lower_bound_count == 0)
|
|
|
|
{
|
|
|
|
dead_eqns[num_dead++] = Ue;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "Killed %d\n", Ue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lower_bound_count--;
|
|
|
|
dead_eqns[num_dead++] = Le;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "Killed %d\n", Le);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
is_dead[e] = false;
|
|
|
|
|
|
|
|
while (num_dead > 0)
|
|
|
|
is_dead[dead_eqns[--num_dead]] = true;
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (is_dead[e])
|
|
|
|
omega_delete_geq_extra (pb, e, n_vars + 1);
|
|
|
|
|
|
|
|
free (dead_eqns);
|
|
|
|
free (is_dead);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
omega_pb rS, iS;
|
|
|
|
|
|
|
|
rS = omega_alloc_problem (0, 0);
|
|
|
|
iS = omega_alloc_problem (0, 0);
|
|
|
|
e2 = 0;
|
|
|
|
possible_easy_int_solution = true;
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_geqs; e++)
|
|
|
|
if (pb->geqs[e].coef[i] == 0)
|
|
|
|
{
|
|
|
|
omega_copy_eqn (&(rS->geqs[e2]), &pb->geqs[e],
|
|
|
|
pb->num_vars);
|
|
|
|
omega_copy_eqn (&(iS->geqs[e2]), &pb->geqs[e],
|
|
|
|
pb->num_vars);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
int t;
|
|
|
|
fprintf (dump_file, "Copying (%d, %d): ", i,
|
|
|
|
pb->geqs[e].coef[i]);
|
|
|
|
omega_print_geq_extra (dump_file, pb, &pb->geqs[e]);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
for (t = 0; t <= n_vars + 1; t++)
|
|
|
|
fprintf (dump_file, "%d ", pb->geqs[e].coef[t]);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
e2++;
|
|
|
|
gcc_assert (e2 < OMEGA_MAX_GEQS);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Le = pb->num_geqs - 1; Le >= 0; Le--)
|
|
|
|
if (pb->geqs[Le].coef[i] > 0)
|
|
|
|
for (Ue = pb->num_geqs - 1; Ue >= 0; Ue--)
|
|
|
|
if (pb->geqs[Ue].coef[i] < 0)
|
|
|
|
{
|
|
|
|
int k;
|
|
|
|
int Lc = pb->geqs[Le].coef[i];
|
|
|
|
int Uc = -pb->geqs[Ue].coef[i];
|
|
|
|
|
|
|
|
if (pb->geqs[Le].key != -pb->geqs[Ue].key)
|
|
|
|
{
|
|
|
|
|
|
|
|
rS->geqs[e2].touched = iS->geqs[e2].touched = 1;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "---\n");
|
|
|
|
fprintf (dump_file,
|
|
|
|
"Le(Lc) = %d(%d_, Ue(Uc) = %d(%d), gen = %d\n",
|
|
|
|
Le, Lc, Ue, Uc, e2);
|
|
|
|
omega_print_geq_extra (dump_file, pb, &pb->geqs[Le]);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
omega_print_geq_extra (dump_file, pb, &pb->geqs[Ue]);
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Uc == Lc)
|
|
|
|
{
|
|
|
|
for (k = n_vars; k >= 0; k--)
|
|
|
|
iS->geqs[e2].coef[k] = rS->geqs[e2].coef[k] =
|
|
|
|
pb->geqs[Ue].coef[k] + pb->geqs[Le].coef[k];
|
|
|
|
|
|
|
|
iS->geqs[e2].coef[0] -= (Uc - 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (k = n_vars; k >= 0; k--)
|
|
|
|
iS->geqs[e2].coef[k] = rS->geqs[e2].coef[k] =
|
2011-08-01 23:53:07 +02:00
|
|
|
mul_hwi (pb->geqs[Ue].coef[k], Lc) +
|
|
|
|
mul_hwi (pb->geqs[Le].coef[k], Uc);
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
iS->geqs[e2].coef[0] -= (Uc - 1) * (Lc - 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pb->geqs[Ue].color == omega_red
|
|
|
|
|| pb->geqs[Le].color == omega_red)
|
|
|
|
iS->geqs[e2].color = rS->geqs[e2].color = omega_red;
|
|
|
|
else
|
|
|
|
iS->geqs[e2].color = rS->geqs[e2].color = omega_black;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
omega_print_geq (dump_file, pb, &(rS->geqs[e2]));
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
e2++;
|
|
|
|
gcc_assert (e2 < OMEGA_MAX_GEQS);
|
|
|
|
}
|
|
|
|
else if (pb->geqs[Ue].coef[0] * Lc +
|
|
|
|
pb->geqs[Le].coef[0] * Uc -
|
|
|
|
(Uc - 1) * (Lc - 1) < 0)
|
|
|
|
possible_easy_int_solution = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
iS->variables_initialized = rS->variables_initialized = true;
|
|
|
|
iS->num_vars = rS->num_vars = pb->num_vars;
|
|
|
|
iS->num_geqs = rS->num_geqs = e2;
|
|
|
|
iS->num_eqs = rS->num_eqs = 0;
|
|
|
|
iS->num_subs = rS->num_subs = pb->num_subs;
|
|
|
|
iS->safe_vars = rS->safe_vars = pb->safe_vars;
|
|
|
|
|
|
|
|
for (e = n_vars; e >= 0; e--)
|
|
|
|
rS->var[e] = pb->var[e];
|
|
|
|
|
|
|
|
for (e = n_vars; e >= 0; e--)
|
|
|
|
iS->var[e] = pb->var[e];
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
omega_copy_eqn (&(rS->subs[e]), &(pb->subs[e]), pb->num_vars);
|
|
|
|
omega_copy_eqn (&(iS->subs[e]), &(pb->subs[e]), pb->num_vars);
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->num_vars++;
|
|
|
|
n_vars = pb->num_vars;
|
|
|
|
|
|
|
|
if (desired_res != omega_true)
|
|
|
|
{
|
|
|
|
if (original_problem == no_problem)
|
|
|
|
{
|
|
|
|
original_problem = pb;
|
|
|
|
result = omega_solve_geq (rS, omega_false);
|
|
|
|
original_problem = no_problem;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
result = omega_solve_geq (rS, omega_false);
|
|
|
|
|
|
|
|
if (result == omega_false)
|
|
|
|
{
|
|
|
|
free (rS);
|
|
|
|
free (iS);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pb->num_eqs > 0)
|
|
|
|
{
|
|
|
|
/* An equality constraint must have been found */
|
|
|
|
free (rS);
|
|
|
|
free (iS);
|
|
|
|
return omega_solve_problem (pb, desired_res);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (desired_res != omega_false)
|
|
|
|
{
|
|
|
|
int j;
|
|
|
|
int lower_bounds = 0;
|
|
|
|
int *lower_bound = XNEWVEC (int, OMEGA_MAX_GEQS);
|
|
|
|
|
|
|
|
if (possible_easy_int_solution)
|
|
|
|
{
|
|
|
|
conservative++;
|
|
|
|
result = omega_solve_geq (iS, desired_res);
|
|
|
|
conservative--;
|
|
|
|
|
|
|
|
if (result != omega_false)
|
|
|
|
{
|
|
|
|
free (rS);
|
|
|
|
free (iS);
|
|
|
|
free (lower_bound);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!exact && best_parallel_eqn >= 0
|
|
|
|
&& parallel_difference <= max_splinters)
|
|
|
|
{
|
|
|
|
free (rS);
|
|
|
|
free (iS);
|
|
|
|
free (lower_bound);
|
|
|
|
return parallel_splinter (pb, best_parallel_eqn,
|
|
|
|
parallel_difference,
|
|
|
|
desired_res);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "have to do exact analysis\n");
|
|
|
|
|
|
|
|
conservative++;
|
|
|
|
|
|
|
|
for (e = 0; e < pb->num_geqs; e++)
|
|
|
|
if (pb->geqs[e].coef[i] > 1)
|
|
|
|
lower_bound[lower_bounds++] = e;
|
|
|
|
|
|
|
|
/* Sort array LOWER_BOUND. */
|
|
|
|
for (j = 0; j < lower_bounds; j++)
|
|
|
|
{
|
|
|
|
int k, smallest = j;
|
|
|
|
|
|
|
|
for (k = j + 1; k < lower_bounds; k++)
|
|
|
|
if (pb->geqs[lower_bound[smallest]].coef[i] >
|
|
|
|
pb->geqs[lower_bound[k]].coef[i])
|
|
|
|
smallest = k;
|
|
|
|
|
|
|
|
k = lower_bound[smallest];
|
|
|
|
lower_bound[smallest] = lower_bound[j];
|
|
|
|
lower_bound[j] = k;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
c-typeck.c, [...]: Fix typos and follow spelling conventions in various warning/error/diagnostic...
* c-typeck.c, config/arm/arm.c, config/darwin.c,
config/sh/symbian.c, gcc.c, ipa-cp.c, ipa-inline.c, loop-iv.c,
omega.c, tree-ssa-loop-niter.c, treestruct.def: Fix typos and
follow spelling conventions in various
warning/error/diagnostic messages.
From-SVN: r125089
2007-05-26 14:17:52 +02:00
|
|
|
fprintf (dump_file, "lower bound coefficients = ");
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
for (j = 0; j < lower_bounds; j++)
|
|
|
|
fprintf (dump_file, " %d",
|
|
|
|
pb->geqs[lower_bound[j]].coef[i]);
|
|
|
|
|
|
|
|
fprintf (dump_file, "\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
for (j = 0; j < lower_bounds; j++)
|
|
|
|
{
|
|
|
|
int max_incr;
|
|
|
|
int c;
|
|
|
|
int worst_lower_bound_constant = -minC;
|
|
|
|
|
|
|
|
e = lower_bound[j];
|
|
|
|
max_incr = (((pb->geqs[e].coef[i] - 1) *
|
|
|
|
(worst_lower_bound_constant - 1) - 1)
|
|
|
|
/ worst_lower_bound_constant);
|
|
|
|
/* max_incr += 2; */
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "for equation ");
|
|
|
|
omega_print_geq (dump_file, pb, &pb->geqs[e]);
|
|
|
|
fprintf (dump_file,
|
|
|
|
"\ntry decrements from 0 to %d\n",
|
|
|
|
max_incr);
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (max_incr > 50 && !smoothed
|
|
|
|
&& smooth_weird_equations (pb))
|
|
|
|
{
|
|
|
|
conservative--;
|
|
|
|
free (rS);
|
|
|
|
free (iS);
|
|
|
|
smoothed = true;
|
|
|
|
goto solve_geq_start;
|
|
|
|
}
|
|
|
|
|
|
|
|
omega_copy_eqn (&pb->eqs[0], &pb->geqs[e],
|
|
|
|
pb->num_vars);
|
|
|
|
pb->eqs[0].color = omega_black;
|
|
|
|
omega_init_eqn_zero (&pb->geqs[e], pb->num_vars);
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
pb->num_eqs = 1;
|
|
|
|
|
|
|
|
for (c = max_incr; c >= 0; c--)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file,
|
|
|
|
"trying next decrement of %d\n",
|
|
|
|
max_incr - c);
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
omega_copy_problem (rS, pb);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
omega_print_problem (dump_file, rS);
|
|
|
|
|
|
|
|
result = omega_solve_problem (rS, desired_res);
|
|
|
|
|
|
|
|
if (result == omega_true)
|
|
|
|
{
|
|
|
|
free (rS);
|
|
|
|
free (iS);
|
|
|
|
free (lower_bound);
|
|
|
|
conservative--;
|
|
|
|
return omega_true;
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->eqs[0].coef[0]--;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (j + 1 < lower_bounds)
|
|
|
|
{
|
|
|
|
pb->num_eqs = 0;
|
|
|
|
omega_copy_eqn (&pb->geqs[e], &pb->eqs[0],
|
|
|
|
pb->num_vars);
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
pb->geqs[e].color = omega_black;
|
|
|
|
omega_copy_problem (rS, pb);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"exhausted lower bound, "
|
|
|
|
"checking if still feasible ");
|
|
|
|
|
|
|
|
result = omega_solve_problem (rS, omega_false);
|
|
|
|
|
|
|
|
if (result == omega_false)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "fall-off the end\n");
|
|
|
|
|
|
|
|
free (rS);
|
|
|
|
free (iS);
|
|
|
|
free (lower_bound);
|
|
|
|
conservative--;
|
|
|
|
return omega_false;
|
|
|
|
}
|
|
|
|
|
|
|
|
free (rS);
|
|
|
|
free (iS);
|
|
|
|
}
|
|
|
|
return omega_unknown;
|
|
|
|
} while (eliminate_again);
|
|
|
|
} while (1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Because the omega solver is recursive, this counter limits the
|
|
|
|
recursion depth. */
|
|
|
|
static int omega_solve_depth = 0;
|
|
|
|
|
|
|
|
/* Return omega_true when the problem PB has a solution following the
|
|
|
|
DESIRED_RES. */
|
|
|
|
|
|
|
|
enum omega_result
|
|
|
|
omega_solve_problem (omega_pb pb, enum omega_result desired_res)
|
|
|
|
{
|
|
|
|
enum omega_result result;
|
|
|
|
|
|
|
|
gcc_assert (pb->num_vars >= pb->safe_vars);
|
|
|
|
omega_solve_depth++;
|
|
|
|
|
|
|
|
if (desired_res != omega_simplify)
|
|
|
|
pb->safe_vars = 0;
|
|
|
|
|
|
|
|
if (omega_solve_depth > 50)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
2009-11-25 11:55:54 +01:00
|
|
|
fprintf (dump_file,
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
"Solve depth = %d, in_approximate_mode = %d, aborting\n",
|
|
|
|
omega_solve_depth, in_approximate_mode);
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
gcc_assert (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (omega_solve_eq (pb, desired_res) == omega_false)
|
|
|
|
{
|
|
|
|
omega_solve_depth--;
|
|
|
|
return omega_false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (in_approximate_mode && !pb->num_geqs)
|
|
|
|
{
|
|
|
|
result = omega_true;
|
|
|
|
pb->num_vars = pb->safe_vars;
|
|
|
|
omega_problem_reduced (pb);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
result = omega_solve_geq (pb, desired_res);
|
|
|
|
|
|
|
|
omega_solve_depth--;
|
|
|
|
|
|
|
|
if (!omega_reduce_with_subs)
|
|
|
|
{
|
|
|
|
resurrect_subs (pb);
|
2009-11-25 11:55:54 +01:00
|
|
|
gcc_assert (please_no_equalities_in_simplified_problems
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|| !result || pb->num_subs == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return true if red equations constrain the set of possible solutions.
|
|
|
|
We assume that there are solutions to the black equations by
|
|
|
|
themselves, so if there is no solution to the combined problem, we
|
|
|
|
return true. */
|
|
|
|
|
|
|
|
bool
|
|
|
|
omega_problem_has_red_equations (omega_pb pb)
|
|
|
|
{
|
|
|
|
bool result;
|
|
|
|
int e;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Checking for red equations:\n");
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
please_no_equalities_in_simplified_problems++;
|
|
|
|
may_be_red++;
|
|
|
|
|
|
|
|
if (omega_single_result)
|
|
|
|
return_single_result++;
|
|
|
|
|
|
|
|
create_color = true;
|
|
|
|
result = (omega_simplify_problem (pb) == omega_false);
|
|
|
|
|
|
|
|
if (omega_single_result)
|
|
|
|
return_single_result--;
|
|
|
|
|
|
|
|
may_be_red--;
|
|
|
|
please_no_equalities_in_simplified_problems--;
|
|
|
|
|
|
|
|
if (result)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "Gist is FALSE\n");
|
|
|
|
|
|
|
|
pb->num_subs = 0;
|
|
|
|
pb->num_geqs = 0;
|
|
|
|
pb->num_eqs = 1;
|
|
|
|
pb->eqs[0].color = omega_red;
|
|
|
|
|
|
|
|
for (i = pb->num_vars; i > 0; i--)
|
|
|
|
pb->eqs[0].coef[i] = 0;
|
|
|
|
|
|
|
|
pb->eqs[0].coef[0] = 1;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
free_red_eliminations (pb);
|
|
|
|
gcc_assert (pb->num_eqs == 0);
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].color == omega_red)
|
2013-07-22 17:20:11 +02:00
|
|
|
{
|
|
|
|
result = true;
|
|
|
|
break;
|
|
|
|
}
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
if (!result)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
for (i = pb->safe_vars; i >= 1; i--)
|
|
|
|
{
|
|
|
|
int ub = 0;
|
|
|
|
int lb = 0;
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
if (pb->geqs[e].coef[i])
|
|
|
|
{
|
|
|
|
if (pb->geqs[e].coef[i] > 0)
|
|
|
|
lb |= (1 + (pb->geqs[e].color == omega_red ? 1 : 0));
|
|
|
|
|
|
|
|
else
|
|
|
|
ub |= (1 + (pb->geqs[e].color == omega_red ? 1 : 0));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ub == 2 || lb == 2)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "checks for upper/lower bounds worked!\n");
|
|
|
|
|
|
|
|
if (!omega_reduce_with_subs)
|
|
|
|
{
|
|
|
|
resurrect_subs (pb);
|
|
|
|
gcc_assert (pb->num_subs == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"*** Doing potentially expensive elimination tests "
|
|
|
|
"for red equations\n");
|
|
|
|
|
|
|
|
please_no_equalities_in_simplified_problems++;
|
|
|
|
omega_eliminate_red (pb, true);
|
|
|
|
please_no_equalities_in_simplified_problems--;
|
|
|
|
|
|
|
|
result = false;
|
|
|
|
gcc_assert (pb->num_eqs == 0);
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].color == omega_red)
|
2013-07-22 17:20:11 +02:00
|
|
|
{
|
|
|
|
result = true;
|
|
|
|
break;
|
|
|
|
}
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
if (!result)
|
|
|
|
fprintf (dump_file,
|
c-typeck.c, [...]: Fix typos and follow spelling conventions in various warning/error/diagnostic...
* c-typeck.c, config/arm/arm.c, config/darwin.c,
config/sh/symbian.c, gcc.c, ipa-cp.c, ipa-inline.c, loop-iv.c,
omega.c, tree-ssa-loop-niter.c, treestruct.def: Fix typos and
follow spelling conventions in various
warning/error/diagnostic messages.
From-SVN: r125089
2007-05-26 14:17:52 +02:00
|
|
|
"******************** Redundant Red Equations eliminated!!\n");
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
else
|
|
|
|
fprintf (dump_file,
|
|
|
|
"******************** Red Equations remain\n");
|
|
|
|
|
|
|
|
omega_print_problem (dump_file, pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!omega_reduce_with_subs)
|
|
|
|
{
|
|
|
|
normalize_return_type r;
|
|
|
|
|
|
|
|
resurrect_subs (pb);
|
|
|
|
r = normalize_omega_problem (pb);
|
|
|
|
gcc_assert (r != normalize_false);
|
|
|
|
|
|
|
|
coalesce (pb);
|
|
|
|
cleanout_wildcards (pb);
|
|
|
|
gcc_assert (pb->num_subs == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Calls omega_simplify_problem in approximate mode. */
|
|
|
|
|
|
|
|
enum omega_result
|
|
|
|
omega_simplify_approximate (omega_pb pb)
|
|
|
|
{
|
|
|
|
enum omega_result result;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "(Entering approximate mode\n");
|
|
|
|
|
|
|
|
in_approximate_mode = true;
|
|
|
|
result = omega_simplify_problem (pb);
|
|
|
|
in_approximate_mode = false;
|
|
|
|
|
|
|
|
gcc_assert (pb->num_vars == pb->safe_vars);
|
|
|
|
if (!omega_reduce_with_subs)
|
|
|
|
gcc_assert (pb->num_subs == 0);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "Leaving approximate mode)\n");
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Simplifies problem PB by eliminating redundant constraints and
|
|
|
|
reducing the constraints system to a minimal form. Returns
|
|
|
|
omega_true when the problem was successfully reduced, omega_unknown
|
|
|
|
when the solver is unable to determine an answer. */
|
|
|
|
|
|
|
|
enum omega_result
|
|
|
|
omega_simplify_problem (omega_pb pb)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
omega_found_reduction = omega_false;
|
|
|
|
|
|
|
|
if (!pb->variables_initialized)
|
|
|
|
omega_initialize_variables (pb);
|
|
|
|
|
|
|
|
if (next_key * 3 > MAX_KEYS)
|
|
|
|
{
|
|
|
|
int e;
|
|
|
|
|
|
|
|
hash_version++;
|
|
|
|
next_key = OMEGA_MAX_VARS + 1;
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
|
|
|
|
for (i = 0; i < HASH_TABLE_SIZE; i++)
|
|
|
|
hash_master[i].touched = -1;
|
|
|
|
|
|
|
|
pb->hash_version = hash_version;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (pb->hash_version != hash_version)
|
|
|
|
{
|
|
|
|
int e;
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
|
|
|
|
pb->hash_version = hash_version;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pb->num_vars > pb->num_eqs + 3 * pb->safe_vars)
|
|
|
|
omega_free_eliminations (pb, pb->safe_vars);
|
|
|
|
|
|
|
|
if (!may_be_red && pb->num_subs == 0 && pb->safe_vars == 0)
|
|
|
|
{
|
|
|
|
omega_found_reduction = omega_solve_problem (pb, omega_unknown);
|
|
|
|
|
|
|
|
if (omega_found_reduction != omega_false
|
|
|
|
&& !return_single_result)
|
|
|
|
{
|
|
|
|
pb->num_geqs = 0;
|
|
|
|
pb->num_eqs = 0;
|
|
|
|
(*omega_when_reduced) (pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
return omega_found_reduction;
|
|
|
|
}
|
|
|
|
|
|
|
|
omega_solve_problem (pb, omega_simplify);
|
|
|
|
|
|
|
|
if (omega_found_reduction != omega_false)
|
|
|
|
{
|
|
|
|
for (i = 1; omega_safe_var_p (pb, i); i++)
|
|
|
|
pb->forwarding_address[pb->var[i]] = i;
|
|
|
|
|
|
|
|
for (i = 0; i < pb->num_subs; i++)
|
|
|
|
pb->forwarding_address[pb->subs[i].key] = -i - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!omega_reduce_with_subs)
|
|
|
|
gcc_assert (please_no_equalities_in_simplified_problems
|
|
|
|
|| omega_found_reduction == omega_false
|
|
|
|
|| pb->num_subs == 0);
|
|
|
|
|
|
|
|
return omega_found_reduction;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Make variable VAR unprotected: it then can be eliminated. */
|
|
|
|
|
|
|
|
void
|
|
|
|
omega_unprotect_variable (omega_pb pb, int var)
|
|
|
|
{
|
|
|
|
int e, idx;
|
|
|
|
idx = pb->forwarding_address[var];
|
|
|
|
|
|
|
|
if (idx < 0)
|
|
|
|
{
|
|
|
|
idx = -1 - idx;
|
|
|
|
pb->num_subs--;
|
|
|
|
|
|
|
|
if (idx < pb->num_subs)
|
|
|
|
{
|
|
|
|
omega_copy_eqn (&pb->subs[idx], &pb->subs[pb->num_subs],
|
|
|
|
pb->num_vars);
|
|
|
|
pb->forwarding_address[pb->subs[idx].key] = -idx - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int *bring_to_life = XNEWVEC (int, OMEGA_MAX_VARS);
|
|
|
|
int e2;
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
bring_to_life[e] = (pb->subs[e].coef[idx] != 0);
|
|
|
|
|
|
|
|
for (e2 = pb->num_subs - 1; e2 >= 0; e2--)
|
|
|
|
if (bring_to_life[e2])
|
|
|
|
{
|
|
|
|
pb->num_vars++;
|
|
|
|
pb->safe_vars++;
|
|
|
|
|
|
|
|
if (pb->safe_vars < pb->num_vars)
|
|
|
|
{
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
{
|
2009-11-25 11:55:54 +01:00
|
|
|
pb->geqs[e].coef[pb->num_vars] =
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
pb->geqs[e].coef[pb->safe_vars];
|
|
|
|
|
|
|
|
pb->geqs[e].coef[pb->safe_vars] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
pb->eqs[e].coef[pb->num_vars] =
|
|
|
|
pb->eqs[e].coef[pb->safe_vars];
|
|
|
|
|
|
|
|
pb->eqs[e].coef[pb->safe_vars] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
{
|
|
|
|
pb->subs[e].coef[pb->num_vars] =
|
|
|
|
pb->subs[e].coef[pb->safe_vars];
|
|
|
|
|
|
|
|
pb->subs[e].coef[pb->safe_vars] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->var[pb->num_vars] = pb->var[pb->safe_vars];
|
|
|
|
pb->forwarding_address[pb->var[pb->num_vars]] =
|
|
|
|
pb->num_vars;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
pb->geqs[e].coef[pb->safe_vars] = 0;
|
|
|
|
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
pb->eqs[e].coef[pb->safe_vars] = 0;
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
pb->subs[e].coef[pb->safe_vars] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->var[pb->safe_vars] = pb->subs[e2].key;
|
|
|
|
pb->forwarding_address[pb->subs[e2].key] = pb->safe_vars;
|
|
|
|
|
|
|
|
omega_copy_eqn (&(pb->eqs[pb->num_eqs]), &(pb->subs[e2]),
|
|
|
|
pb->num_vars);
|
|
|
|
pb->eqs[pb->num_eqs++].coef[pb->safe_vars] = -1;
|
|
|
|
gcc_assert (pb->num_eqs <= OMEGA_MAX_EQS);
|
|
|
|
|
|
|
|
if (e2 < pb->num_subs - 1)
|
|
|
|
omega_copy_eqn (&(pb->subs[e2]), &(pb->subs[pb->num_subs - 1]),
|
|
|
|
pb->num_vars);
|
|
|
|
|
|
|
|
pb->num_subs--;
|
|
|
|
}
|
|
|
|
|
|
|
|
omega_unprotect_1 (pb, &idx, NULL);
|
|
|
|
free (bring_to_life);
|
|
|
|
}
|
|
|
|
|
|
|
|
chain_unprotect (pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Unprotects VAR and simplifies PB. */
|
|
|
|
|
|
|
|
enum omega_result
|
|
|
|
omega_constrain_variable_sign (omega_pb pb, enum omega_eqn_color color,
|
|
|
|
int var, int sign)
|
|
|
|
{
|
|
|
|
int n_vars = pb->num_vars;
|
|
|
|
int e, j;
|
|
|
|
int k = pb->forwarding_address[var];
|
|
|
|
|
|
|
|
if (k < 0)
|
|
|
|
{
|
|
|
|
k = -1 - k;
|
|
|
|
|
|
|
|
if (sign != 0)
|
|
|
|
{
|
|
|
|
e = pb->num_geqs++;
|
|
|
|
omega_copy_eqn (&pb->geqs[e], &pb->subs[k], pb->num_vars);
|
|
|
|
|
|
|
|
for (j = 0; j <= n_vars; j++)
|
|
|
|
pb->geqs[e].coef[j] *= sign;
|
|
|
|
|
|
|
|
pb->geqs[e].coef[0]--;
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
pb->geqs[e].color = color;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
e = pb->num_eqs++;
|
|
|
|
gcc_assert (pb->num_eqs <= OMEGA_MAX_EQS);
|
|
|
|
omega_copy_eqn (&pb->eqs[e], &pb->subs[k], pb->num_vars);
|
|
|
|
pb->eqs[e].color = color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (sign != 0)
|
|
|
|
{
|
|
|
|
e = pb->num_geqs++;
|
|
|
|
omega_init_eqn_zero (&pb->geqs[e], pb->num_vars);
|
|
|
|
pb->geqs[e].coef[k] = sign;
|
|
|
|
pb->geqs[e].coef[0] = -1;
|
|
|
|
pb->geqs[e].touched = 1;
|
|
|
|
pb->geqs[e].color = color;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
e = pb->num_eqs++;
|
|
|
|
gcc_assert (pb->num_eqs <= OMEGA_MAX_EQS);
|
|
|
|
omega_init_eqn_zero (&pb->eqs[e], pb->num_vars);
|
|
|
|
pb->eqs[e].coef[k] = 1;
|
|
|
|
pb->eqs[e].color = color;
|
|
|
|
}
|
|
|
|
|
|
|
|
omega_unprotect_variable (pb, var);
|
|
|
|
return omega_simplify_problem (pb);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Add an equation "VAR = VALUE" with COLOR to PB. */
|
|
|
|
|
|
|
|
void
|
|
|
|
omega_constrain_variable_value (omega_pb pb, enum omega_eqn_color color,
|
|
|
|
int var, int value)
|
|
|
|
{
|
|
|
|
int e;
|
|
|
|
int k = pb->forwarding_address[var];
|
|
|
|
|
|
|
|
if (k < 0)
|
|
|
|
{
|
|
|
|
k = -1 - k;
|
|
|
|
e = pb->num_eqs++;
|
|
|
|
gcc_assert (pb->num_eqs <= OMEGA_MAX_EQS);
|
|
|
|
omega_copy_eqn (&pb->eqs[e], &pb->subs[k], pb->num_vars);
|
|
|
|
pb->eqs[e].coef[0] -= value;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
e = pb->num_eqs++;
|
|
|
|
omega_init_eqn_zero (&pb->eqs[e], pb->num_vars);
|
|
|
|
pb->eqs[e].coef[k] = 1;
|
|
|
|
pb->eqs[e].coef[0] = -value;
|
|
|
|
}
|
|
|
|
|
|
|
|
pb->eqs[e].color = color;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return false when the upper and lower bounds are not coupled.
|
|
|
|
Initialize the bounds LOWER_BOUND and UPPER_BOUND for the values of
|
|
|
|
variable I. */
|
|
|
|
|
|
|
|
bool
|
|
|
|
omega_query_variable (omega_pb pb, int i, int *lower_bound, int *upper_bound)
|
|
|
|
{
|
|
|
|
int n_vars = pb->num_vars;
|
|
|
|
int e, j;
|
|
|
|
bool is_simple;
|
|
|
|
bool coupled = false;
|
|
|
|
|
|
|
|
*lower_bound = neg_infinity;
|
|
|
|
*upper_bound = pos_infinity;
|
|
|
|
i = pb->forwarding_address[i];
|
|
|
|
|
|
|
|
if (i < 0)
|
|
|
|
{
|
|
|
|
i = -i - 1;
|
|
|
|
|
|
|
|
for (j = 1; j <= n_vars; j++)
|
|
|
|
if (pb->subs[i].coef[j] != 0)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
*upper_bound = *lower_bound = pb->subs[i].coef[0];
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_subs - 1; e >= 0; e--)
|
|
|
|
if (pb->subs[e].coef[i] != 0)
|
2013-07-22 17:20:11 +02:00
|
|
|
{
|
|
|
|
coupled = true;
|
|
|
|
break;
|
|
|
|
}
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
|
|
|
|
for (e = pb->num_eqs - 1; e >= 0; e--)
|
|
|
|
if (pb->eqs[e].coef[i] != 0)
|
|
|
|
{
|
|
|
|
is_simple = true;
|
|
|
|
|
|
|
|
for (j = 1; j <= n_vars; j++)
|
|
|
|
if (i != j && pb->eqs[e].coef[j] != 0)
|
|
|
|
{
|
|
|
|
is_simple = false;
|
|
|
|
coupled = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!is_simple)
|
|
|
|
continue;
|
|
|
|
else
|
|
|
|
{
|
2009-11-25 11:55:54 +01:00
|
|
|
*lower_bound = *upper_bound =
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
-pb->eqs[e].coef[i] * pb->eqs[e].coef[0];
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].coef[i] != 0)
|
|
|
|
{
|
|
|
|
if (pb->geqs[e].key == i)
|
|
|
|
*lower_bound = MAX (*lower_bound, -pb->geqs[e].coef[0]);
|
|
|
|
|
|
|
|
else if (pb->geqs[e].key == -i)
|
|
|
|
*upper_bound = MIN (*upper_bound, pb->geqs[e].coef[0]);
|
|
|
|
|
|
|
|
else
|
|
|
|
coupled = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return coupled;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Sets the lower bound L and upper bound U for the values of variable
|
|
|
|
I, and sets COULD_BE_ZERO to true if variable I might take value
|
|
|
|
zero. LOWER_BOUND and UPPER_BOUND are bounds on the values of
|
|
|
|
variable I. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
query_coupled_variable (omega_pb pb, int i, int *l, int *u,
|
|
|
|
bool *could_be_zero, int lower_bound, int upper_bound)
|
|
|
|
{
|
|
|
|
int e, b1, b2;
|
|
|
|
eqn eqn;
|
|
|
|
int sign;
|
|
|
|
int v;
|
|
|
|
|
|
|
|
/* Preconditions. */
|
|
|
|
gcc_assert (abs (pb->forwarding_address[i]) == 1
|
|
|
|
&& pb->num_vars + pb->num_subs == 2
|
|
|
|
&& pb->num_eqs + pb->num_subs == 1);
|
|
|
|
|
|
|
|
/* Define variable I in terms of variable V. */
|
|
|
|
if (pb->forwarding_address[i] == -1)
|
|
|
|
{
|
|
|
|
eqn = &pb->subs[0];
|
|
|
|
sign = 1;
|
|
|
|
v = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
eqn = &pb->eqs[0];
|
|
|
|
sign = -eqn->coef[1];
|
|
|
|
v = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (e = pb->num_geqs - 1; e >= 0; e--)
|
|
|
|
if (pb->geqs[e].coef[v] != 0)
|
|
|
|
{
|
|
|
|
if (pb->geqs[e].coef[v] == 1)
|
|
|
|
lower_bound = MAX (lower_bound, -pb->geqs[e].coef[0]);
|
|
|
|
|
|
|
|
else
|
|
|
|
upper_bound = MIN (upper_bound, pb->geqs[e].coef[0]);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lower_bound > upper_bound)
|
|
|
|
{
|
|
|
|
*l = pos_infinity;
|
|
|
|
*u = neg_infinity;
|
|
|
|
*could_be_zero = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (lower_bound == neg_infinity)
|
|
|
|
{
|
|
|
|
if (eqn->coef[v] > 0)
|
|
|
|
b1 = sign * neg_infinity;
|
|
|
|
|
|
|
|
else
|
|
|
|
b1 = -sign * neg_infinity;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
b1 = sign * (eqn->coef[0] + eqn->coef[v] * lower_bound);
|
|
|
|
|
|
|
|
if (upper_bound == pos_infinity)
|
|
|
|
{
|
|
|
|
if (eqn->coef[v] > 0)
|
|
|
|
b2 = sign * pos_infinity;
|
|
|
|
|
|
|
|
else
|
|
|
|
b2 = -sign * pos_infinity;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
b2 = sign * (eqn->coef[0] + eqn->coef[v] * upper_bound);
|
|
|
|
|
|
|
|
*l = MAX (*l, b1 <= b2 ? b1 : b2);
|
|
|
|
*u = MIN (*u, b1 <= b2 ? b2 : b1);
|
|
|
|
|
|
|
|
*could_be_zero = (*l <= 0 && 0 <= *u
|
|
|
|
&& int_mod (eqn->coef[0], abs (eqn->coef[v])) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return false when a lower bound L and an upper bound U for variable
|
|
|
|
I in problem PB have been initialized. */
|
|
|
|
|
|
|
|
bool
|
|
|
|
omega_query_variable_bounds (omega_pb pb, int i, int *l, int *u)
|
|
|
|
{
|
|
|
|
*l = neg_infinity;
|
|
|
|
*u = pos_infinity;
|
|
|
|
|
|
|
|
if (!omega_query_variable (pb, i, l, u)
|
|
|
|
|| (pb->num_vars == 1 && pb->forwarding_address[i] == 1))
|
|
|
|
return false;
|
|
|
|
|
2009-11-25 11:55:54 +01:00
|
|
|
if (abs (pb->forwarding_address[i]) == 1
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
&& pb->num_vars + pb->num_subs == 2
|
|
|
|
&& pb->num_eqs + pb->num_subs == 1)
|
|
|
|
{
|
|
|
|
bool could_be_zero;
|
|
|
|
query_coupled_variable (pb, i, l, u, &could_be_zero, neg_infinity,
|
|
|
|
pos_infinity);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* For problem PB, return an integer that represents the classic data
|
|
|
|
dependence direction in function of the DD_LT, DD_EQ and DD_GT bit
|
|
|
|
masks that are added to the result. When DIST_KNOWN is true, DIST
|
|
|
|
is set to the classic data dependence distance. LOWER_BOUND and
|
|
|
|
UPPER_BOUND are bounds on the value of variable I, for example, it
|
|
|
|
is possible to narrow the iteration domain with safe approximations
|
|
|
|
of loop counts, and thus discard some data dependences that cannot
|
|
|
|
occur. */
|
|
|
|
|
|
|
|
int
|
|
|
|
omega_query_variable_signs (omega_pb pb, int i, int dd_lt,
|
|
|
|
int dd_eq, int dd_gt, int lower_bound,
|
|
|
|
int upper_bound, bool *dist_known, int *dist)
|
|
|
|
{
|
|
|
|
int result;
|
|
|
|
int l, u;
|
|
|
|
bool could_be_zero;
|
|
|
|
|
|
|
|
l = neg_infinity;
|
|
|
|
u = pos_infinity;
|
|
|
|
|
|
|
|
omega_query_variable (pb, i, &l, &u);
|
|
|
|
query_coupled_variable (pb, i, &l, &u, &could_be_zero, lower_bound,
|
|
|
|
upper_bound);
|
|
|
|
result = 0;
|
|
|
|
|
|
|
|
if (l < 0)
|
|
|
|
result |= dd_gt;
|
|
|
|
|
|
|
|
if (u > 0)
|
|
|
|
result |= dd_lt;
|
|
|
|
|
|
|
|
if (could_be_zero)
|
|
|
|
result |= dd_eq;
|
|
|
|
|
|
|
|
if (l == u)
|
|
|
|
{
|
|
|
|
*dist_known = true;
|
|
|
|
*dist = l;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*dist_known = false;
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize PB as an Omega problem with NVARS variables and NPROT
|
|
|
|
safe variables. Safe variables are not eliminated during the
|
|
|
|
Fourier-Motzkin elimination. Safe variables are all those
|
|
|
|
variables that are placed at the beginning of the array of
|
|
|
|
variables: P->var[0, ..., NPROT - 1]. */
|
|
|
|
|
|
|
|
omega_pb
|
|
|
|
omega_alloc_problem (int nvars, int nprot)
|
|
|
|
{
|
|
|
|
omega_pb pb;
|
|
|
|
|
|
|
|
gcc_assert (nvars <= OMEGA_MAX_VARS);
|
|
|
|
omega_initialize ();
|
|
|
|
|
|
|
|
/* Allocate and initialize PB. */
|
2009-05-16 08:54:11 +02:00
|
|
|
pb = XCNEW (struct omega_pb_d);
|
loop.texi: Document the Omega linear constraints solver.
* doc/loop.texi: Document the Omega linear constraints solver.
* doc/invoke.texi: Document -fcheck-data-deps, omega-max-vars,
omega-max-geqs, omega-max-eqs, omega-max-wild-cards,
omega-hash-table-size, omega-max-keys, and
omega-eliminate-redundant-constraints.
* tree-pass.h (pass_check_data_deps): Declared.
* omega.c: New.
* omega.h: New.
* timevar.def (TV_CHECK_DATA_DEPS): Declared.
* tree-ssa-loop.c (check_data_deps, gate_check_data_deps,
pass_check_data_deps): New.
* tree-data-ref.c (init_data_ref): Remove declaration.
(dump_data_dependence_relation): Dump DDR_INNER_LOOP.
(analyze_array): Renamed init_array_ref, move up initializations.
(init_data_ref): Renamed init_pointer_ref. Moved before its call.
Removed arguments that are set to NULL.
(analyze_indirect_ref): Correct indentation, correct call to
init_pointer_ref.
(object_analysis): Call init_array_ref instead of analyze_array.
(initialize_data_dependence_relation): Initialize DDR_INNER_LOOP.
(access_functions_are_affine_or_constant_p): Use DR_ACCESS_FNS instead
of DR_ACCESS_FNS_ADDR.
(init_omega_eq_with_af, omega_extract_distance_vectors,
omega_setup_subscript, init_omega_for_ddr_1, init_omega_for_ddr,
ddr_consistent_p): New.
(compute_affine_dependence): Check consistency of ddrs when
flag_check_data_deps is passed.
(analyze_all_data_dependences): Uncomment.
(tree_check_data_deps): New.
* tree-data-ref.h: Include omega.h.
(DR_ACCESS_FNS_ADDR): Removed.
(data_dependence_relation): Add inner_loop.
(DDR_INNER_LOOP): New.
* common.opt (fcheck-data-deps): New.
* tree-flow.h (tree_check_data_deps): Declare.
* Makefile.in (TREE_DATA_REF_H): Depend on omega.h.
(OBJS-common): Depend on omega.o.
(omega.o): Define.
* passes.c (pass_check_data_deps): Scheduled.
* params.def (PARAM_OMEGA_MAX_VARS, PARAM_OMEGA_MAX_GEQS,
PARAM_OMEGA_MAX_EQS, PARAM_OMEGA_MAX_WILD_CARDS,
PARAM_OMEGA_HASH_TABLE_SIZE, PARAM_OMEGA_MAX_KEYS,
PARAM_VECT_MAX_VERSION_CHECKS,
PARAM_OMEGA_ELIMINATE_REDUNDANT_CONSTRAINTS): New.
From-SVN: r122749
2007-03-09 13:39:49 +01:00
|
|
|
pb->var = XCNEWVEC (int, OMEGA_MAX_VARS + 2);
|
|
|
|
pb->forwarding_address = XCNEWVEC (int, OMEGA_MAX_VARS + 2);
|
|
|
|
pb->geqs = omega_alloc_eqns (0, OMEGA_MAX_GEQS);
|
|
|
|
pb->eqs = omega_alloc_eqns (0, OMEGA_MAX_EQS);
|
|
|
|
pb->subs = omega_alloc_eqns (0, OMEGA_MAX_VARS + 1);
|
|
|
|
|
|
|
|
pb->hash_version = hash_version;
|
|
|
|
pb->num_vars = nvars;
|
|
|
|
pb->safe_vars = nprot;
|
|
|
|
pb->variables_initialized = false;
|
|
|
|
pb->variables_freed = false;
|
|
|
|
pb->num_eqs = 0;
|
|
|
|
pb->num_geqs = 0;
|
|
|
|
pb->num_subs = 0;
|
|
|
|
return pb;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Keeps the state of the initialization. */
|
|
|
|
static bool omega_initialized = false;
|
|
|
|
|
|
|
|
/* Initialization of the Omega solver. */
|
|
|
|
|
|
|
|
void
|
|
|
|
omega_initialize (void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (omega_initialized)
|
|
|
|
return;
|
|
|
|
|
|
|
|
next_wild_card = 0;
|
|
|
|
next_key = OMEGA_MAX_VARS + 1;
|
|
|
|
packing = XCNEWVEC (int, OMEGA_MAX_VARS);
|
|
|
|
fast_lookup = XCNEWVEC (int, MAX_KEYS * 2);
|
|
|
|
fast_lookup_red = XCNEWVEC (int, MAX_KEYS * 2);
|
|
|
|
hash_master = omega_alloc_eqns (0, HASH_TABLE_SIZE);
|
|
|
|
|
|
|
|
for (i = 0; i < HASH_TABLE_SIZE; i++)
|
|
|
|
hash_master[i].touched = -1;
|
|
|
|
|
|
|
|
sprintf (wild_name[0], "1");
|
|
|
|
sprintf (wild_name[1], "a");
|
|
|
|
sprintf (wild_name[2], "b");
|
|
|
|
sprintf (wild_name[3], "c");
|
|
|
|
sprintf (wild_name[4], "d");
|
|
|
|
sprintf (wild_name[5], "e");
|
|
|
|
sprintf (wild_name[6], "f");
|
|
|
|
sprintf (wild_name[7], "g");
|
|
|
|
sprintf (wild_name[8], "h");
|
|
|
|
sprintf (wild_name[9], "i");
|
|
|
|
sprintf (wild_name[10], "j");
|
|
|
|
sprintf (wild_name[11], "k");
|
|
|
|
sprintf (wild_name[12], "l");
|
|
|
|
sprintf (wild_name[13], "m");
|
|
|
|
sprintf (wild_name[14], "n");
|
|
|
|
sprintf (wild_name[15], "o");
|
|
|
|
sprintf (wild_name[16], "p");
|
|
|
|
sprintf (wild_name[17], "q");
|
|
|
|
sprintf (wild_name[18], "r");
|
|
|
|
sprintf (wild_name[19], "s");
|
|
|
|
sprintf (wild_name[20], "t");
|
|
|
|
sprintf (wild_name[40 - 1], "alpha");
|
|
|
|
sprintf (wild_name[40 - 2], "beta");
|
|
|
|
sprintf (wild_name[40 - 3], "gamma");
|
|
|
|
sprintf (wild_name[40 - 4], "delta");
|
|
|
|
sprintf (wild_name[40 - 5], "tau");
|
|
|
|
sprintf (wild_name[40 - 6], "sigma");
|
|
|
|
sprintf (wild_name[40 - 7], "chi");
|
|
|
|
sprintf (wild_name[40 - 8], "omega");
|
|
|
|
sprintf (wild_name[40 - 9], "pi");
|
|
|
|
sprintf (wild_name[40 - 10], "ni");
|
|
|
|
sprintf (wild_name[40 - 11], "Alpha");
|
|
|
|
sprintf (wild_name[40 - 12], "Beta");
|
|
|
|
sprintf (wild_name[40 - 13], "Gamma");
|
|
|
|
sprintf (wild_name[40 - 14], "Delta");
|
|
|
|
sprintf (wild_name[40 - 15], "Tau");
|
|
|
|
sprintf (wild_name[40 - 16], "Sigma");
|
|
|
|
sprintf (wild_name[40 - 17], "Chi");
|
|
|
|
sprintf (wild_name[40 - 18], "Omega");
|
|
|
|
sprintf (wild_name[40 - 19], "xxx");
|
|
|
|
|
|
|
|
omega_initialized = true;
|
|
|
|
}
|