Ball Larus path profiling requires temporarily changing the CFG by replacing backedges (such as those caused by loops) in order to determine instrumentation placement, and attaching increments to edges [Ball96]. As far as I understand the CFG available through the BasicBlock class directly corresponds to the IR. I would rather not change the IR except to insert the profiling code. So, is there a graph structure that can be reused for such a purpose? Am I approaching this the wrong way?
T. Ball and J. R. Larus. "Efficient Path Profiling."
International Symposium on Microarchitecture, pages 46-57, 1996.