[llvm-commits] [llvm] r63670 - /llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Devang Patel
dpatel at apple.com
Tue Feb 3 14:04:27 PST 2009
Author: dpatel
Date: Tue Feb 3 16:04:27 2009
New Revision: 63670
URL: http://llvm.org/viewvc/llvm-project?rev=63670&view=rev
Log:
If "optimize for size" attribute is set then block non-trivial loop unswitches but allow trivial loop unswitches.
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp?rev=63670&r1=63669&r2=63670&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopUnswitch.cpp Tue Feb 3 16:04:27 2009
@@ -430,9 +430,6 @@
initLoopData();
Function *F = loopHeader->getParent();
- // Do not unswitch if the function is optimized for size.
- if (!F->isDeclaration() && F->hasFnAttr(Attribute::OptimizeForSize))
- return false;
// Check to see if it would be profitable to unswitch current loop.
unsigned Cost = getLoopUnswitchCost(LoopCond);
@@ -440,6 +437,8 @@
// Do not do non-trivial unswitch while optimizing for size.
if (Cost && OptimizeForSize)
return false;
+ if (Cost && !F->isDeclaration() && F->hasFnAttr(Attribute::OptimizeForSize))
+ return false;
if (Cost > Threshold) {
// FIXME: this should estimate growth by the amount of code shared by the
More information about the llvm-commits
mailing list