About static-profile in llvm-2.8

When I searched for branch frequency profiling on the internet, I got this link by a casual chance: http://homepages.dcc.ufmg.br/~rimsa/tools/stprof-llvm.patch.
It seems it was written by Andrei Rimsa.

So I downloaded and integrate these files into the llvm-2.8 building. After the building, I tried “opt -static-profile bitcnt_1.bc”, and an segment fault error occured. I debugged it step by step, and found the initial reason was:
in StaticProfilePass.cpp: line 307 (funciton: PropagateCallFrequency), since the root of type CallGraphNode * has no valid function, the node->getFunction() returned a NULL pointer, thus the F->getName() in line 307 caused a code down. I confirmed that there was a main function in bitcnt_1.c (from MiBench)

I need the help.

Hi Li Qingan,

I did this patch for LLVM 2.7, and ported it to LLVM 2.8, but I
haven't fully tested in 2.8.
Could you please provide your .bc?