mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-12 06:06:19 +00:00
[PartialInlining] Add more early filtering
This is a follow up to the previous inline cost patch for quicker filtering. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301959 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5c95b810cb
commit
1d482c01f6
@ -337,6 +337,16 @@ Function *PartialInlinerImpl::unswitchFunction(Function *F) {
|
||||
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);
|
||||
|
||||
|
@ -64,6 +64,22 @@ bb2: ; preds = %bb1, %bb
|
||||
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}
|
||||
|
Loading…
Reference in New Issue
Block a user