[LLVMdev] DSA nodes do not get merged

Harmen van der Spek hvdspek at liacs.nl
Fri May 29 07:01:31 PDT 2009


Hi all,

I just ran into a strange problem. When using the Equivalence-class 
Bottom-up Data Structure Analysis pass and pool allocation, I noticed 
some objects using different pool descriptors where I expected them to 
be in the same pool. We use svn revision 66285 of the DSA.

The following 2 programs expose the problem. First the version that runs
correctly, ie. producing a single DSNode.

---------
typedef struct list {
	int             X;
	struct list     *Next;
} list;


void
MakeList()
{
	list *Result = malloc(sizeof(list));
     Result->X = 1;
     Result->Next = malloc(sizeof(list));
     Result = Result->Next;
     Result->X = 2;
     Result->Next = 0;
}

int main()
{
     MakeList();
     return 0;
}
---------


You can view the corresponding DSGraph here:
	http://www.liacs.nl/~hvdspek/images/dsgraph_1node.png

The following code produces 2 DSNodes:


-------------
typedef struct list {
	int             X;
	struct list     *Next;
} list;


void
MakeList()
{
	list *Result = malloc(sizeof(list));
     Result->X = 1;
     Result->Next = malloc(sizeof(list));
     Result->Next->X = 2;
     Result->Next->Next = 0;
}

int main()
{
     MakeList();
     return 0;
}
----------

You can view the corresponding DSGraph here:
	http://www.liacs.nl/~hvdspek/images/dsgraph_2nodes.png


Though one of the 2 nodes doesn't have the R flag, this is not the 
problem. Adding a printf statement does add the R flag, but still we get 
2 nodes. Does anybody have an idea why these nodes are not merged?



Harmen




More information about the llvm-dev mailing list