public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Scalar evolution and hidden casts
@ 2009-05-19  9:13 Eric Botcazou
  2009-05-19  9:47 ` Richard Guenther
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Botcazou @ 2009-05-19  9:13 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1333 bytes --]

Hi,

I've attached an Ada testcase that should totally collapse at -O -gnatp, i.e. 
generates only "A = A + 1000000000", but doesn't because scev is very picky 
about casts, even hidden casts (tree-chrec.c contains many type assertions).
The .lim dump file is entirely clean (attached, no casts) but .sccp shows that 
scev rematerializes some of them, yielding to scev_not_known:

Analyzing # of iterations of loop 2
  exit condition [2, + , 1] <= 1000000
  bounds on difference of bases: 999998 ... 999998
  result:
    # of iterations 999999, bounded by 999999
  (set_nb_iterations_in_loop = 999999))
(chrec_apply 
  (varying_loop = 2
)
  (chrec = {(integer) p__a_lsm.11_11, +, 1}_2)
  (x = 999999)
  (res = (integer) p__a_lsm.11_11 + 999999))
  (evolution_function = scev_not_known))


Teaching tree-chrec.c to disregard useless casts appears to be tricky, you 
very quickly run into one of the type assertions.  Another strategy, which 
works at least in this case, is to change the type of the chrec and use that 
of the SSA name.  Patch attached, tested on i586-suse-linux, OK for mainline?


2009-05-19  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-scalar-evolution.c (follow_ssa_edge_expr) <PLUS_EXPR>: Propagate
	the type of the first operand.
	(follow_ssa_edge_in_rhs) <GIMPLE_BINARY_RHS>: Likewise.


-- 
Eric Botcazou

[-- Attachment #2: h723-012_45.diff --]
[-- Type: text/x-diff, Size: 1811 bytes --]

Index: tree-scalar-evolution.c
===================================================================
--- tree-scalar-evolution.c	(revision 147612)
+++ tree-scalar-evolution.c	(working copy)
@@ -1181,6 +1181,7 @@ follow_ssa_edge_expr (struct loop *loop,
       /* This case is under the form "rhs0 +- rhs1".  */
       rhs0 = TREE_OPERAND (expr, 0);
       rhs1 = TREE_OPERAND (expr, 1);
+      type = TREE_TYPE (rhs0);
       STRIP_TYPE_NOPS (rhs0);
       STRIP_TYPE_NOPS (rhs1);
       return follow_ssa_edge_binary (loop, at_stmt, type, rhs0, code, rhs1,
@@ -1215,16 +1216,17 @@ static t_bool
 follow_ssa_edge_in_rhs (struct loop *loop, gimple stmt,
 			gimple halting_phi, tree *evolution_of_loop, int limit)
 {
-  tree type = TREE_TYPE (gimple_assign_lhs (stmt));
   enum tree_code code = gimple_assign_rhs_code (stmt);
 
   switch (get_gimple_rhs_class (code))
     {
     case GIMPLE_BINARY_RHS:
-      return follow_ssa_edge_binary (loop, stmt, type,
-				     gimple_assign_rhs1 (stmt), code,
-				     gimple_assign_rhs2 (stmt),
-				     halting_phi, evolution_of_loop, limit);
+      {
+	tree rhs1 = gimple_assign_rhs1 (stmt);
+	return follow_ssa_edge_binary (loop, stmt, TREE_TYPE (rhs1), rhs1,
+				       code, gimple_assign_rhs2 (stmt),
+				       halting_phi, evolution_of_loop, limit);
+      }
     case GIMPLE_SINGLE_RHS:
       return follow_ssa_edge_expr (loop, stmt, gimple_assign_rhs1 (stmt),
 				   halting_phi, evolution_of_loop, limit);
@@ -1232,6 +1234,7 @@ follow_ssa_edge_in_rhs (struct loop *loo
       if (code == NOP_EXPR)
 	{
 	  /* This assignment is under the form "a_1 = (cast) rhs.  */
+	  tree type = TREE_TYPE (gimple_assign_lhs (stmt));
 	  t_bool res
 	    = follow_ssa_edge_expr (loop, stmt, gimple_assign_rhs1 (stmt),
 				    halting_phi, evolution_of_loop, limit);

[-- Attachment #3: p.ads --]
[-- Type: text/x-adasrc, Size: 58 bytes --]

package P is
  A : Integer := 0;
  procedure Main;
end P;

[-- Attachment #4: p.adb.091t.lim --]
[-- Type: text/x-c++src, Size: 1411 bytes --]


;; Function P.Main (p__main)



Symbols to be put in SSA form

{ .MEM p__a_lsm.11 }


Incremental SSA update started at block: 0

Number of blocks in CFG: 9
Number of blocks to update: 8 ( 89%)




SSA replacement table
N_i -> { O_1 ... O_j } means that N_i replaces O_1, ..., O_j

p__a_lsm.11_5 -> { p__a_lsm.11_9 }
p__a_lsm.11_10 -> { p__a_lsm.11_9 }

Number of virtual NEW -> OLD mappings:       0
Number of real NEW -> OLD mappings:          2
Number of total NEW -> OLD mappings:         2

Number of virtual symbols: 0


Incremental SSA update started at block: 3

Number of blocks in CFG: 9
Number of blocks to update: 6 ( 67%)



P.Main ()
{
  integer p__a_lsm.11;
  integer p__a.0;
  integer p__a.1;
  integer i;
  integer j;

<bb 2>:
  p__a_lsm.11_12 = p__a;

<bb 3>:
  # j_16 = PHI <j_4(7), 1(2)>
  # p__a_lsm.11_11 = PHI <p__a_lsm.11_10(7), p__a_lsm.11_12(2)>

<bb 4>:
  # i_19 = PHI <i_8(5), 1(3)>
  # p__a_lsm.11_21 = PHI <p__a_lsm.11_9(5), p__a_lsm.11_11(3)>
  p__a.0_6 = p__a_lsm.11_21;
  p__a.1_7 = p__a.0_6 + 1;
  p__a_lsm.11_9 = p__a.1_7;
  i_8 = i_19 + 1;
  if (i_8 <= 1000000)
    goto <bb 5>;
  else
    goto <bb 6>;

<bb 5>:
  goto <bb 4>;

<bb 6>:
  # p__a_lsm.11_10 = PHI <p__a_lsm.11_9(4)>
  j_4 = j_16 + 1;
  if (j_4 <= 1000)
    goto <bb 7>;
  else
    goto <bb 8>;

<bb 7>:
  goto <bb 3>;

<bb 8>:
  # p__a_lsm.11_5 = PHI <p__a_lsm.11_10(6)>
  p__a = p__a_lsm.11_5;
  return;

}



[-- Attachment #5: p.adb --]
[-- Type: text/x-adasrc, Size: 266 bytes --]

package body P is
  procedure Foo is
  begin
    for I in 1 .. 1_000_000 loop
      A := A + 1;
    end loop;
  end Foo;

  procedure Bar is
  begin
    for J in 1 .. 1_000 loop
      Foo;
    end loop;
  end Bar;

  procedure Main is
  begin
    Bar;
  end;
end P;

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Scalar evolution and hidden casts
  2009-05-19  9:13 [PATCH] Scalar evolution and hidden casts Eric Botcazou
@ 2009-05-19  9:47 ` Richard Guenther
  2009-05-19 10:39   ` Eric Botcazou
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Guenther @ 2009-05-19  9:47 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

On Tue, May 19, 2009 at 11:18 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> Hi,
>
> I've attached an Ada testcase that should totally collapse at -O -gnatp, i.e.
> generates only "A = A + 1000000000", but doesn't because scev is very picky
> about casts, even hidden casts (tree-chrec.c contains many type assertions).
> The .lim dump file is entirely clean (attached, no casts) but .sccp shows that
> scev rematerializes some of them, yielding to scev_not_known:
>
> Analyzing # of iterations of loop 2
>  exit condition [2, + , 1] <= 1000000
>  bounds on difference of bases: 999998 ... 999998
>  result:
>    # of iterations 999999, bounded by 999999
>  (set_nb_iterations_in_loop = 999999))
> (chrec_apply
>  (varying_loop = 2
> )
>  (chrec = {(integer) p__a_lsm.11_11, +, 1}_2)
>  (x = 999999)
>  (res = (integer) p__a_lsm.11_11 + 999999))
>  (evolution_function = scev_not_known))
>
>
> Teaching tree-chrec.c to disregard useless casts appears to be tricky, you
> very quickly run into one of the type assertions.  Another strategy, which
> works at least in this case, is to change the type of the chrec and use that
> of the SSA name.  Patch attached, tested on i586-suse-linux, OK for mainline?

@@ -1181,6 +1181,7 @@ follow_ssa_edge_expr (struct loop *loop,
       /* This case is under the form "rhs0 +- rhs1".  */
       rhs0 = TREE_OPERAND (expr, 0);
       rhs1 = TREE_OPERAND (expr, 1);
+      type = TREE_TYPE (rhs0);
       STRIP_TYPE_NOPS (rhs0);
       STRIP_TYPE_NOPS (rhs1);
       return follow_ssa_edge_binary (loop, at_stmt, type, rhs0, code, rhs1,

that piece is ok.  Can you change STRIP_TYPE_NOPS to
STRIP_USELESS_TYPE_CONVERSIONS?

@@ -1215,16 +1216,17 @@ static t_bool
 follow_ssa_edge_in_rhs (struct loop *loop, gimple stmt,
                        gimple halting_phi, tree *evolution_of_loop, int limit)
 {
-  tree type = TREE_TYPE (gimple_assign_lhs (stmt));
   enum tree_code code = gimple_assign_rhs_code (stmt);

   switch (get_gimple_rhs_class (code))
     {
     case GIMPLE_BINARY_RHS:
-      return follow_ssa_edge_binary (loop, stmt, type,
-                                    gimple_assign_rhs1 (stmt), code,
-                                    gimple_assign_rhs2 (stmt),
-                                    halting_phi, evolution_of_loop, limit);
+      {
+       tree rhs1 = gimple_assign_rhs1 (stmt);
+       return follow_ssa_edge_binary (loop, stmt, TREE_TYPE (rhs1), rhs1,
+                                      code, gimple_assign_rhs2 (stmt),
+                                      halting_phi, evolution_of_loop, limit);
+      }

this is the symmetric change though the function should have
used

  tree type = gimple_expr_type (stmt);

and that function should probably change from

        switch (gimple_assign_rhs_code (stmt))
          {
          case POINTER_PLUS_EXPR:
            type = TREE_TYPE (gimple_assign_rhs1 (stmt));
            break;

          default:
            /* As fallback use the type of the LHS.  */
            type = TREE_TYPE (gimple_get_lhs (stmt));
            break;
          }

to be more specific.

Beware!  COMPLEX_EXPR is tcc_binary and your changes will
cause the wrong type to be used!  COMPLEX_EXPR should
probably be moved to tcc_expression.  Likewise for
WIDEN_SUM_EXPR and WIDEN_MULT_EXPR (though they do
not appear in the IL yet).  There doesn't seem to be useful
rules for tcc_binary - that the result type should match that of
the first operand would be a very useful one (and make your
patch valid).

I suppose you specifically hit the POINTER_PLUS_EXPR case?
Maybe just special-case that like in gimple_expr_type and use
that in follow_ssa_edge_in_rhs.

Thanks,
Richard.



>
> 2009-05-19  Eric Botcazou  <ebotcazou@adacore.com>
>
>        * tree-scalar-evolution.c (follow_ssa_edge_expr) <PLUS_EXPR>: Propagate
>        the type of the first operand.
>        (follow_ssa_edge_in_rhs) <GIMPLE_BINARY_RHS>: Likewise.
>
>
> --
> Eric Botcazou
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Scalar evolution and hidden casts
  2009-05-19  9:47 ` Richard Guenther
