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.