tree-ssa-pre.c (compute_avail): Value number uses as well.
authorDaniel Berlin <dberlin@dberlin.org>
Thu, 17 Jun 2004 02:46:43 +0000 (02:46 +0000)
committerDaniel Berlin <dberlin@gcc.gnu.org>
Thu, 17 Jun 2004 02:46:43 +0000 (02:46 +0000)
2004-06-16  Daniel Berlin  <dberlin@dberlin.org>

* tree-ssa-pre.c (compute_avail): Value number uses as well.
Strip useless type conversions.
Casts have to be treated slightly different than normal unaries.

From-SVN: r83283

gcc/ChangeLog
gcc/tree-ssa-pre.c

index 6263dbdf1603d4502f015e3140187f26b517de4b..444496772a5831a89677a223c16c3ca5b4ed0bbb 100644 (file)
@@ -1,3 +1,9 @@
+2004-06-16  Daniel Berlin  <dberlin@dberlin.org>
+
+       * tree-ssa-pre.c (compute_avail): Value number uses as well.
+       Strip useless type conversions.
+       Casts have to be treated slightly different than normal unaries.
+
 2004-06-16  Richard Henderson  <rth@redhat.com>
 
        * c-common.def (COMPOUND_STMT): Remove.
index 3d4371e413fea9af1827603ddf26867dfe19c254..fe7738c185da8b2ee734a941405bde7b6c403340 100644 (file)
@@ -1637,6 +1637,16 @@ compute_avail (basic_block block)
                  insert_into_set (TMP_GEN (block), def);
                  value_insert_into_set (AVAIL_OUT (block), def);
                }
+             for (j = 0; j < NUM_USES (STMT_USE_OPS (stmt)); j++)
+               {
+                 tree use = USE_OP (STMT_USE_OPS (stmt), j);
+                 if (TREE_CODE (use) == SSA_NAME)
+                   {
+                     lookup_or_add (value_table, use);
+                     insert_into_set (TMP_GEN (block), use);
+                     value_insert_into_set (AVAIL_OUT (block), use);
+                   }
+               }
              continue;
            }
          else if (TREE_CODE (stmt) == RETURN_EXPR
@@ -1652,6 +1662,7 @@ compute_avail (basic_block block)
              if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op0))
                continue;
              op1 = TREE_OPERAND (stmt, 1);
+             STRIP_USELESS_TYPE_CONVERSION (op1);
              if (TREE_CODE_CLASS (TREE_CODE (op1)) == 'c')
                {
                  add (value_table, op0, lookup_or_add (value_table, op1));
@@ -1682,7 +1693,8 @@ compute_avail (basic_block block)
                  insert_into_set (TMP_GEN (block), op0);
                  value_insert_into_set (AVAIL_OUT (block), op0);  
                }
-             else if (TREE_CODE_CLASS (TREE_CODE (op1)) == '1')
+             else if (TREE_CODE_CLASS (TREE_CODE (op1)) == '1'
+                      && !is_gimple_cast (op1))
                {
                  tree uop;
                  tree val, val1;
@@ -1718,7 +1730,18 @@ compute_avail (basic_block block)
                      lookup_or_add (value_table, def);
                      insert_into_set (TMP_GEN (block), def);
                      value_insert_into_set (AVAIL_OUT (block), def);
-                     value_insert_into_set (AVAIL_OUT (block), op0);
+                     if (def != op0)
+                       abort ();
+                   }
+                 for (j = 0; j < NUM_USES (STMT_USE_OPS (stmt)); j++)
+                   {
+                     tree use = USE_OP (STMT_USE_OPS (stmt), j);
+                     if (TREE_CODE (use) == SSA_NAME)
+                       {
+                         lookup_or_add (value_table, use);
+                         insert_into_set (TMP_GEN (block), use);
+                         value_insert_into_set (AVAIL_OUT (block), use);
+                       }
                    }
                }
            }
@@ -1732,6 +1755,16 @@ compute_avail (basic_block block)
                  insert_into_set (TMP_GEN (block), def);
                  value_insert_into_set (AVAIL_OUT (block), def);
                }
+             for (j = 0; j < NUM_USES (STMT_USE_OPS (stmt)); j++)
+               {
+                 tree use = USE_OP (STMT_USE_OPS (stmt), j);
+                 if (TREE_CODE (use) == SSA_NAME)
+                   {
+                     lookup_or_add (value_table, use);
+                     insert_into_set (TMP_GEN (block), use);
+                     value_insert_into_set (AVAIL_OUT (block), use);
+                   }
+               }
            }
        }
     }