This is the mail archive of the gcc@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]

Re: query regarding adding a pass to undo final value replacement.


On Tue, Oct 14, 2008 at 9:14 AM, Zdenek Dvorak <rakdver@kam.mff.cuni.cz> wrote:
> Hi,
>
>> >> >> So if the ssa_names are infact reused they won't be the same
>> >> >> computations.
>> >> >
>> >> > do you also check this for ssa names inside the loop (in your example,
>> >> > D.10_1?
>> >>
>> >> If we have to reinsert for a = phi (B) . We do the following checks.
>> >>
>> >> 1. If the edge information in the phi node has remained the same then
>> >> we don't insert the phi node back in. This check is done by running
>> >> the phi node applying iterative_hash_expr on its PHI_ARG_DEF_PTR .
>> >>
>> >> Something like this is done for checking the consistency of hash values.
>> >>
>> >>   arg_p = PHI_ARG_DEF_PTR (phi_node , 0);
>> >>   op0 = USE_FROM_PTR (arg_p);
>> >>   val = iterative_hash_expr (op0, val);
>> >>   if (TREE_CODE (op0) == SSA_NAME)
>> >>     {
>> >>       val = iterative_hash_expr (SSA_NAME_VAR (op0), val);
>> >>       val += SSA_NAME_VERSION (op0);
>> >>
>> >>     }
>> >>
>> >> I suspect that this should catch the case that you mention here.
>> >
>> > now you have lost me completely -- this does not seem to check anything
>> > regarding the computations inside the loop, just about the phi node,
>>
>> Well since the phi node with a single operand depends on statements /
>> operations within the loop, the hashcode computed initially and
>> finally need to match. If the computations within the loop change then
>> clearly the hash values at the time of storing and restoring would be
>> different . So if the assignment to D.10_1 has changed in some form,
>> the hashvalues would be different.
>
> but you only take the hash of the argument of the phi node (i.e., the
> ssa name), not the computations on that it is based

Is this something like what you had in mind ?

gen_hash (stmt)
{

  if (stmt == NULL)
    return 0;

      use_operand_p use_p;
      ssa_op_iter iter;
      val += get_changed_stmt_hash (stmt);
      FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
      {
        tree use = USE_FROM_PTR (use_p);
        val += get_stmt_hash (use);
        val += gen_hash (SSA_NAME_DEF_STMT (use));
      }
    }
  else
    val += generate_phi_node_hashcode (stmt);


  return val;
}

and one calls this in continuation to my earlier email by


   arg_p = PHI_ARG_DEF_PTR (phi_node , 0);
   op0 = USE_FROM_PTR (arg_p);
   val = iterative_hash_expr (op0, val);
   if (TREE_CODE (op0) == SSA_NAME)
     {
       val = iterative_hash_expr (SSA_NAME_VAR (op0), val);
       val += SSA_NAME_VERSION (op0);

       val += gen_hash (SSA_NAME_DEF_STMT (op0));



  }



cheers
Ramana

>
> Zdenek
>



-- 
Ramana Radhakrishnan


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