re PR tree-optimization/36066 (ICE with -O1 -finline-small-functions -ftree-vrp ...
authorRichard Guenther <rguenther@suse.de>
Mon, 28 Apr 2008 09:09:19 +0000 (09:09 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 28 Apr 2008 09:09:19 +0000 (09:09 +0000)
2008-04-28  Richard Guenther  <rguenther@suse.de>

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
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr36066.c [new file with mode: 0644]
gcc/tree-vrp.c

index 95fcc4bbbf444419deb5096092ce8027c62c98aa..6d3eec1e864bea4a0f0feb86391c3f4e99ff471f 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-28  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/36066
+       * tree-vrp.c (execute_vrp): Cleanup the CFG only after finalizing
+       SCEV and loop.
+
 2008-04-28  Uros Bizjak  <ubizjak@gmail.com>
 
        PR target/36064
index 1cb44d35ee144c34c8793c71141339b3c4389290..78d868bd0e25926beeb2c760dde7fdb0230c8e50 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-28  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/36066
+       * gcc.dg/torture/pr36066.c: New testcase.
+
 2008-04-28  Uros Bizjak  <ubizjak@gmail.com>
 
        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 (file)
index 0000000..0e1d1ce
--- /dev/null
@@ -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;
+}
index f65a3c397c83c1294557d9cde7dc53e1569816d7..4b409e46aafef33d721f29c1c3c3c7ba3ee1431c 100644 (file)
@@ -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);