@ 2009-05-19 10:39   ` Eric Botcazou
  2009-05-19 10:48     ` Richard Guenther
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Botcazou @ 2009-05-19 10:39 UTC (permalink / raw)
  To: Richard Guenther; +Cc: gcc-patches

> Beware!  COMPLEX_EXPR is tcc_binary and your changes will
> cause the wrong type to be used!

You're right, but follow_ssa_edge_binary only handles POINTER_PLUS_EXPR, 
PLUS_EXPR and MINUS_EXPR so this doesn't really matter.  I guess I should 
specifically test for the 3 codes, like in follow_ssa_edge_expr.

> I suppose you specifically hit the POINTER_PLUS_EXPR case?
> Maybe just special-case that like in gimple_expr_type and use
> that in follow_ssa_edge_in_rhs.

No, it's the PLUS_EXPR case.

-- 
Eric Botcazou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Scalar evolution and hidden casts
  2009-05-19 10:39   ` Eric Botcazou
@ 2009-05-19 10:48     ` Richard Guenther
  2009-05-19 11:33       ` Eric Botcazou
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Guenther @ 2009-05-19 10:48 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

On Tue, May 19, 2009 at 12:44 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Beware!  COMPLEX_EXPR is tcc_binary and your changes will
>> cause the wrong type to be used!
>
> You're right, but follow_ssa_edge_binary only handles POINTER_PLUS_EXPR,
> PLUS_EXPR and MINUS_EXPR so this doesn't really matter.  I guess I should
> specifically test for the 3 codes, like in follow_ssa_edge_expr.

Yes, that would be better.

>> I suppose you specifically hit the POINTER_PLUS_EXPR case?
>> Maybe just special-case that like in gimple_expr_type and use
>> that in follow_ssa_edge_in_rhs.
>
> No, it's the PLUS_EXPR case.

Oh, ok.

I chickened out several times to reorganize the tree code binning
in tcc_binary/tcc_unary vs. tcc_expression ... maybe I should
come back to that.

Thanks,
Richard.

> --
> Eric Botcazou
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Scalar evolution and hidden casts
  2009-05-19 10:48     ` Richard Guenther
