diff options
Diffstat (limited to 'llvm/lib/Transforms/IPO/HotColdSplitting.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/HotColdSplitting.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp index be4da249955..1d804ccb767 100644 --- a/llvm/lib/Transforms/IPO/HotColdSplitting.cpp +++ b/llvm/lib/Transforms/IPO/HotColdSplitting.cpp @@ -335,6 +335,7 @@ Function * HotColdSplitting::extractColdRegion(const SmallVectorImpl<BasicBlock *> &Region, DominatorTree *DT, BlockFrequencyInfo *BFI, OptimizationRemarkEmitter &ORE) { + assert(!Region.empty()); LLVM_DEBUG(for (auto *BB : Region) llvm::dbgs() << "\nExtracting: " << *BB;); @@ -348,6 +349,7 @@ HotColdSplitting::extractColdRegion(const SmallVectorImpl<BasicBlock *> &Region, if (Outputs.size() > 0) return nullptr; + Function *OrigF = Region[0]->getParent(); if (Function *OutF = CE.extractCodeRegion()) { User *U = *OutF->user_begin(); CallInst *CI = cast<CallInst>(U); @@ -359,6 +361,12 @@ HotColdSplitting::extractColdRegion(const SmallVectorImpl<BasicBlock *> &Region, } CI->setIsNoInline(); LLVM_DEBUG(llvm::dbgs() << "Outlined Region: " << *OutF); + ORE.emit([&]() { + return OptimizationRemark(DEBUG_TYPE, "HotColdSplit", + &*Region[0]->begin()) + << ore::NV("Original", OrigF) << " split cold code into " + << ore::NV("Split", OutF); + }); return OutF; } |