I noticed that we add a constraint for each variable that is assigned to the return value of a function call even though that information is useless for
non pointers?  Is there a reason why we do this?

For the following C file:
int f(void);

int g(void)
{
  int y = f();
  int x = f();
  return y+x;
}
--------------------------------------------------------
We get in alias1:
Points-to analysis

Constraints:

ANYTHING = &ANYTHING
READONLY = &ANYTHING
INTEGER = &ANYTHING
D.1515_1 = &ANYTHING
D.1516_3 = &ANYTHING

Points-to sets

NULL = { }
ANYTHING = { ANYTHING }
READONLY = { ANYTHING }
INTEGER = { ANYTHING }
D.1515_1 = { ANYTHING }
D.1516_3 = { ANYTHING }

g: Total number of aliased vops: 0
--------------------------------------------------------

It seems like we are spending extra time to try to figure out the constraints
on these variables than what we should be doing.

The reason for this processing is the following code in tree-ssa-structalias.c:
          /* Only care about operations with pointers, structures
containing pointers, dereferences, and call expressions. */
          if (POINTER_TYPE_P (TREE_TYPE (lhsop))
              || AGGREGATE_TYPE_P (TREE_TYPE (lhsop))
              || TREE_CODE (rhsop) == CALL_EXPR)

Or I am missing that a constraint that can happen?

Thanks,
Andrew Pinski


Reply via email to