This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Verify that VIEW_CONVERT_EXPR is GIMPLE invariant when folding


RTH asked me to do this quite a while ago, but I hadn't gotten a chance
to check it in until now.

Tested on x86_64-linux-gnu.

2005-02-24  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* tree-ssa-ccp.c (visit_assignment): Verify that result of
	VIEW_CONVERT_EXPR is_gimple_min_invariant.

*** tree-ssa-ccp.c	19 Feb 2005 01:29:33 -0000	2.57
--- tree-ssa-ccp.c	23 Feb 2005 22:32:09 -0000
*************** visit_assignment (tree stmt, tree *outpu
*** 1061,1067 ****
  
    /* If the original LHS was a VIEW_CONVERT_EXPR, modify the constant
!      value to be a VIEW_CONVERT_EXPR of the old constant value.  This is
!      valid because a VIEW_CONVERT_EXPR is valid everywhere an operand of
!      aggregate type is valid.
  
       ??? Also, if this was a definition of a bitfield, we need to widen
--- 1061,1065 ----
  
    /* If the original LHS was a VIEW_CONVERT_EXPR, modify the constant
!      value to be a VIEW_CONVERT_EXPR of the old constant value.
  
       ??? Also, if this was a definition of a bitfield, we need to widen
*************** visit_assignment (tree stmt, tree *outpu
*** 1074,1081 ****
  	&& val.lattice_val == CONSTANT)
        {
! 	val.const_val = build1 (VIEW_CONVERT_EXPR,
! 				TREE_TYPE (TREE_OPERAND (orig_lhs, 0)),
! 				val.const_val);
  	orig_lhs = TREE_OPERAND (orig_lhs, 1);
        }
  
--- 1072,1087 ----
  	&& val.lattice_val == CONSTANT)
        {
! 	tree w = fold (build1 (VIEW_CONVERT_EXPR,
! 			       TREE_TYPE (TREE_OPERAND (orig_lhs, 0)),
! 			       val.const_val));
! 
  	orig_lhs = TREE_OPERAND (orig_lhs, 1);
+ 	if (w && is_gimple_min_invariant (w))
+ 	  val.const_val = w;
+ 	else
+ 	  {
+ 	    val.lattice_val = VARYING;
+ 	    val.const_val = NULL;
+ 	  }
        }
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]