mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
Code refactoring.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100262 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -415,9 +415,15 @@ bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val) {
|
||||
|
||||
Function *F = loopHeader->getParent();
|
||||
|
||||
// If the condition is trivial, always unswitch. There is no code growth for
|
||||
// this case.
|
||||
if (!IsTrivialUnswitchCondition(LoopCond)) {
|
||||
Constant *CondVal = 0;
|
||||
BasicBlock *ExitBlock = 0;
|
||||
if (IsTrivialUnswitchCondition(LoopCond, &CondVal, &ExitBlock)) {
|
||||
// If the condition is trivial, always unswitch. There is no code growth
|
||||
// for this case.
|
||||
UnswitchTrivialCondition(currentLoop, LoopCond, CondVal, ExitBlock);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check to see if it would be profitable to unswitch current loop.
|
||||
|
||||
// Do not do non-trivial unswitch while optimizing for size.
|
||||
@@ -445,16 +451,8 @@ bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val) {
|
||||
<< currentLoop->getBlocks().size() << "\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Constant *CondVal;
|
||||
BasicBlock *ExitBlock;
|
||||
if (IsTrivialUnswitchCondition(LoopCond, &CondVal, &ExitBlock)) {
|
||||
UnswitchTrivialCondition(currentLoop, LoopCond, CondVal, ExitBlock);
|
||||
} else {
|
||||
UnswitchNontrivialCondition(LoopCond, Val, currentLoop);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user