Commit c7f965b6 by Andrew Pinski Committed by Andrew Pinski

re PR tree-optimization/28937 (ICE in add_virtual_operand, at tree-ssa-operands.c:1309)

2006-09-05  Andrew Pinski  <pinskia@physics.uc.edu>

        PR tree-opt/28937
        * tree-flow.h (tree_ssa_unswitch_loops): Return unsigned int.
        (canonicalize_induction_variables): Likewise.
        (tree_unroll_loops_completely): Likewise.
        (tree_ssa_prefetch_arrays): Likewise.
        (remove_empty_loops): Likewise.
        * tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops): Return
        TODO_cleanup_cfg instead of directly calling
        cleanup_tree_cfg_loop.
        * tree-ssa-loop-ivcanon.c (canonicalize_induction_variables):
        Likewise.
        (tree_unroll_loops_completely): Likewise.
        (remove_empty_loops): Likewise.
        * tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Likewise.
        * tree-ssa-loop.c (tree_ssa_loop_unswitch): Use the return value
        of tree_ssa_unswitch_loops.
        (tree_ssa_loop_ivcanon): Use the return value of
        canonicalize_induction_variables.
        (tree_ssa_empty_loop): Use the return value of
        remove_empty_loops.
        (tree_complete_unroll): Use the return value of
        tree_unroll_loops_completely.
        (tree_ssa_loop_prefetch): Use the return value of
        tree_ssa_prefetch_arrays.
        * passes.c (execute_todo): Before Cleanup CFG, set
        updating_used_alone and after cleanup CFG, call
        recalculate_used_alone.
2006-09-05  Andrew Pinski  <pinskia@physics.uc.edu>

        PR tree-opt/28937
        * g++.dg/opt/unroll2.C: New test.

