diff options
author | Devang Patel <dpatel@apple.com> | 2008-09-04 18:55:13 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2008-09-04 18:55:13 +0000 |
commit | d52071540c67829ac7ef74db80fd5605bec0ab74 (patch) | |
tree | c40493d8e57a16995092e365653644be82c83664 /llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | |
parent | 19fb2aba50fc026c16a85687616d2ad82dc88f9c (diff) | |
download | bcm5719-llvm-d52071540c67829ac7ef74db80fd5605bec0ab74.tar.gz bcm5719-llvm-d52071540c67829ac7ef74db80fd5605bec0ab74.zip |
Do not unswitch if the function notes say we're optimizing this function for size.
llvm-svn: 55786
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopUnswitch.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp index 372e6e4f834..f9046a1a055 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -417,6 +417,13 @@ unsigned LoopUnswitch::getLoopUnswitchCost(Value *LIC) { /// LoopCond == Val to simplify the loop. If we decide that this is profitable, /// unswitch the loop, reprocess the pieces, then return true. bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){ + + Function *F = loopHeader->getParent(); + + // Do not unswitch if the function is optimized for size. + if (F->getNotes() & FN_NOTE_OptimizeForSize) + return false; + // Check to see if it would be profitable to unswitch current loop. unsigned Cost = getLoopUnswitchCost(LoopCond); @@ -445,7 +452,6 @@ bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){ } // FIXME: Reconstruct dom info, because it is not preserved properly. - Function *F = loopHeader->getParent(); if (DT) DT->runOnFunction(*F); if (DF) |