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]

Re: [PATCH 14/16] tree-ssa-loop-niter.c: use gimple_phi in a few places


On 12/13/2013 10:58 AM, David Malcolm wrote:
  {
    gimple stmt = SSA_NAME_DEF_STMT (x);
@@ -2162,7 +2162,7 @@ chain_of_csts_start (struct loop *loop, tree x)
    if (gimple_code (stmt) == GIMPLE_PHI)
      {
        if (bb == loop->header)
-	return stmt;
+	return stmt->as_a_gimple_phi ();
return NULL;
      }
@@ -2195,10 +2195,10 @@ chain_of_csts_start (struct loop *loop, tree x)
If such phi node exists, it is returned, otherwise NULL is returned. */


I dislike separating the checking of gimple_code () and the following as_a. I rather envisioned this sort of thing as being more of an abstraction improvement if we never have to check gimple_code()... Then you are also less locked into a specific implementation.

So something more like:

if (gimple_phi phi = stmt->dyncast_gimple_phi ())
  {
     if (bb == loop->header)
       return phi;
  }


IMO anyway...

Andrew


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