From 82893cba4bfeafc80795aa9ddb87a5ca5efae8dc Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Mon, 28 Apr 2008 09:09:19 +0000 Subject: [PATCH] re PR tree-optimization/36066 (ICE with -O1 -finline-small-functions -ftree-vrp -funsafe-loop-optimizations) 2008-04-28 Richard Guenther PR tree-optimization/36066 * tree-vrp.c (execute_vrp): Cleanup the CFG only after finalizing SCEV and loop. * gcc.dg/torture/pr36066.c: New testcase. From-SVN: r134745 --- gcc/ChangeLog | 6 +++ gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gcc.dg/torture/pr36066.c | 54 ++++++++++++++++++++++++++ gcc/tree-vrp.c | 5 +-- 4 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr36066.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 95fcc4bbbf4..6d3eec1e864 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-04-28 Richard Guenther + + PR tree-optimization/36066 + * tree-vrp.c (execute_vrp): Cleanup the CFG only after finalizing + SCEV and loop. + 2008-04-28 Uros Bizjak PR target/36064 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1cb44d35ee1..78d868bd0e2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-04-28 Richard Guenther + + PR tree-optimization/36066 + * gcc.dg/torture/pr36066.c: New testcase. + 2008-04-28 Uros Bizjak PR target/36064 diff --git a/gcc/testsuite/gcc.dg/torture/pr36066.c b/gcc/testsuite/gcc.dg/torture/pr36066.c new file mode 100644 index 00000000000..0e1d1ce3040 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr36066.c @@ -0,0 +1,54 @@ +/* { dg-do compile } */ +/* { dg-options "-funsafe-loop-optimizations -ftree-vrp" } */ + +typedef int FLAC__int32; +typedef int FLAC__bool; +typedef struct { } FLAC__Subframe; +typedef enum { FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT = 0, FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE = 1, FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE = 2, FLAC__CHANNEL_ASSIGNMENT_MID_SIDE = 3 } FLAC__ChannelAssignment; +typedef struct { + struct FLAC__StreamEncoderProtected *protected_; + struct FLAC__StreamEncoderPrivate *private_; +} FLAC__StreamEncoder; +typedef struct FLAC__StreamEncoderProtected { + FLAC__bool loose_mid_side_stereo; + unsigned channels; + unsigned blocksize; +} FLAC__StreamEncoderProtected; +typedef struct FLAC__StreamEncoderPrivate { + FLAC__int32 *integer_signal[(8u)]; + FLAC__Subframe subframe_workspace_mid_side[2][2]; + unsigned best_subframe_mid_side[2]; + unsigned loose_mid_side_stereo_frame_count; +} FLAC__StreamEncoderPrivate; +static void get_wasted_bits_(FLAC__int32 signal[], unsigned samples) +{ + unsigned i; + FLAC__int32 x = 0; + for(i = 0; i < samples && !(x&1); i++) + x |= signal[i]; +} +FLAC__Subframe * process_subframes_(FLAC__StreamEncoder *encoder, unsigned *bits) +{ + unsigned channel; + FLAC__Subframe *left_subframe = 0; + FLAC__ChannelAssignment channel_assignment; + for(channel = 0; channel < encoder->protected_->channels; channel++) + get_wasted_bits_(encoder->private_->integer_signal[channel], encoder->protected_->blocksize); + if(encoder->protected_->loose_mid_side_stereo && encoder->private_->loose_mid_side_stereo_frame_count > 0) + channel_assignment = FLAC__CHANNEL_ASSIGNMENT_MID_SIDE; + else { + FLAC__ChannelAssignment ca = (FLAC__ChannelAssignment)1; + unsigned min_bits = bits[0]; + for(channel_assignment = (FLAC__ChannelAssignment)0; (int)ca <= 3; ca = (FLAC__ChannelAssignment)((int)ca + 1)) + if(bits[ca] < min_bits) + channel_assignment = ca; + } + switch(channel_assignment) { + case FLAC__CHANNEL_ASSIGNMENT_INDEPENDENT: + case FLAC__CHANNEL_ASSIGNMENT_LEFT_SIDE: + case FLAC__CHANNEL_ASSIGNMENT_RIGHT_SIDE: + case FLAC__CHANNEL_ASSIGNMENT_MID_SIDE: + left_subframe = &encoder->private_->subframe_workspace_mid_side[0][encoder->private_->best_subframe_mid_side[0]]; + } + return left_subframe; +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index f65a3c397c8..4b409e46aaf 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -6753,10 +6753,7 @@ execute_vrp (void) SWITCH_LABELS (su->stmt) = su->vec; if (VEC_length (edge, to_remove_edges) > 0) - { - free_dominance_info (CDI_DOMINATORS); - cleanup_tree_cfg (); - } + free_dominance_info (CDI_DOMINATORS); VEC_free (edge, heap, to_remove_edges); VEC_free (switch_update, heap, to_update_switch_stmts); -- 2.30.2