tree-ssa-pre.c (phi_translate): Use find_edge to find the index of a PHI argument.
authorKazu Hirata <kazu@cs.umass.edu>
Wed, 24 Nov 2004 13:33:26 +0000 (13:33 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Wed, 24 Nov 2004 13:33:26 +0000 (13:33 +0000)
* tree-ssa-pre.c (phi_translate): Use find_edge to find the
index of a PHI argument.

From-SVN: r91154

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

index fb419356ed010df387c796a46891bc78bfe26ab2..9dd15b29cbe15b6d59f740ca9e9813bd4ee398f0 100644 (file)
@@ -1,3 +1,8 @@
+2004-11-24  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * tree-ssa-pre.c (phi_translate): Use find_edge to find the
+       index of a PHI argument.
+
 2004-11-24  Steven Bosscher  <stevenb@suse.de>
 
        * expr.c (expand_expr_real_1): Remove cases for EXIT_BLOCK_EXPR 
index 38d5d2b86320928dd95b4a5960e193bdcefd9a49..5bb552f6f81045456c9dfbcf5ad359e7eb7cdd0a 100644 (file)
@@ -922,22 +922,21 @@ phi_translate (tree expr, value_set_t set, basic_block pred,
     case tcc_exceptional:
       {
        tree phi = NULL;
-       int i;
+       edge e;
        gcc_assert (TREE_CODE (expr) == SSA_NAME);
        if (TREE_CODE (SSA_NAME_DEF_STMT (expr)) == PHI_NODE)
          phi = SSA_NAME_DEF_STMT (expr);
        else
          return expr;
        
-       for (i = 0; i < PHI_NUM_ARGS (phi); i++)
-         if (PHI_ARG_EDGE (phi, i)->src == pred)
-           {
-             tree val;
-             if (is_undefined_value (PHI_ARG_DEF (phi, i)))
-               return NULL;
-             val = vn_lookup_or_add (PHI_ARG_DEF (phi, i), NULL);
-             return PHI_ARG_DEF (phi, i);
-           }
+       e = find_edge (pred, bb_for_stmt (phi));
+       if (e)
+         {
+           if (is_undefined_value (PHI_ARG_DEF (phi, e->dest_idx)))
+             return NULL;
+           vn_lookup_or_add (PHI_ARG_DEF (phi, e->dest_idx), NULL);
+           return PHI_ARG_DEF (phi, e->dest_idx);
+         }
       }
       return expr;