llvm 3.9 CallGraphSCCPass results for C++ user defined type's constructor

Hello,

I have a question regarding results of CallGraphSCCPass.

When running CallGraphSCCPass on a bitcode of C++ class which has user defined data member, I expect CallGraphSCCPass to report the constructor of the data member before the constructor of the first class. However, this is not the case.

For example:

class point

{

point(int _x, int _y)

: x(_x)

, y(_y)

{

}

int x, y;

};

class rectangle

{

rectangle (int x1, int y1, int x2, int y2)

: p1(x1, y1)

, p2(x2, y2)

{

}

point p1;

point p2;

};

In llvm IR, I can see point’s constructor called from rectangle’s constructor. However when I run a custom CallGraphSCCPass, point’s constructor is not reported to be called from rectangle’s constructor. Interestingly, if I separate these classes into separate modules, and run the pass only on rectangle’s module, then it reports point’s constructor as a callee of rectangle’s constructor.

The problem is also there when running dot-callgraph pass of opt. Rectangle’s constructor in a call graph is connected to an external node, instead of constructor of point.

Could you please explain whether it is an expected behavior and if so what are the reasons behind it? Or is this a bug?

Please let me know if you need any further details.

Thanks,

Anahit.