diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2011-01-06 01:04:47 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2011-01-06 01:04:47 +0000 |
| commit | 06536e7158c09f78042657f9834f6482c9fc694c (patch) | |
| tree | 4c3cbc75cbf2970fc20930600dfe8564411d87e0 /llvm/lib/CodeGen | |
| parent | ac730dd2d1d858a01e76042b52428851f11a3e13 (diff) | |
| download | bcm5719-llvm-06536e7158c09f78042657f9834f6482c9fc694c.tar.gz bcm5719-llvm-06536e7158c09f78042657f9834f6482c9fc694c.zip | |
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
llvm-svn: 122936
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 110812c4371..be2de0c00d6 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/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; |

