I've been working recently with the loop extraction pass in LLVM8.0 and LLVM's profile instrumentation metadata.
Just wanted to ask if there is a quick way to preserve Terminator Instruction profile weight metadata on extracted loops. I'm aware that IPO/LoopExtractor.cpp uses utils/CodeExtractor.cpp to extract a subset of basic blocks from a function and that it seems to be creating a new function and definitely the profiling info is being lost in that step.
Can anyone more experienced with the loop extraction pass provide some feedback on how to preserve per basic-block metadata work nicely with Code Extraction? My intuition so far is that the BasicBlocks set named "Blocks" removes and adds new basic blocks in severSplitPHINodes in CodeExtractor.cpp and then those blocks are used in moveCodeToFunction and I'm still working on saving the metadata from the old blocks into the new ones but since I'm having a hard time understanding "severSplitPHINodes" any info about whether this would be the right way to preserve profiling info or if I'm overlooking something obvious.
Thanks a lot,