[LLVMdev] Find mallocs from a DSNode

Chris Lattner sabre at nondot.org
Sun Nov 10 22:55:01 PST 2002

> > When two nodes are merged, their Flags are bitwise or'd together...
> I realized that, but what if two nodes of the same type are merged?  Their
> flags will not indicate that a merge has occurred.  I'm concerned about the
> case where two malloc nodes are merged, because then if free is called on the
> memory represented by that node, you cannot be certain of either malloc's
> memory being freed.  I suppose after I iterate over the value map I'll see
> that two malloc instructions point to the same DSNode, which will give me the
> equivalent information.

Pretty much.  At some point, any representation has to merge together
information, because (in general) the program being represented may create
an unbounded number of objects dynamically, and we can obviously only
represent a finite number of them.  Looping through the program to see how
many scalars are pointing to the same node seems like a reasonable way to
get the information you need, but remember you also have this case:

for (...)
  X = malloc ...

where _1_ call site can create an unbounded number of objects, all of
which may be potentially merged together...



More information about the llvm-dev mailing list