@ 2009-05-19 11:33       ` Eric Botcazou
  2009-05-19 11:50         ` Richard Guenther
  2009-10-11 19:47         ` H.J. Lu
  0 siblings, 2 replies; 8+ messages in thread
From: Eric Botcazou @ 2009-05-19 11:33 UTC (permalink / raw)
  To: Richard Guenther; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 858 bytes --]

> Yes, that would be better.

OK, here is the (barely tested) patch.  OK after a full testing cycle?


2009-05-19  Eric Botcazou  <ebotcazou@adacore.com>

	* tree-scalar-evolution.c (follow_ssa_edge_expr) <PLUS_EXPR>: Strip
	useless type conversions instead of type nops.  Propagate the type
	of the first operand.
	<ASSERT_EXPR>: Simplify.
        (follow_ssa_edge_in_rhs): Use gimple_expr_type to get the type.
	Rewrite using the RHS code as discriminant.
	<PLUS_EXPR>: Propagate the type of the first operand.


2009-05-19  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/loop_optimization6.ad[sb]: New test.


> I chickened out several times to reorganize the tree code binning
> in tcc_binary/tcc_unary vs. tcc_expression ... maybe I should
> come back to that.

Certainly having COMPLEX_EXPR as tcc_binary is a little surprising.

-- 
Eric Botcazou

[-- Attachment #2: h723-012_45.diff --]
[-- Type: text/x-diff, Size: 4825 bytes --]

Index: tree-scalar-evolution.c
===================================================================
--- tree-scalar-evolution.c	(revision 147612)
+++ tree-scalar-evolution.c	(working copy)
@@ -1141,11 +1141,10 @@ static t_bool
 follow_ssa_edge_expr (struct loop *loop, gimple at_stmt, tree expr, 
 		      gimple halting_phi, tree *evolution_of_loop, int limit)
 {
-  t_bool res = t_false;
-  tree rhs0, rhs1;
-  tree type = TREE_TYPE (expr);
-  enum tree_code code;
-  
+  enum tree_code code = TREE_CODE (expr);
+  tree type = TREE_TYPE (expr), rhs0, rhs1;
+  t_bool res;
+
   /* The EXPR is one of the following cases:
      - an SSA_NAME, 
      - an INTEGER_CST,
@@ -1154,7 +1153,7 @@ follow_ssa_edge_expr (struct loop *loop,
      - a MINUS_EXPR,
      - an ASSERT_EXPR,
      - other cases are not yet handled.  */
-  code = TREE_CODE (expr);
+
   switch (code)
     {
     case NOP_EXPR:
@@ -1168,43 +1167,42 @@ follow_ssa_edge_expr (struct loop *loop,
       /* This assignment is under the form "a_1 = 7".  */
       res = t_false;
       break;
-      
+
     case SSA_NAME:
       /* This assignment is under the form: "a_1 = b_2".  */
       res = follow_ssa_edge 
 	(loop, SSA_NAME_DEF_STMT (expr), halting_phi, evolution_of_loop, limit);
       break;
-      
+
     case POINTER_PLUS_EXPR:
     case PLUS_EXPR:
     case MINUS_EXPR:
       /* This case is under the form "rhs0 +- rhs1".  */
       rhs0 = TREE_OPERAND (expr, 0);
       rhs1 = TREE_OPERAND (expr, 1);
-      STRIP_TYPE_NOPS (rhs0);
-      STRIP_TYPE_NOPS (rhs1);
-      return follow_ssa_edge_binary (loop, at_stmt, type, rhs0, code, rhs1,
-				     halting_phi, evolution_of_loop, limit);
+      type = TREE_TYPE (rhs0);
+      STRIP_USELESS_TYPE_CONVERSION (rhs0);
+      STRIP_USELESS_TYPE_CONVERSION (rhs1);
+      res = follow_ssa_edge_binary (loop, at_stmt, type, rhs0, code, rhs1,
+				    halting_phi, evolution_of_loop, limit);
+      break;
 
     case ASSERT_EXPR:
-      {
-	/* This assignment is of the form: "a_1 = ASSERT_EXPR <a_2, ...>"
-	   It must be handled as a copy assignment of the form a_1 = a_2.  */
-	tree op0 = ASSERT_EXPR_VAR (expr);
-	if (TREE_CODE (op0) == SSA_NAME)
-	  res = follow_ssa_edge (loop, SSA_NAME_DEF_STMT (op0),
-				 halting_phi, evolution_of_loop, limit);
-	else
-	  res = t_false;
-	break;
-      }
-
+      /* This assignment is of the form: "a_1 = ASSERT_EXPR <a_2, ...>"
+	 It must be handled as a copy assignment of the form a_1 = a_2.  */
+      rhs0 = ASSERT_EXPR_VAR (expr);
+      if (TREE_CODE (rhs0) == SSA_NAME)
+	res = follow_ssa_edge (loop, SSA_NAME_DEF_STMT (rhs0),
+			       halting_phi, evolution_of_loop, limit);
+      else
+	res = t_false;
+      break;
 
     default:
       res = t_false;
       break;
     }
-  
+
   return res;
 }
 
@@ -1215,34 +1213,38 @@ static t_bool
 follow_ssa_edge_in_rhs (struct loop *loop, gimple stmt,
 			gimple halting_phi, tree *evolution_of_loop, int limit)
 {
-  tree type = TREE_TYPE (gimple_assign_lhs (stmt));
   enum tree_code code = gimple_assign_rhs_code (stmt);
+  tree type = gimple_expr_type (stmt), rhs1;
+  t_bool res;
 
-  switch (get_gimple_rhs_class (code))
+  switch (code)
     {
-    case GIMPLE_BINARY_RHS:
-      return follow_ssa_edge_binary (loop, stmt, type,
-				     gimple_assign_rhs1 (stmt), code,
-				     gimple_assign_rhs2 (stmt),
-				     halting_phi, evolution_of_loop, limit);
-    case GIMPLE_SINGLE_RHS:
-      return follow_ssa_edge_expr (loop, stmt, gimple_assign_rhs1 (stmt),
-				   halting_phi, evolution_of_loop, limit);
-    case GIMPLE_UNARY_RHS:
-      if (code == NOP_EXPR)
-	{
-	  /* This assignment is under the form "a_1 = (cast) rhs.  */
-	  t_bool res
-	    = follow_ssa_edge_expr (loop, stmt, gimple_assign_rhs1 (stmt),
+    case NOP_EXPR:
+      /* This assignment is under the form "a_1 = (cast) rhs.  */
+      res = follow_ssa_edge_expr (loop, stmt, gimple_assign_rhs1 (stmt),
+				  halting_phi, evolution_of_loop, limit);
+      *evolution_of_loop = chrec_convert (type, *evolution_of_loop, stmt);
+      break;
+
+    case POINTER_PLUS_EXPR:
+    case PLUS_EXPR:
+    case MINUS_EXPR:
+      rhs1 = gimple_assign_rhs1 (stmt);
+      res = follow_ssa_edge_binary (loop, stmt, TREE_TYPE (rhs1), rhs1,
+				    code, gimple_assign_rhs2 (stmt),
 				    halting_phi, evolution_of_loop, limit);
-	  *evolution_of_loop = chrec_convert (type, *evolution_of_loop, stmt);
-	  return res;
-	}
-      /* FALLTHRU */
+      break;
 
     default:
-      return t_false;
+      if (get_gimple_rhs_class (code) == GIMPLE_SINGLE_RHS)
+	res = follow_ssa_edge_expr (loop, stmt, gimple_assign_rhs1 (stmt),
+				    halting_phi, evolution_of_loop, limit);
+      else
+	res = t_false;
+      break;
     }
+
+  return res;
 }
 
 /* Checks whether the I-th argument of a PHI comes from a backedge.  */

[-- Attachment #3: loop_optimization6.adb --]
[-- Type: text/x-adasrc, Size: 433 bytes --]

-- { dg-do compile }
-- { dg-options "-O -gnatp" }

package body Loop_Optimization6 is
  procedure Foo is
  begin
    for I in 1 .. 1_000_000 loop
      A := A + 1;
    end loop;
  end Foo;

  procedure Bar is
  begin
    for J in 1 .. 1_000 loop
      Foo;
    end loop;
  end Bar;

  procedure Main is
  begin
    Bar;
  end;
end Loop_Optimization6;

-- { dg-final { scan-assembler "1000000000"  { target i?86-*-* x86_64-*-* } } }

[-- Attachment #4: loop_optimization6.ads --]
[-- Type: text/x-adasrc, Size: 92 bytes --]

package Loop_Optimization6 is
  A : Integer := 0;
  procedure Main;
end Loop_Optimization6;

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Scalar evolution and hidden casts
  2009-05-19 11:33       ` Eric Botcazou
