2009-02-23 Sebastian Pop <sebastian.pop@amd.com>
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Feb 2009 06:47:56 +0000 (06:47 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 24 Feb 2009 06:47:56 +0000 (06:47 +0000)
PR tree-optimization/39260
* graphite.c (harmful_stmt_in_bb): Stop a SCoP when the basic block
contains a condition with a real type.
(build_scop_conditions_1): Conditions are always last_stmt of a bb.

* gcc.dg/graphite/pr39260.c: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144403 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/graphite.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/graphite/pr39260.c [new file with mode: 0644]

index 58f0f91..1910462 100644 (file)
@@ -1,3 +1,10 @@
+2009-02-23  Sebastian Pop  <sebastian.pop@amd.com>
+
+       PR tree-optimization/39260
+       * graphite.c (harmful_stmt_in_bb): Stop a SCoP when the basic block
+       contains a condition with a real type.
+       (build_scop_conditions_1): Conditions are always last_stmt of a bb.
+
 2009-02-23  Jason Merrill  <jason@redhat.com>
 
        PR c++/38880
index 1af3c14..a4cbdfd 100644 (file)
@@ -1209,11 +1209,23 @@ static gimple
 harmful_stmt_in_bb (basic_block scop_entry, basic_block bb)
 {
   gimple_stmt_iterator gsi;
+  gimple stmt;
 
   for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
     if (!stmt_simple_for_scop_p (scop_entry, gsi_stmt (gsi)))
       return gsi_stmt (gsi);
 
+  stmt = last_stmt (bb);
+  if (stmt && gimple_code (stmt) == GIMPLE_COND)
+    {
+      tree lhs = gimple_cond_lhs (stmt);
+      tree rhs = gimple_cond_rhs (stmt);
+
+      if (TREE_CODE (TREE_TYPE (lhs)) == REAL_TYPE
+         || TREE_CODE (TREE_TYPE (rhs)) == REAL_TYPE)
+       return stmt;
+    }
+
   return NULL;
 }
 
@@ -3410,9 +3422,9 @@ build_scop_conditions_1 (VEC (gimple, heap) **conditions,
   bool res = true;
   int i, j;
   graphite_bb_p gbb;
-  gimple_stmt_iterator gsi;
   basic_block bb_child, bb_iter;
   VEC (basic_block, heap) *dom;
+  gimple stmt;
   
   /* Make sure we are in the SCoP.  */
   if (!bb_in_sese_p (bb, SCOP_REGION (scop)))
@@ -3430,9 +3442,9 @@ build_scop_conditions_1 (VEC (gimple, heap) **conditions,
 
   dom = get_dominated_by (CDI_DOMINATORS, bb);
 
-  for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+  stmt = last_stmt (bb);
+  if (stmt)
     {
-      gimple stmt = gsi_stmt (gsi);
       VEC (edge, gc) *edges;
       edge e;
 
index 6e96ea4..4256418 100644 (file)
@@ -1,3 +1,8 @@
+2009-02-23  Sebastian Pop  <sebastian.pop@amd.com>
+
+       PR tree-optimization/39260
+       * gcc.dg/graphite/pr39260.c: New.
+
 2009-02-23  H.J. Lu  <hongjiu.lu@intel.com>
 
        * g++.dg/init/static-init1.C: Replace int with __PTRDIFF_TYPE__.
diff --git a/gcc/testsuite/gcc.dg/graphite/pr39260.c b/gcc/testsuite/gcc.dg/graphite/pr39260.c
new file mode 100644 (file)
index 0000000..066b5bd
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-options "-O2 -fgraphite-identity -ffast-math" } */
+
+VBR_encode_frame (int mode_gr, int channels_out, int max_bits[2][2])
+{
+ int max_nbits_ch[2][2];
+ int gr, ch;
+ for (gr = 0; gr < mode_gr; ++gr)
+   {
+     float f[2], s = 0;
+     for (ch = 0; ch < channels_out; ++ch)
+       if (max_nbits_ch[gr][ch] > 0)
+         s += f[ch];
+     for (ch = 0; ch < channels_out; ++ch)
+       if (s > 0)
+         max_nbits_ch[gr][ch] = 7680 * f[ch] / s;
+   }
+}