[llvm] r344938 - [hot-cold-split] Add opt remark on success
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 22 12:06:43 PDT 2018
Author: tejohnson
Date: Mon Oct 22 12:06:42 2018
New Revision: 344938
URL: http://llvm.org/viewvc/llvm-project?rev=344938&view=rev
Log:
[hot-cold-split] Add opt remark on success
Summary: Emit optimization remark on successful hot cold split.
Reviewers: sebpop, hiraditya
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D53512
Modified:
llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp
llvm/trunk/test/Transforms/HotColdSplit/split-cold-2.ll
Modified: llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp?rev=344938&r1=344937&r2=344938&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp Mon Oct 22 12:06:42 2018
@@ -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(cons
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(cons
}
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;
}
Modified: llvm/trunk/test/Transforms/HotColdSplit/split-cold-2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/HotColdSplit/split-cold-2.ll?rev=344938&r1=344937&r2=344938&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/HotColdSplit/split-cold-2.ll (original)
+++ llvm/trunk/test/Transforms/HotColdSplit/split-cold-2.ll Mon Oct 22 12:06:42 2018
@@ -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
More information about the llvm-commits
mailing list