@ 2009-05-19 11:50         ` Richard Guenther
  2009-10-11 19:47         ` H.J. Lu
  1 sibling, 0 replies; 8+ messages in thread
From: Richard Guenther @ 2009-05-19 11:50 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches

On Tue, May 19, 2009 at 1:37 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Yes, that would be better.
>
> OK, here is the (barely tested) patch.  OK after a full testing cycle?

Ok with (sorry for not noticing earlier)

     case NOP_EXPR:

replaced with CASE_CONVERT: in both places.

Thanks,
Richard.

>
> 2009-05-19  Eric Botcazou  <ebotcazou@adacore.com>
>
>        * tree-scalar-evolution.c (follow_ssa_edge_expr) <PLUS_EXPR>: Strip
>        useless type conversions instead of type nops.  Propagate the type
>        of the first operand.
>        <ASSERT_EXPR>: Simplify.
>        (follow_ssa_edge_in_rhs): Use gimple_expr_type to get the type.
>        Rewrite using the RHS code as discriminant.
>        <PLUS_EXPR>: Propagate the type of the first operand.
>
>
> 2009-05-19  Eric Botcazou  <ebotcazou@adacore.com>
>
>        * gnat.dg/loop_optimization6.ad[sb]: New test.
>
>
>> I chickened out several times to reorganize the tree code binning
>> in tcc_binary/tcc_unary vs. tcc_expression ... maybe I should
>> come back to that.
>
> Certainly having COMPLEX_EXPR as tcc_binary is a little surprising.
>
> --
> Eric Botcazou
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Scalar evolution and hidden casts
  2009-05-19 11:33       ` Eric Botcazou
  2009-05-19 11:50         ` Richard Guenther
