diff options
author | Chris Lattner <sabre@nondot.org> | 2010-05-31 17:30:14 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-05-31 17:30:14 +0000 |
commit | 6c41ad8c9a93668c481436fc4a5e47e6f14776e7 (patch) | |
tree | 6ea0fee4e685e22e424ddd1c82eba5fb16a3bbb5 /lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 0ece9a12acd166b937fe615a24ee2135d92d66c1 (diff) |
fix PR6623: when optimizing for size, don't inline memcpy/memsets
that are too large. This causes the freebsd bootloader to be too
large apparently.
It's unclear if this should be an -Os or -Oz thing. Thoughts welcome.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105228 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 86e00ce6e2..c1b5ec2538 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -3266,6 +3266,15 @@ static bool FindOptimalMemOpLowering(std::vector<EVT> &MemOps, if (VT.bitsGT(LVT)) VT = LVT; } + + // If we're optimizing for size, and there is a limit, bump the maximum number + // of operations inserted down to 4. This is a wild guess that approximates + // 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; + } unsigned NumMemOps = 0; while (Size != 0) { |