From-SVN: r116717
parent 10b96810
2006-09-05 Andrew Pinski <pinskia@physics.uc.edu> 2006-09-05 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/28937
* tree-flow.h (tree_ssa_unswitch_loops): Return unsigned int.
(canonicalize_induction_variables): Likewise.
(tree_unroll_loops_completely): Likewise.
(tree_ssa_prefetch_arrays): Likewise.
(remove_empty_loops): Likewise.
* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops): Return
TODO_cleanup_cfg instead of directly calling
cleanup_tree_cfg_loop.
* tree-ssa-loop-ivcanon.c (canonicalize_induction_variables):
Likewise.
(tree_unroll_loops_completely): Likewise.
(remove_empty_loops): Likewise.
* tree-ssa-loop-prefetch.c (tree_ssa_prefetch_arrays): Likewise.
* tree-ssa-loop.c (tree_ssa_loop_unswitch): Use the return value
of tree_ssa_unswitch_loops.
(tree_ssa_loop_ivcanon): Use the return value of
canonicalize_induction_variables.
(tree_ssa_empty_loop): Use the return value of
remove_empty_loops.
(tree_complete_unroll): Use the return value of
tree_unroll_loops_completely.
(tree_ssa_loop_prefetch): Use the return value of
tree_ssa_prefetch_arrays.
* passes.c (execute_todo): Before Cleanup CFG, set
updating_used_alone and after cleanup CFG, call
recalculate_used_alone.
2006-09-05 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/28952 PR tree-opt/28952
* tree-vect-transform.c (vectorizable_condition): Move the check * tree-vect-transform.c (vectorizable_condition): Move the check
for the type after the check for simple condition. for the type after the check for simple condition.
......
...@@ -727,11 +727,17 @@ execute_todo (unsigned int flags) ...@@ -727,11 +727,17 @@ execute_todo (unsigned int flags)
/* Always cleanup the CFG before trying to update SSA . */ /* Always cleanup the CFG before trying to update SSA . */
if (flags & TODO_cleanup_cfg) if (flags & TODO_cleanup_cfg)
{ {
/* CFG Cleanup can cause a constant to prop into an ARRAY_REF. */
updating_used_alone = true;
if (current_loops) if (current_loops)
cleanup_tree_cfg_loop (); cleanup_tree_cfg_loop ();
else else
cleanup_tree_cfg (); cleanup_tree_cfg ();
/* Update the used alone after cleanup cfg. */
recalculate_used_alone ();
/* When cleanup_tree_cfg merges consecutive blocks, it may /* When cleanup_tree_cfg merges consecutive blocks, it may
perform some simplistic propagation when removing single perform some simplistic propagation when removing single
valued PHI nodes. This propagation may, in turn, cause the valued PHI nodes. This propagation may, in turn, cause the
......
2006-09-05 Andrew Pinski <pinskia@physics.uc.edu> 2006-09-05 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/28937
* g++.dg/opt/unroll2.C: New test.
2006-09-05 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/28952 PR tree-opt/28952
* gcc.dg/vect/pr28952.c: New test. * gcc.dg/vect/pr28952.c: New test.
// PR tree-opt/28937
// Complete unroll forgot to update the statement usage
// which meant we ICEd in add_virtual_operand.
// { dg-do compile }
// { dg-options "-O2" }
class SHA256
{
unsigned m_digest;
unsigned long long m_count;
unsigned char _buffer[64];
static void Transform (unsigned * data);
void WriteByteBlock (unsigned t);
};
void SHA256::WriteByteBlock (unsigned t)
{
unsigned data32[16];
Transform (data32);
unsigned long long lenInBits = m_count;
if (t != (64 - 8))
return;
for (int i = 0; i < 2; i++)
_buffer[t++] = (unsigned char)lenInBits;
}
...@@ -798,11 +798,11 @@ bool empty_block_p (basic_block); ...@@ -798,11 +798,11 @@ bool empty_block_p (basic_block);
/* In tree-ssa-loop*.c */ /* In tree-ssa-loop*.c */
void tree_ssa_lim (struct loops *); void tree_ssa_lim (struct loops *);
void tree_ssa_unswitch_loops (struct loops *); unsigned int tree_ssa_unswitch_loops (struct loops *);
void canonicalize_induction_variables (struct loops *); unsigned int canonicalize_induction_variables (struct loops *);
void tree_unroll_loops_completely (struct loops *, bool); unsigned int tree_unroll_loops_completely (struct loops *, bool);
void tree_ssa_prefetch_arrays (struct loops *); unsigned int tree_ssa_prefetch_arrays (struct loops *);
void remove_empty_loops (struct loops *); unsigned int remove_empty_loops (struct loops *);
void tree_ssa_iv_optimize (struct loops *); void tree_ssa_iv_optimize (struct loops *);
bool number_of_iterations_exit (struct loop *, edge, bool number_of_iterations_exit (struct loop *, edge,
......
...@@ -330,7 +330,7 @@ canonicalize_loop_induction_variables (struct loops *loops, struct loop *loop, ...@@ -330,7 +330,7 @@ canonicalize_loop_induction_variables (struct loops *loops, struct loop *loop,
/* The main entry point of the pass. Adds canonical induction variables /* The main entry point of the pass. Adds canonical induction variables
to the suitable LOOPS. */ to the suitable LOOPS. */
void unsigned int
canonicalize_induction_variables (struct loops *loops) canonicalize_induction_variables (struct loops *loops)
{ {
unsigned i; unsigned i;
...@@ -352,14 +352,15 @@ canonicalize_induction_variables (struct loops *loops) ...@@ -352,14 +352,15 @@ canonicalize_induction_variables (struct loops *loops)
scev_reset (); scev_reset ();
if (changed) if (changed)
cleanup_tree_cfg_loop (); return TODO_cleanup_cfg;
return 0;
} }
/* Unroll LOOPS completely if they iterate just few times. Unless /* Unroll LOOPS completely if they iterate just few times. Unless
MAY_INCREASE_SIZE is true, perform the unrolling only if the MAY_INCREASE_SIZE is true, perform the unrolling only if the
size of the code does not increase. */ size of the code does not increase. */
void unsigned int
tree_unroll_loops_completely (struct loops *loops, bool may_increase_size) tree_unroll_loops_completely (struct loops *loops, bool may_increase_size)
{ {
unsigned i; unsigned i;
...@@ -388,7 +389,8 @@ tree_unroll_loops_completely (struct loops *loops, bool may_increase_size) ...@@ -388,7 +389,8 @@ tree_unroll_loops_completely (struct loops *loops, bool may_increase_size)
scev_reset (); scev_reset ();
if (changed) if (changed)
cleanup_tree_cfg_loop (); return TODO_cleanup_cfg;
return 0;
} }
/* Checks whether LOOP is empty. */ /* Checks whether LOOP is empty. */
...@@ -562,7 +564,7 @@ try_remove_empty_loop (struct loop *loop, bool *changed) ...@@ -562,7 +564,7 @@ try_remove_empty_loop (struct loop *loop, bool *changed)
/* Remove the empty LOOPS. */ /* Remove the empty LOOPS. */
void unsigned int
remove_empty_loops (struct loops *loops) remove_empty_loops (struct loops *loops)
{ {
bool changed = false; bool changed = false;
...@@ -574,6 +576,7 @@ remove_empty_loops (struct loops *loops) ...@@ -574,6 +576,7 @@ remove_empty_loops (struct loops *loops)
if (changed) if (changed)
{ {
scev_reset (); scev_reset ();
cleanup_tree_cfg_loop (); return TODO_cleanup_cfg;
} }
return 0;
} }
...@@ -1006,12 +1006,13 @@ fail: ...@@ -1006,12 +1006,13 @@ fail:
/* Issue prefetch instructions for array references in LOOPS. */ /* Issue prefetch instructions for array references in LOOPS. */
void unsigned int
tree_ssa_prefetch_arrays (struct loops *loops) tree_ssa_prefetch_arrays (struct loops *loops)
{ {
unsigned i; unsigned i;
struct loop *loop; struct loop *loop;
bool unrolled = false; bool unrolled = false;
int todo_flags = 0;
if (!HAVE_prefetch if (!HAVE_prefetch
/* It is possible to ask compiler for say -mtune=i486 -march=pentium4. /* It is possible to ask compiler for say -mtune=i486 -march=pentium4.
...@@ -1019,7 +1020,7 @@ tree_ssa_prefetch_arrays (struct loops *loops) ...@@ -1019,7 +1020,7 @@ tree_ssa_prefetch_arrays (struct loops *loops)
of processor costs and i486 does not have prefetch, but of processor costs and i486 does not have prefetch, but
-march=pentium4 causes HAVE_prefetch to be true. Ugh. */ -march=pentium4 causes HAVE_prefetch to be true. Ugh. */
|| PREFETCH_BLOCK == 0) || PREFETCH_BLOCK == 0)
return; return 0;
initialize_original_copy_tables (); initialize_original_copy_tables ();
...@@ -1057,8 +1058,9 @@ tree_ssa_prefetch_arrays (struct loops *loops) ...@@ -1057,8 +1058,9 @@ tree_ssa_prefetch_arrays (struct loops *loops)
if (unrolled) if (unrolled)
{ {
scev_reset (); scev_reset ();
cleanup_tree_cfg_loop (); todo_flags |= TODO_cleanup_cfg;
} }
free_original_copy_tables (); free_original_copy_tables ();
return todo_flags;
} }
...@@ -80,7 +80,7 @@ static tree tree_may_unswitch_on (basic_block, struct loop *); ...@@ -80,7 +80,7 @@ static tree tree_may_unswitch_on (basic_block, struct loop *);
/* Main entry point. Perform loop unswitching on all suitable LOOPS. */ /* Main entry point. Perform loop unswitching on all suitable LOOPS. */
void unsigned int
tree_ssa_unswitch_loops (struct loops *loops) tree_ssa_unswitch_loops (struct loops *loops)
{ {
int i, num; int i, num;
...@@ -104,7 +104,8 @@ tree_ssa_unswitch_loops (struct loops *loops) ...@@ -104,7 +104,8 @@ tree_ssa_unswitch_loops (struct loops *loops)
} }
if (changed) if (changed)
cleanup_tree_cfg_loop (); return TODO_cleanup_cfg;
return 0;
} }
/* Checks whether we can unswitch LOOP on condition at end of BB -- one of its /* Checks whether we can unswitch LOOP on condition at end of BB -- one of its
......
...@@ -158,8 +158,7 @@ tree_ssa_loop_unswitch (void) ...@@ -158,8 +158,7 @@ tree_ssa_loop_unswitch (void)
if (!current_loops) if (!current_loops)
return 0; return 0;
tree_ssa_unswitch_loops (current_loops); return tree_ssa_unswitch_loops (current_loops);
return 0;
} }
static bool static bool
...@@ -260,8 +259,7 @@ tree_ssa_loop_ivcanon (void) ...@@ -260,8 +259,7 @@ tree_ssa_loop_ivcanon (void)
if (!current_loops) if (!current_loops)
return 0; return 0;
canonicalize_induction_variables (current_loops); return canonicalize_induction_variables (current_loops);
return 0;
} }
static bool static bool
...@@ -322,8 +320,7 @@ tree_ssa_empty_loop (void) ...@@ -322,8 +320,7 @@ tree_ssa_empty_loop (void)
if (!current_loops) if (!current_loops)
return 0; return 0;
remove_empty_loops (current_loops); return remove_empty_loops (current_loops);
return 0;
} }
struct tree_opt_pass pass_empty_loop = struct tree_opt_pass pass_empty_loop =
...@@ -381,11 +378,10 @@ tree_complete_unroll (void) ...@@ -381,11 +378,10 @@ tree_complete_unroll (void)
if (!current_loops) if (!current_loops)
return 0; return 0;
tree_unroll_loops_completely (current_loops, return tree_unroll_loops_completely (current_loops,
flag_unroll_loops flag_unroll_loops
|| flag_peel_loops || flag_peel_loops
|| optimize >= 3); || optimize >= 3);
return 0;
} }
static bool static bool
...@@ -419,8 +415,7 @@ tree_ssa_loop_prefetch (void) ...@@ -419,8 +415,7 @@ tree_ssa_loop_prefetch (void)
if (!current_loops) if (!current_loops)
return 0; return 0;
tree_ssa_prefetch_arrays (current_loops); return tree_ssa_prefetch_arrays (current_loops);
return 0;
} }
static bool static bool
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment