[PATCH] D53518: [HotColdSplitting] Attach MinSize to outlined code
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 23 12:43:26 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL345072: [HotColdSplitting] Attach MinSize to outlined code (authored by vedantk, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D53518?vs=170462&id=170728#toc
Repository:
rL LLVM
https://reviews.llvm.org/D53518
Files:
llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp
llvm/trunk/test/Transforms/HotColdSplit/minsize.ll
Index: llvm/trunk/test/Transforms/HotColdSplit/minsize.ll
===================================================================
--- llvm/trunk/test/Transforms/HotColdSplit/minsize.ll
+++ llvm/trunk/test/Transforms/HotColdSplit/minsize.ll
@@ -0,0 +1,32 @@
+; RUN: opt -hotcoldsplit -S < %s | FileCheck %s
+
+; CHECK-LABEL: @fun
+; CHECK: codeRepl:
+; CHECK-NEXT: call void @fun_if.else
+
+define void @fun() {
+entry:
+ br i1 undef, label %if.then, label %if.else
+
+if.then:
+ ret void
+
+if.else:
+ br label %if.then4
+
+if.then4:
+ br i1 undef, label %if.then5, label %if.end
+
+if.then5:
+ br label %cleanup
+
+if.end:
+ br label %cleanup
+
+cleanup:
+ %cleanup.dest.slot.0 = phi i32 [ 1, %if.then5 ], [ 0, %if.end ]
+ unreachable
+}
+
+; CHECK: define {{.*}} @fun_if.else{{.*}}#[[outlined_func_attr:[0-9]+]]
+; CHECK: attributes #[[outlined_func_attr]] = { {{.*}}minsize
Index: llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp
+++ llvm/trunk/lib/Transforms/IPO/HotColdSplitting.cpp
@@ -360,6 +360,13 @@
CS.setCallingConv(CallingConv::Cold);
}
CI->setIsNoInline();
+
+ // Try to make the outlined code as small as possible on the assumption
+ // that it's cold.
+ assert(!OutF->hasFnAttribute(Attribute::OptimizeNone) &&
+ "An outlined function should never be marked optnone");
+ OutF->addFnAttr(Attribute::MinSize);
+
LLVM_DEBUG(llvm::dbgs() << "Outlined Region: " << *OutF);
ORE.emit([&]() {
return OptimizationRemark(DEBUG_TYPE, "HotColdSplit",
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53518.170728.patch
Type: text/x-patch
Size: 1639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181023/a2505fcd/attachment.bin>
More information about the llvm-commits
mailing list