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 | 10b359ccb60de3114f262d2a204f54c532758cfc (patch) | |
tree | 5211bb82fcbc48a4c73c1976eaba7d3fe154b135 /lib/Transforms | |
parent | eb50479714047c5b8d88e5e879089925156194f2 (diff) | |
download | external_llvm-10b359ccb60de3114f262d2a204f54c532758cfc.zip external_llvm-10b359ccb60de3114f262d2a204f54c532758cfc.tar.gz external_llvm-10b359ccb60de3114f262d2a204f54c532758cfc.tar.bz2 |
Do not unswitch if the function notes say we're optimizing this function for size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55786 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/LoopUnswitch.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 372e6e4..f9046a1 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/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) |