[llvm] r301959 - [PartialInlining] Add more early filtering
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Tue May 2 11:43:22 PDT 2017
Author: davidxl
Date: Tue May 2 13:43:21 2017
New Revision: 301959
URL: http://llvm.org/viewvc/llvm-project?rev=301959&view=rev
Log:
[PartialInlining] Add more early filtering
This is a follow up to the previous
inline cost patch for quicker filtering.
Modified:
llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp
llvm/trunk/test/Transforms/CodeExtractor/PartialInlineOptRemark.ll
Modified: llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp?rev=301959&r1=301958&r2=301959&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/PartialInlining.cpp Tue May 2 13:43:21 2017
@@ -337,6 +337,16 @@ Function *PartialInlinerImpl::unswitchFu
if (F->hasAddressTaken())
return nullptr;
+ // Let inliner handle it
+ if (F->hasFnAttribute(Attribute::AlwaysInline))
+ return nullptr;
+
+ if (F->hasFnAttribute(Attribute::NoInline))
+ return nullptr;
+
+ if (PSI->isFunctionEntryCold(F))
+ return nullptr;
+
std::unique_ptr<FunctionOutliningInfo> OutliningInfo =
computeOutliningInfo(F);
Modified: llvm/trunk/test/Transforms/CodeExtractor/PartialInlineOptRemark.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/CodeExtractor/PartialInlineOptRemark.ll?rev=301959&r1=301958&r2=301959&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/CodeExtractor/PartialInlineOptRemark.ll (original)
+++ llvm/trunk/test/Transforms/CodeExtractor/PartialInlineOptRemark.ll Tue May 2 13:43:21 2017
@@ -64,6 +64,22 @@ bb2:
ret i32 %tmp3, !dbg !19
}
+define i32 @bar_cold(i32 %arg) local_unnamed_addr #3 !dbg !5 {
+bb:
+ %tmp = icmp slt i32 %arg, 0, !dbg !7
+ br i1 %tmp, label %bb1, label %bb2, !dbg !8
+
+bb1: ; preds = %bb
+ tail call void (...) @foo() #0, !dbg !9
+ tail call void (...) @foo() #0, !dbg !10
+ tail call void (...) @foo() #0, !dbg !11
+ br label %bb2, !dbg !18
+
+bb2: ; preds = %bb1, %bb
+ %tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
+ ret i32 %tmp3, !dbg !19
+}
+
; Function Attrs: nounwind
declare void @foo(...) local_unnamed_addr #0
@@ -73,16 +89,19 @@ bb:
; CHECK:remark{{.*}}bar partially inlined into dummy_caller
; CHECK-NOT:remark{{.*}}bar_noinline partially inlined into dummy_caller
; CHECK-NOT:remark{{.*}}bar_alwaysinline partially inlined into dummy_caller
+; CHECK-NOT:remark{{.*}}bar_cold partially inlined into dummy_caller
; LIMIT-NOT:remark{{.*}}bar partially inlined into dummy_caller
%tmp = tail call i32 @bar(i32 %arg), !dbg !21
%tmp2 = tail call i32 @bar_noinline(i32 %arg), !dbg !21
%tmp3 = tail call i32 @bar_alwaysinline(i32 %arg), !dbg !21
+ %tmp4 = tail call i32 @bar_cold(i32 %arg), !dbg !21
ret i32 %tmp, !dbg !22
}
attributes #0 = { nounwind }
attributes #1 = { noinline nounwind }
attributes #2 = { alwaysinline nounwind }
+attributes #3 = { cold nounwind }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3}
More information about the llvm-commits
mailing list