This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Identifying a block copy
- From: "Pranav Bhandarkar" <pranav dot bhandarkar at gmail dot com>
- To: gcc at gnu dot org
- Date: Tue, 9 Oct 2007 13:23:47 +0530
- Subject: Identifying a block copy
Hi,
consider the following code,
struct x { int a; int b; int c; int d; int e[120];};
struct x *a, *b;
void foo ( )
{
*a = *b;
}
Now for the stmt int the function foo a memcpy will be generated.
However, this can be tail call optimized. My aim is to identify such
opportunities in find_tail_calls in tree-tailcall.c. However, for the
stmt
*a.0_1 ={v} *b.1_2;
var_can_have_subvars return zero for *a.0_1 . But a.0_1 is pointer
to a structure and *a.0_1 is a structure and therefore can have
subvars.
The comment for var_can_have_subvars says
/* Return true if V is a tree that we can have subvars for.
Normally, this is any aggregate type. Also complex
types which are not gimple registers can have subvars. */
IMHO, var_can_have_subvars for the above case should return true, but
it doesnt because it fails the following test in var_can_have_subvars.
/* Non decls or memory tags can never have subvars. */
if (!DECL_P (v) || MTAG_P (v))
return false;
Am I missing something here ?
TIA,
Pranav