mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-18 12:29:27 +00:00
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
This commit is contained in:
parent
eb50479714
commit
10b359ccb6
@ -417,6 +417,13 @@ unsigned LoopUnswitch::getLoopUnswitchCost(Value *LIC) {
|
|||||||
/// LoopCond == Val to simplify the loop. If we decide that this is profitable,
|
/// LoopCond == Val to simplify the loop. If we decide that this is profitable,
|
||||||
/// unswitch the loop, reprocess the pieces, then return true.
|
/// unswitch the loop, reprocess the pieces, then return true.
|
||||||
bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){
|
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.
|
// Check to see if it would be profitable to unswitch current loop.
|
||||||
unsigned Cost = getLoopUnswitchCost(LoopCond);
|
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.
|
// FIXME: Reconstruct dom info, because it is not preserved properly.
|
||||||
Function *F = loopHeader->getParent();
|
|
||||||
if (DT)
|
if (DT)
|
||||||
DT->runOnFunction(*F);
|
DT->runOnFunction(*F);
|
||||||
if (DF)
|
if (DF)
|
||||||
|
Loading…
Reference in New Issue
Block a user