[LLVMdev] possible bug in llvm-3.1

Eugenio Novás Cortés eugenio.novas at udc.es
Thu Nov 22 00:54:35 PST 2012


Hello:

We are developer-engineers of Appentra Solutions. We are working with
LLVM-3.1 and we have a problem. We think we have found a bug on
CallGraphNode. This is the code we have executed:

 virtual void getAnalysisUsage( llvm::AnalysisUsage & info ) const {

   info.addRequired<CallGraph>();

   ...

}

...

virtual bool runOnModule( Module & M )

{

...

CallGraph &CG = this->getAnalysis<CallGraph>();

CallGraphNode *cgn;

unsigned nref;

 for(CallGraph::const_iterator I=CG.begin(),E=CG.end();I!=E;I++)

 {

    cgn=I->second;

    if((cgn)&&(cgn->getFunction()))

    {

          nref=cgn->getNumReferences();

          llvm::dbgs()<<"uses:"<<nref<<"\n";

          cgn->dump();

    }

 }

...

}

In a simple program with only one function (Main), this is the output:

uses:0

Call graph node for function: 'main'<<0x7f928340c760>>  #uses=1


We have been searching in llvm files and dump function calls
getNumReferences() (which is in Callgraph.h). And it is assumed that the
call cgn->getNumReferences() references to the same function. Why are we
getting different values? Dump shows uses=1, and cgn->getNumReferences()
shows uses=0;

We are writing a Module pass as you can see in the previous code. We have
this pass registered as:

char PARALLWARE::ID = 0;

static RegisterPass<PARALLWARE> X( "parallware","run Parallware source to
source autoparallel compiler");


Is this a bug or we are making a mistake?


Thank you for your time.
We wait for your reply. Please, contact us at this e-mail:
eugenio.novas at udc.es.

Best regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121122/2b489c61/attachment.html>


More information about the llvm-dev mailing list