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