[LLVMdev] Strange behaviour with profile data loading
madiyaan
ahmadsharif at hotmail.com
Sat Nov 1 21:51:06 PDT 2008
Hello:
I am following the example code in BasicBlockPlacement.cpp. That
transformation relies on basic block execution frequencies that have been
read from a profile file. This is how it loads the profile data:
1. In getAnalysisUsage, it calls addRequired<ProfileInfo>(), and
2. In the runOnFunction, it calls getAnalysis<ProfileInfo>() which returns a
ProfileInfo object pointer.
This works and it can read in the correct profile data.
What I want to do is have a profile-guided pass which works at the
MachineFunction level. I did the same thing, i.e.
1. In my getAnalysisUsage function, I call addRequired<ProfileInfo>(), and
2. In the runOnFunction, I call getAnalysis<ProfileInfo>() which returns me
a ProjectInfo object pointer.
However, when I use the ProfileInfo object pointer returned to me, every
BasicBlock's execution count is 0. Notice that I pass in the BasicBlock*,
and not the MachineBasicBlock* (which is what BasicBlockPlacement.cpp does
as well).
How can it be that when BasicBlockPlacement.cpp obtains the ProfileInfo*, it
has the correct execution and edge frequencies while when I call it from a
MachineFunction pass it has all 0s for the frequencies? I debugged it a bit,
and the getAnalysis<ProfileInfo>() function in both cases returns different
pointers.
Any idea how I can read profile information from a MachineFunction pass?
Thanks,
--
View this message in context: http://www.nabble.com/Strange-behaviour-with-profile-data-loading-tp20287134p20287134.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.
More information about the llvm-dev
mailing list