diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-10-01 18:05:30 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-10-01 18:05:30 +0000 |
commit | 187c774a7650e4bbbaac175cb6509f709edba593 (patch) | |
tree | 1d373efa5adfebeac5a5027b4524442a21942719 /lib/Transforms/IPO | |
parent | 04132a6c5cbf4089b1c705925afb70258341530e (diff) | |
download | external_llvm-187c774a7650e4bbbaac175cb6509f709edba593.zip external_llvm-187c774a7650e4bbbaac175cb6509f709edba593.tar.gz external_llvm-187c774a7650e4bbbaac175cb6509f709edba593.tar.bz2 |
Don't merge tiny functions.
It's silly to merge functions like these:
define void @foo(i32 %x) {
ret void
}
define void @bar(i32 %x) {
ret void
}
to get
define void @bar(i32) {
tail call void @foo(i32 %0)
ret void
}
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191786 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r-- | lib/Transforms/IPO/MergeFunctions.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Transforms/IPO/MergeFunctions.cpp b/lib/Transforms/IPO/MergeFunctions.cpp index 0f09b90..7e4c1668 100644 --- a/lib/Transforms/IPO/MergeFunctions.cpp +++ b/lib/Transforms/IPO/MergeFunctions.cpp @@ -836,6 +836,18 @@ bool MergeFunctions::insert(ComparableFunction &NewF) { const ComparableFunction &OldF = *Result.first; + // Don't merge tiny functions, since it can just end up making the function + // larger. + // FIXME: Should still merge them if they are unnamed_addr and produce an + // alias. + if (NewF.getFunc()->size() == 1) { + if (NewF.getFunc()->front().size() <= 2) { + DEBUG(dbgs() << NewF.getFunc()->getName() + << " is to small to bother merging\n"); + return false; + } + } + // Never thunk a strong function to a weak function. assert(!OldF.getFunc()->mayBeOverridden() || NewF.getFunc()->mayBeOverridden()); |