mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-10 04:33:40 +00:00
If "optimize for size" attribute is set then block non-trivial loop unswitches but allow trivial loop unswitches.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63670 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d839254888
commit
28aa5de050
@ -430,9 +430,6 @@ bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){
|
|||||||
initLoopData();
|
initLoopData();
|
||||||
Function *F = loopHeader->getParent();
|
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.
|
// Check to see if it would be profitable to unswitch current loop.
|
||||||
unsigned Cost = getLoopUnswitchCost(LoopCond);
|
unsigned Cost = getLoopUnswitchCost(LoopCond);
|
||||||
@ -440,6 +437,8 @@ bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){
|
|||||||
// Do not do non-trivial unswitch while optimizing for size.
|
// Do not do non-trivial unswitch while optimizing for size.
|
||||||
if (Cost && OptimizeForSize)
|
if (Cost && OptimizeForSize)
|
||||||
return false;
|
return false;
|
||||||
|
if (Cost && !F->isDeclaration() && F->hasFnAttr(Attribute::OptimizeForSize))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (Cost > Threshold) {
|
if (Cost > Threshold) {
|
||||||
// FIXME: this should estimate growth by the amount of code shared by the
|
// FIXME: this should estimate growth by the amount of code shared by the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user