diff options
-rw-r--r-- | llvm/lib/Transforms/IPO/HotColdSplitting.cpp | 8 | ||||
-rw-r--r-- | llvm/test/Transforms/HotColdSplit/split-cold-2.ll | 5 |
2 files changed, 11 insertions, 2 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; } diff --git a/llvm/test/Transforms/HotColdSplit/split-cold-2.ll b/llvm/test/Transforms/HotColdSplit/split-cold-2.ll index cdbb67a2d4b..de0c7655a6e 100644 --- a/llvm/test/Transforms/HotColdSplit/split-cold-2.ll +++ b/llvm/test/Transforms/HotColdSplit/split-cold-2.ll @@ -1,9 +1,10 @@ -; RUN: opt -hotcoldsplit -S < %s | FileCheck %s -; RUN: opt -passes=hotcoldsplit -S < %s | FileCheck %s +; RUN: opt -hotcoldsplit -pass-remarks=hotcoldsplit -S < %s 2>&1 | FileCheck %s +; RUN: opt -passes=hotcoldsplit -pass-remarks=hotcoldsplit -S < %s 2>&1 | FileCheck %s ; Make sure this compiles. This test used to fail with an invalid phi node: the ; two predecessors were outlined and the SSA representation was invalid. +; CHECK: remark: <unknown>:0:0: fun split cold code into fun_if.else ; CHECK-LABEL: @fun ; CHECK: codeRepl: ; CHECK-NEXT: call void @fun_if.else |