@ 2009-10-11 19:47         ` H.J. Lu
  2009-12-27 15:49           ` H.J. Lu
  1 sibling, 1 reply; 8+ messages in thread
From: H.J. Lu @ 2009-10-11 19:47 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Richard Guenther, gcc-patches

On Tue, May 19, 2009 at 4:37 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Yes, that would be better.
>
> OK, here is the (barely tested) patch.  OK after a full testing cycle?
>
>
> 2009-05-19  Eric Botcazou  <ebotcazou@adacore.com>
>
>        * tree-scalar-evolution.c (follow_ssa_edge_expr) <PLUS_EXPR>: Strip
>        useless type conversions instead of type nops.  Propagate the type
>        of the first operand.
>        <ASSERT_EXPR>: Simplify.
>        (follow_ssa_edge_in_rhs): Use gimple_expr_type to get the type.
>        Rewrite using the RHS code as discriminant.
>        <PLUS_EXPR>: Propagate the type of the first operand.
>
>
> 2009-05-19  Eric Botcazou  <ebotcazou@adacore.com>
>
>        * gnat.dg/loop_optimization6.ad[sb]: New test.
>
>
>> I chickened out several times to reorganize the tree code binning
>> in tcc_binary/tcc_unary vs. tcc_expression ... maybe I should
>> come back to that.
>
> Certainly having COMPLEX_EXPR as tcc_binary is a little surprising.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41497


