[LLVMdev] [PATCH] & Question: Preserving ProfileInfo for backend.

Dan Gohman gohman at apple.com
Tue Sep 8 11:21:03 PDT 2009

On Sep 8, 2009, at 1:27 AM, Andreas Neustifter wrote:

> Hash: SHA1
> Hi,
> the second part of my work is to preserve the profiling information
> through all the transformation passes and make it available to the
> backend machinery.
> Attached is an example patch on how I plan to preserve the information
> for a given transformation pass.

At a brief glance, this looks good.  It would be helpful to override the
verifyAnalysis method from the Pass class to verify that the profiling
information has been kept current.

> And now comes the question into place: whats the best way to attach  
> the
> profile info also the MachineBlocks and MachineFunctions? I was  
> thinking
> of converting the ProfileInfo into a template and using it for both
> BasicBlocks and MachineBasicBlocks.
> And where is the best point to transfer this information from the
> bytecode CFG to the machinecode CFG?

The SelectionDAGBuild phase is the only place where the precise  
between the BasicBlock CFG and the MachineBasicBlock CFG is
known.  It would also be possible to do the transfer in a later phase,  
though that
would require a fair amount of guesswork to determine how the two CFGs

This does point out a limitation of doing instrumentation at the LLVM  
IR level;
it won't be able to cover branches inserted during CodeGen.


More information about the llvm-dev mailing list