OSDN Git Service

* tree-ssa-phiopt.c: Update a comment about the pass.
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Apr 2005 00:45:43 +0000 (00:45 +0000)
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Apr 2005 00:45:43 +0000 (00:45 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98428 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 29fcc2f..42cea0a 100644 (file)
@@ -1,3 +1,7 @@
+2005-04-20  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * tree-ssa-phiopt.c: Update a comment about the pass.
+
 2005-04-19  Kazu Hirata  <kazu@cs.umass.edu>
 
        * tree-ssa-phiopt.c, config/arm/arm.c, config/fr30/fr30.md,
index 5f5857b..b935407 100644 (file)
@@ -49,80 +49,91 @@ static void replace_phi_edge_with_variable (basic_block, basic_block, edge,
                                            tree, tree);
 static basic_block *blocks_in_phiopt_order (void);
 
-/* This pass eliminates PHI nodes which can be trivially implemented as
-   an assignment from a conditional expression.  i.e. if we have something
-   like:
+/* This pass tries to replaces an if-then-else block with an
+   assignment.  We have four kinds of transformations.  Some of these
+   transformations are also performed by the ifcvt RTL optimizer.
+
+   Conditional Replacement
+   -----------------------
+
+   This transformation, implmented in conditional_replacement,
+   replaces
 
      bb0:
       if (cond) goto bb2; else goto bb1;
      bb1:
      bb2:
-      x = PHI (0 (bb1), 1 (bb0)
+      x = PHI <0 (bb1), 1 (bb0), ...>;
 
-   We can rewrite that as:
+   with
 
      bb0:
-     bb1:
+      x' = cond;
+      goto bb2;
      bb2:
-      x = cond;
+      x = PHI <x' (bb0), ...>;
 
-   bb1 will become unreachable and bb0 and bb2 will almost always
-   be merged into a single block.  This occurs often due to gimplification
-    of conditionals.
+   We remove bb1 as it becomes unreachable.  This occurs often due to
+   gimplification of conditionals.
 
-   Also done is the following optimization:
+   Value Replacement
+   -----------------
+
+   This transformation, implemented in value_replacement, replaces
 
      bb0:
-      if (a != b) goto bb2; else goto bb1;
+       if (a != b) goto bb2; else goto bb1;
      bb1:
      bb2:
-      x = PHI (a (bb1), b (bb0))
+       x = PHI <a (bb1), b (bb0), ...>;
 
-   We can rewrite that as:
+   with
 
      bb0:
-     bb1:
      bb2:
-      x = b;
+       x = PHI <b (bb0), ...>;
+
+   This opportunity can sometimes occur as a result of other
+   optimizations.
 
-   This can sometimes occur as a result of other optimizations.  A
-   similar transformation is done by the ifcvt RTL optimizer.
+   ABS Replacement
+   ---------------
 
-   This pass also eliminates PHI nodes which are really absolute
-   values.  i.e. if we have something like:
+   This transformation, implemented in abs_replacement, replaces
 
      bb0:
-      if (a >= 0) goto bb2; else goto bb1;
+       if (a >= 0) goto bb2; else goto bb1;
      bb1:
-      x = -a;
+       x = -a;
      bb2:
-      x = PHI (x (bb1), a (bb0));
+       x = PHI <x (bb1), a (bb0), ...>;
 
-   We can rewrite that as:
+   with
 
      bb0:
-     bb1:
+       x' = ABS_EXPR< a >;
      bb2:
-      x = ABS_EXPR< a >;
+       x = PHI <x' (bb0), ...>;
+
+   MIN/MAX Replacement
+   -------------------
 
-   Similarly,
+   This transformation, minmax_replacement replaces
 
      bb0:
-      if (a <= b) goto bb2; else goto bb1;
+       if (a <= b) goto bb2; else goto bb1;
      bb1:
-      goto bb2;
      bb2:
-      x = PHI (b (bb1), a (bb0));
+       x = PHI <b (bb1), a (bb0), ...>;
 
-   Becomes
+   with
 
-     x = MIN_EXPR (a, b)
-
-   And the same transformation for MAX_EXPR.
+     bb0:
+       x' = MIN_EXPR (a, b)
+     bb2:
+       x = PHI <x' (bb0), ...>;
 
-   bb1 will become unreachable and bb0 and bb2 will almost always be merged
-   into a single block.  Similar transformations are done by the ifcvt
-   RTL optimizer.  */
+   A similar transformtion is done for MAX_EXPR.  */
 
 static void
 tree_ssa_phiopt (void)