This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/18178] Missed opportunity for removing bounds checking
- From: "cvs-commit at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Feb 2005 21:29:05 -0000
- Subject: [Bug tree-optimization/18178] Missed opportunity for removing bounds checking
- References: <20041027140944.18178.pinskia@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-02-18 21:29 -------
Subject: Bug 18178
CVSROOT: /cvs/gcc
Module name: gcc
Branch: tree-cleanup-branch
Changes by: dnovillo@gcc.gnu.org 2005-02-18 21:28:58
Modified files:
gcc : ChangeLog.tcb Makefile.in tree-into-ssa.c
tree-vrp.c
gcc/testsuite : ChangeLog.tcb
gcc/testsuite/gcc.dg/tree-ssa: ssa-pre-2.c ssa-pre-3.c
ssa-pre-4.c ssa-pre-5.c
ssa-pre-6.c
Added files:
gcc/testsuite/g++.dg/tree-ssa: pr18178.C
Log message:
PR tree-optimization/18178
* Makefile.in (tree-vrp.o): Depend on CFGLOOP_H,
tree-scalar-evolution.h and tree-chrec.h.
* tree-into-ssa.c (prepare_block_for_update): Also rewrite
operands of statements that define new names.
* tree-vrp.c: Include cfgloop.h, tree-scalar-evolution.h and
tree-chrec.h.
(cfg_loops): New local variable.
(compare_values): Forward declare.
(copy_value_range): Remove.
(set_value_range): Add range integrity checks.
Decay to VR_VARYING ranges that take all possible values in
the type domain.
(compare_values): Do some symbolic comparisons.
(value_inside_range): Move earlier in the file.
(value_ranges_intersect_p): Likewise.
(extract_range_from_assert): If the ASSERT_EXPR conditional
and the variable have intersecting ranges, use the
intersection to derive a narrower range.
(extract_range_from_ssa_name): New function.
(extract_range_from_binary_expr): Re-arrange to always call
set_value_range to set the newly computed range.
(extract_range_from_unary_expr): Likewise.
Do not special case ABS_EXPR.
If a type cast operation changes to a type of different size,
set the resulting range to VR_VARYING.
If the new range has the limits swapped around, set the result
to VR_VARYING.
(extract_range_from_expr): Call extract_range_from_ssa_name.
(compare_ranges): Allow symbolic ranges.
Fix calls to compare_values to always check for specific
return values.
(compare_range_with_value): Likewise.
(adjust_range_with_scev): New function.
(vrp_visit_assignment): Call it if the statement is inside a
loop.
(vrp_meet): Always call set_value_range to set the newly
computed range.
(vrp_visit_phi_node): Remove FIXME regarding derivation.
(execute_vrp): Call loop_optimizer_init, scev_initialize,
scev_finalize and loop_optimizer_finalize.
testsuite/ChangeLog.tcb:
* testsuite/gcc.dg/tree-ssa/ssa-pre-2.c: Adjust expected pattern.
* testsuite/gcc.dg/tree-ssa/ssa-pre-3.c: Likewise.
* testsuite/gcc.dg/tree-ssa/ssa-pre-4.c: Likewise.
* testsuite/gcc.dg/tree-ssa/ssa-pre-5.c: Likewise.
* testsuite/gcc.dg/tree-ssa/ssa-pre-6.c: Likewise.
PR tree-optimization/18178
* testsuite/g++.dg/tree-ssa/pr18178.C: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.tcb.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=1.1.2.23&r2=1.1.2.24
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/Makefile.in.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=1.1396.2.18&r2=1.1396.2.19
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-into-ssa.c.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=2.21.2.12&r2=2.21.2.13
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-vrp.c.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=1.1.2.4&r2=1.1.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.tcb.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=1.1.2.6&r2=1.1.2.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/tree-ssa/pr18178.C.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-2.c.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=1.3&r2=1.3.10.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-3.c.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=1.1.10.1&r2=1.1.10.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-4.c.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=1.1.2.1&r2=1.1.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-5.c.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=1.1.2.1&r2=1.1.2.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-6.c.diff?cvsroot=gcc&only_with_tag=tree-cleanup-branch&r1=1.1.2.1&r2=1.1.2.2
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18178