mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-19 19:29:31 +00:00
When unswitching a trivial loop, do admit we are doing it! :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26102 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4c41d49a92
commit
4d1ca946ea
@ -346,6 +346,11 @@ static Loop *CloneLoop(Loop *L, Loop *PL, std::map<const Value*, Value*> &VM,
|
|||||||
/// moving the conditional branch outside of the loop and updating loop info.
|
/// moving the conditional branch outside of the loop and updating loop info.
|
||||||
void LoopUnswitch::UnswitchTrivialCondition(Loop *L, Value *Cond,
|
void LoopUnswitch::UnswitchTrivialCondition(Loop *L, Value *Cond,
|
||||||
ConstantBool *LoopCond) {
|
ConstantBool *LoopCond) {
|
||||||
|
DEBUG(std::cerr << "loop-unswitch: Trivial-Unswitch loop %"
|
||||||
|
<< L->getHeader()->getName() << " [" << L->getBlocks().size()
|
||||||
|
<< " blocks] in Function " << L->getHeader()->getParent()->getName()
|
||||||
|
<< " on cond:" << *Cond << "\n");
|
||||||
|
|
||||||
// First step, split the preahder, so that we know that there is a safe place
|
// First step, split the preahder, so that we know that there is a safe place
|
||||||
// to insert the conditional branch. We will change 'OrigPH' to have a
|
// to insert the conditional branch. We will change 'OrigPH' to have a
|
||||||
// conditional branch on Cond.
|
// conditional branch on Cond.
|
||||||
@ -373,6 +378,8 @@ void LoopUnswitch::UnswitchTrivialCondition(Loop *L, Value *Cond,
|
|||||||
// particular value, rewrite the loop with this info. We know that this will
|
// particular value, rewrite the loop with this info. We know that this will
|
||||||
// at least eliminate the old branch.
|
// at least eliminate the old branch.
|
||||||
RewriteLoopBodyWithConditionConstant(L, Cond, EnterOnTrue);
|
RewriteLoopBodyWithConditionConstant(L, Cond, EnterOnTrue);
|
||||||
|
|
||||||
|
++NumUnswitched;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user