aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1996-05-10 19:01:08 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1996-05-10 19:01:08 -0400
commitfbdc6da8169fa22120a2e8dc52b36d0be9d73086 (patch)
treefdcefc7671e3635b7e85027d6357c1d9648b5f06 /gcc/loop.c
parentcb9e8ad176e75e65cc130c318c4a84922aa98f2a (diff)
downloadgcc-fbdc6da8169fa22120a2e8dc52b36d0be9d73086.zip
gcc-fbdc6da8169fa22120a2e8dc52b36d0be9d73086.tar.gz
gcc-fbdc6da8169fa22120a2e8dc52b36d0be9d73086.tar.bz2
(maybe_eliminate_biv_1): Disable all but two cases of biv elimination with givs...
(maybe_eliminate_biv_1): Disable all but two cases of biv elimination with givs and restrict those two cases to an ADD_VAL that is an address. From-SVN: r11968
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index efde040..0ee43c9 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -6178,13 +6178,16 @@ maybe_eliminate_biv_1 (x, insn, bl, eliminate_p, where)
{
/* Can replace with any giv that was reduced and
that has (MULT_VAL != 0) and (ADD_VAL == 0).
- Require a constant for MULT_VAL, so we know it's nonzero. */
+ Require a constant for MULT_VAL, so we know it's nonzero.
+ ??? We disable this optimization to avoid potential
+ overflows. */
for (v = bl->giv; v; v = v->next_iv)
if (CONSTANT_P (v->mult_val) && v->mult_val != const0_rtx
&& v->add_val == const0_rtx
&& ! v->ignore && ! v->maybe_dead && v->always_computable
- && v->mode == mode)
+ && v->mode == mode
+ && 0)
{
/* If the giv V had the auto-inc address optimization applied
to it, and INSN occurs between the giv insn and the biv
@@ -6215,12 +6218,19 @@ maybe_eliminate_biv_1 (x, insn, bl, eliminate_p, where)
/* Look for a giv with (MULT_VAL != 0) and (ADD_VAL != 0);
replace test insn with a compare insn (cmp REDUCED_GIV ADD_VAL).
- Require a constant for MULT_VAL, so we know it's nonzero. */
+ Require a constant for MULT_VAL, so we know it's nonzero.
+ ??? Do this only if ADD_VAL is a pointer to avoid a potential
+ overflow problem. */
for (v = bl->giv; v; v = v->next_iv)
if (CONSTANT_P (v->mult_val) && v->mult_val != const0_rtx
&& ! v->ignore && ! v->maybe_dead && v->always_computable
- && v->mode == mode)
+ && v->mode == mode
+ && (GET_CODE (v->add_val) == SYMBOL_REF
+ || GET_CODE (v->add_val) == LABEL_REF
+ || GET_CODE (v->add_val) == CONST
+ || (GET_CODE (v->add_val) == REG
+ && REGNO_POINTER_FLAG (REGNO (v->add_val)))))
{
/* If the giv V had the auto-inc address optimization applied
to it, and INSN occurs between the giv insn and the biv
@@ -6286,7 +6296,11 @@ maybe_eliminate_biv_1 (x, insn, bl, eliminate_p, where)
for (v = bl->giv; v; v = v->next_iv)
if (CONSTANT_P (v->mult_val) && INTVAL (v->mult_val) > 0
- && CONSTANT_P (v->add_val)
+ && (GET_CODE (v->add_val) == SYMBOL_REF
+ || GET_CODE (v->add_val) == LABEL_REF
+ || GET_CODE (v->add_val) == CONST
+ || (GET_CODE (v->add_val) == REG
+ && REGNO_POINTER_FLAG (REGNO (v->add_val))))
&& ! v->ignore && ! v->maybe_dead && v->always_computable
&& v->mode == mode)
{
@@ -6330,12 +6344,14 @@ maybe_eliminate_biv_1 (x, insn, bl, eliminate_p, where)
}
/* Look for giv with positive constant mult_val and nonconst add_val.
- Insert insns to calculate new compare value. */
+ Insert insns to calculate new compare value.
+ ??? Turn this off due to possible overflow. */
for (v = bl->giv; v; v = v->next_iv)
if (CONSTANT_P (v->mult_val) && INTVAL (v->mult_val) > 0
&& ! v->ignore && ! v->maybe_dead && v->always_computable
- && v->mode == mode)
+ && v->mode == mode
+ && 0)
{
rtx tem;
@@ -6372,12 +6388,14 @@ maybe_eliminate_biv_1 (x, insn, bl, eliminate_p, where)
if (invariant_p (arg) == 1)
{
/* Look for giv with constant positive mult_val and nonconst
- add_val. Insert insns to compute new compare value. */
+ add_val. Insert insns to compute new compare value.
+ ??? Turn this off due to possible overflow. */
for (v = bl->giv; v; v = v->next_iv)
if (CONSTANT_P (v->mult_val) && INTVAL (v->mult_val) > 0
&& ! v->ignore && ! v->maybe_dead && v->always_computable
- && v->mode == mode)
+ && v->mode == mode
+ && 0)
{
rtx tem;