-- 
H.J.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Scalar evolution and hidden casts
  2009-10-11 19:47         ` H.J. Lu
@ 2009-12-27 15:49           ` H.J. Lu
  0 siblings, 0 replies; 8+ messages in thread
From: H.J. Lu @ 2009-12-27 15:49 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Richard Guenther, gcc-patches

On Sun, Oct 11, 2009 at 11:38 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, May 19, 2009 at 4:37 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>>> Yes, that would be better.
>>
>> OK, here is the (barely tested) patch.  OK after a full testing cycle?
>>
>>
>> 2009-05-19  Eric Botcazou  <ebotcazou@adacore.com>
>>
>>        * tree-scalar-evolution.c (follow_ssa_edge_expr) <PLUS_EXPR>: Strip
>>        useless type conversions instead of type nops.  Propagate the type
>>        of the first operand.
>>        <ASSERT_EXPR>: Simplify.
>>        (follow_ssa_edge_in_rhs): Use gimple_expr_type to get the type.
>>        Rewrite using the RHS code as discriminant.
>>        <PLUS_EXPR>: Propagate the type of the first operand.
>>
>>
>> 2009-05-19  Eric Botcazou  <ebotcazou@adacore.com>
>>
>>        * gnat.dg/loop_optimization6.ad[sb]: New test.
>>
>>
>>> I chickened out several times to reorganize the tree code binning
>>> in tcc_binary/tcc_unary vs. tcc_expression ... maybe I should
>>> come back to that.
>>
>> Certainly having COMPLEX_EXPR as tcc_binary is a little surprising.
>>
>
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41497
>

This may also cause:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42512

-- 
H.J.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-12-26 22:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-19  9:13 [PATCH] Scalar evolution and hidden casts Eric Botcazou
2009-05-19  9:47 ` Richard Guenther
2009-05-19 10:39   ` Eric Botcazou
2009-05-19 10:48     ` Richard Guenther
2009-05-19 11:33       ` Eric Botcazou
2009-05-19 11:50         ` Richard Guenther
2009-10-11 19:47         ` H.J. Lu
2009-12-27 15:49           ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).