aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2011-01-06 01:04:47 +0000
committerEvan Cheng <evan.cheng@apple.com>2011-01-06 01:04:47 +0000
commit9a9d847afaf5df1b66b0f92692e31d1d4003c3a9 (patch)
tree7c8b071386a92b30baaf7c13143ab9f905af036a /lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parentd08e5b48bc5d9177b1d70a1980a7805420a99085 (diff)
r105228 reduced the memcpy / memset inline limit to 4 with -Os to avoid blowing
up freebsd bootloader. However, this doesn't make much sense for Darwin, whose -Os is meant to optimize for size only if it doesn't hurt performance. rdar://8821501 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122936 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 110812c437..be2de0c00d 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -50,6 +50,7 @@
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/Triple.h"
#include <algorithm>
#include <cmath>
using namespace llvm;
@@ -3286,8 +3287,14 @@ static bool FindOptimalMemOpLowering(std::vector<EVT> &MemOps,
// the size of a call to memcpy or memset (3 arguments + call).
if (Limit != ~0U) {
const Function *F = DAG.getMachineFunction().getFunction();
- if (F->hasFnAttr(Attribute::OptimizeForSize))
- Limit = 4;
+ if (F->hasFnAttr(Attribute::OptimizeForSize)) {
+ Triple T(((LLVMTargetMachine&)TLI.getTargetMachine()).getTargetTriple());
+ if (T.getOS() != Triple::Darwin)
+ // A pretty terrible hack to defat the wild guess. On Darwin, -Os means
+ // optimize for size without hurting performance so we don't want to
+ // bump down the limit.
+ Limit = 4;
+ }
}
unsigned NumMemOps = 0;