1 //===- LoopIndexSplit.cpp - Loop Index Splitting Pass ---------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Devang Patel and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements Loop Index Splitting Pass.
12 //===----------------------------------------------------------------------===//
14 #define DEBUG_TYPE "loop-index-split"
16 #include "llvm/Transforms/Scalar.h"
17 #include "llvm/Analysis/LoopPass.h"
18 #include "llvm/Analysis/ScalarEvolutionExpander.h"
19 #include "llvm/Analysis/Dominators.h"
20 #include "llvm/Transforms/Utils/BasicBlockUtils.h"
21 #include "llvm/Transforms/Utils/Cloning.h"
22 #include "llvm/Support/Compiler.h"
23 #include "llvm/ADT/Statistic.h"
27 STATISTIC(NumIndexSplit, "Number of loops index split");
31 class VISIBILITY_HIDDEN LoopIndexSplit : public LoopPass {
34 static char ID; // Pass ID, replacement for typeid
35 LoopIndexSplit() : LoopPass((intptr_t)&ID) {}
37 // Index split Loop L. Return true if loop is split.
38 bool runOnLoop(Loop *L, LPPassManager &LPM);
40 void getAnalysisUsage(AnalysisUsage &AU) const {
41 AU.addRequired<ScalarEvolution>();
42 AU.addPreserved<ScalarEvolution>();
43 AU.addRequiredID(LCSSAID);
44 AU.addPreservedID(LCSSAID);
45 AU.addRequired<LoopInfo>();
46 AU.addPreserved<LoopInfo>();
47 AU.addRequiredID(LoopSimplifyID);
48 AU.addPreservedID(LoopSimplifyID);
49 AU.addRequired<DominatorTree>();
50 AU.addPreserved<DominatorTree>();
51 AU.addPreserved<DominanceFrontier>();
58 SplitInfo() : SplitValue(NULL), SplitCondition(NULL) {}
60 // Induction variable's range is split at this value.
63 // This compare instruction compares IndVar against SplitValue.
64 ICmpInst *SplitCondition;
69 SplitCondition = NULL;
75 /// Find condition inside a loop that is suitable candidate for index split.
76 void findSplitCondition();
78 /// Find loop's exit condition.
79 void findLoopConditionals();
81 /// Return induction variable associated with value V.
82 void findIndVar(Value *V, Loop *L);
84 /// processOneIterationLoop - Current loop L contains compare instruction
85 /// that compares induction variable, IndVar, agains loop invariant. If
86 /// entire (i.e. meaningful) loop body is dominated by this compare
87 /// instruction then loop body is executed only for one iteration. In
88 /// such case eliminate loop structure surrounding this loop body. For
89 bool processOneIterationLoop(SplitInfo &SD);
91 /// If loop header includes loop variant instruction operands then
92 /// this loop may not be eliminated.
93 bool safeHeader(SplitInfo &SD, BasicBlock *BB);
95 /// If Exit block includes loop variant instructions then this
96 /// loop may not be eliminated.
97 bool safeExitBlock(SplitInfo &SD, BasicBlock *BB);
99 /// removeBlocks - Remove basic block DeadBB and all blocks dominated by DeadBB.
100 /// This routine is used to remove split condition's dead branch, dominated by
101 /// DeadBB. LiveBB dominates split conidition's other branch.
102 void removeBlocks(BasicBlock *DeadBB, Loop *LP, BasicBlock *LiveBB);
104 /// Find cost of spliting loop L.
105 unsigned findSplitCost(Loop *L, SplitInfo &SD);
106 bool splitLoop(SplitInfo &SD);
110 IndVarIncrement = NULL;
111 ExitCondition = NULL;
125 DominanceFrontier *DF;
126 SmallVector<SplitInfo, 4> SplitData;
128 // Induction variable whose range is being split by this transformation.
130 Instruction *IndVarIncrement;
132 // Loop exit condition.
133 ICmpInst *ExitCondition;
135 // Induction variable's initial value.
138 // Induction variable's final loop exit value operand number in exit condition..
139 unsigned ExitValueNum;
142 char LoopIndexSplit::ID = 0;
143 RegisterPass<LoopIndexSplit> X ("loop-index-split", "Index Split Loops");
146 LoopPass *llvm::createLoopIndexSplitPass() {
147 return new LoopIndexSplit();
150 // Index split Loop L. Return true if loop is split.
151 bool LoopIndexSplit::runOnLoop(Loop *IncomingLoop, LPPassManager &LPM_Ref) {
152 bool Changed = false;
156 // FIXME - Nested loops make dominator info updates tricky.
157 if (!L->getSubLoops().empty())
160 SE = &getAnalysis<ScalarEvolution>();
161 DT = &getAnalysis<DominatorTree>();
162 LI = &getAnalysis<LoopInfo>();
163 DF = getAnalysisToUpdate<DominanceFrontier>();
167 findLoopConditionals();
172 findSplitCondition();
174 if (SplitData.empty())
177 // First see if it is possible to eliminate loop itself or not.
178 for (SmallVector<SplitInfo, 4>::iterator SI = SplitData.begin(),
179 E = SplitData.end(); SI != E; ++SI) {
181 if (SD.SplitCondition->getPredicate() == ICmpInst::ICMP_EQ) {
182 Changed = processOneIterationLoop(SD);
185 // If is loop is eliminated then nothing else to do here.
191 unsigned MaxCost = 99;
193 unsigned MostProfitableSDIndex = 0;
194 for (SmallVector<SplitInfo, 4>::iterator SI = SplitData.begin(),
195 E = SplitData.end(); SI != E; ++SI, ++Index) {
198 // ICM_EQs are already handled above.
199 if (SD.SplitCondition->getPredicate() == ICmpInst::ICMP_EQ)
202 unsigned Cost = findSplitCost(L, SD);
204 MostProfitableSDIndex = Index;
207 // Split most profitiable condition.
208 Changed = splitLoop(SplitData[MostProfitableSDIndex]);
216 /// Return true if V is a induction variable or induction variable's
217 /// increment for loop L.
218 void LoopIndexSplit::findIndVar(Value *V, Loop *L) {
220 Instruction *I = dyn_cast<Instruction>(V);
224 // Check if I is a phi node from loop header or not.
225 if (PHINode *PN = dyn_cast<PHINode>(V)) {
226 if (PN->getParent() == L->getHeader()) {
232 // Check if I is a add instruction whose one operand is
233 // phi node from loop header and second operand is constant.
234 if (I->getOpcode() != Instruction::Add)
237 Value *Op0 = I->getOperand(0);
238 Value *Op1 = I->getOperand(1);
240 if (PHINode *PN = dyn_cast<PHINode>(Op0)) {
241 if (PN->getParent() == L->getHeader()
242 && isa<ConstantInt>(Op1)) {
249 if (PHINode *PN = dyn_cast<PHINode>(Op1)) {
250 if (PN->getParent() == L->getHeader()
251 && isa<ConstantInt>(Op0)) {
261 // Find loop's exit condition and associated induction variable.
262 void LoopIndexSplit::findLoopConditionals() {
264 BasicBlock *ExitBlock = NULL;
266 for (Loop::block_iterator I = L->block_begin(), E = L->block_end();
269 if (!L->isLoopExit(BB))
279 // If exit block's terminator is conditional branch inst then we have found
281 BranchInst *BR = dyn_cast<BranchInst>(ExitBlock->getTerminator());
282 if (!BR || BR->isUnconditional())
285 ICmpInst *CI = dyn_cast<ICmpInst>(BR->getCondition());
291 // Exit condition's one operand is loop invariant exit value and second
292 // operand is SCEVAddRecExpr based on induction variable.
293 Value *V0 = CI->getOperand(0);
294 Value *V1 = CI->getOperand(1);
296 SCEVHandle SH0 = SE->getSCEV(V0);
297 SCEVHandle SH1 = SE->getSCEV(V1);
299 if (SH0->isLoopInvariant(L) && isa<SCEVAddRecExpr>(SH1)) {
303 else if (SH1->isLoopInvariant(L) && isa<SCEVAddRecExpr>(SH0)) {
309 ExitCondition = NULL;
311 BasicBlock *Preheader = L->getLoopPreheader();
312 StartValue = IndVar->getIncomingValueForBlock(Preheader);
316 /// Find condition inside a loop that is suitable candidate for index split.
317 void LoopIndexSplit::findSplitCondition() {
320 // Check all basic block's terminators.
322 for (Loop::block_iterator I = L->block_begin(), E = L->block_end();
326 // If this basic block does not terminate in a conditional branch
327 // then terminator is not a suitable split condition.
328 BranchInst *BR = dyn_cast<BranchInst>(BB->getTerminator());
332 if (BR->isUnconditional())
335 ICmpInst *CI = dyn_cast<ICmpInst>(BR->getCondition());
336 if (!CI || CI == ExitCondition)
339 // If one operand is loop invariant and second operand is SCEVAddRecExpr
340 // based on induction variable then CI is a candidate split condition.
341 Value *V0 = CI->getOperand(0);
342 Value *V1 = CI->getOperand(1);
344 SCEVHandle SH0 = SE->getSCEV(V0);
345 SCEVHandle SH1 = SE->getSCEV(V1);
347 if (SH0->isLoopInvariant(L) && isa<SCEVAddRecExpr>(SH1)) {
349 SD.SplitCondition = CI;
350 if (PHINode *PN = dyn_cast<PHINode>(V1)) {
352 SplitData.push_back(SD);
354 else if (Instruction *Insn = dyn_cast<Instruction>(V1)) {
355 if (IndVarIncrement && IndVarIncrement == Insn)
356 SplitData.push_back(SD);
359 else if (SH1->isLoopInvariant(L) && isa<SCEVAddRecExpr>(SH0)) {
361 SD.SplitCondition = CI;
362 if (PHINode *PN = dyn_cast<PHINode>(V0)) {
364 SplitData.push_back(SD);
366 else if (Instruction *Insn = dyn_cast<Instruction>(V0)) {
367 if (IndVarIncrement && IndVarIncrement == Insn)
368 SplitData.push_back(SD);
374 /// processOneIterationLoop - Current loop L contains compare instruction
375 /// that compares induction variable, IndVar, against loop invariant. If
376 /// entire (i.e. meaningful) loop body is dominated by this compare
377 /// instruction then loop body is executed only once. In such case eliminate
378 /// loop structure surrounding this loop body. For example,
379 /// for (int i = start; i < end; ++i) {
380 /// if ( i == somevalue) {
384 /// can be transformed into
385 /// if (somevalue >= start && somevalue < end) {
389 bool LoopIndexSplit::processOneIterationLoop(SplitInfo &SD) {
391 BasicBlock *Header = L->getHeader();
393 // First of all, check if SplitCondition dominates entire loop body
396 // If SplitCondition is not in loop header then this loop is not suitable
397 // for this transformation.
398 if (SD.SplitCondition->getParent() != Header)
401 // If loop header includes loop variant instruction operands then
402 // this loop may not be eliminated.
403 if (!safeHeader(SD, Header))
406 // If Exit block includes loop variant instructions then this
407 // loop may not be eliminated.
408 if (!safeExitBlock(SD, ExitCondition->getParent()))
413 // As a first step to break this loop, remove Latch to Header edge.
414 BasicBlock *Latch = L->getLoopLatch();
415 BasicBlock *LatchSucc = NULL;
416 BranchInst *BR = dyn_cast<BranchInst>(Latch->getTerminator());
419 Header->removePredecessor(Latch);
420 for (succ_iterator SI = succ_begin(Latch), E = succ_end(Latch);
425 BR->setUnconditionalDest(LatchSucc);
427 Instruction *Terminator = Header->getTerminator();
428 Value *ExitValue = ExitCondition->getOperand(ExitValueNum);
430 // Replace split condition in header.
432 // SplitCondition : icmp eq i32 IndVar, SplitValue
434 // c1 = icmp uge i32 SplitValue, StartValue
435 // c2 = icmp ult i32 vSplitValue, ExitValue
437 bool SignedPredicate = ExitCondition->isSignedPredicate();
438 Instruction *C1 = new ICmpInst(SignedPredicate ?
439 ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE,
440 SD.SplitValue, StartValue, "lisplit",
442 Instruction *C2 = new ICmpInst(SignedPredicate ?
443 ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT,
444 SD.SplitValue, ExitValue, "lisplit",
446 Instruction *NSplitCond = BinaryOperator::createAnd(C1, C2, "lisplit",
448 SD.SplitCondition->replaceAllUsesWith(NSplitCond);
449 SD.SplitCondition->eraseFromParent();
451 // Now, clear latch block. Remove instructions that are responsible
452 // to increment induction variable.
453 Instruction *LTerminator = Latch->getTerminator();
454 for (BasicBlock::iterator LB = Latch->begin(), LE = Latch->end();
458 if (isa<PHINode>(I) || I == LTerminator)
461 if (I == IndVarIncrement)
462 I->replaceAllUsesWith(ExitValue);
464 I->replaceAllUsesWith(UndefValue::get(I->getType()));
465 I->eraseFromParent();
468 LPM->deleteLoopFromQueue(L);
470 // Update Dominator Info.
471 // Only CFG change done is to remove Latch to Header edge. This
472 // does not change dominator tree because Latch did not dominate
475 DominanceFrontier::iterator HeaderDF = DF->find(Header);
476 if (HeaderDF != DF->end())
477 DF->removeFromFrontier(HeaderDF, Header);
479 DominanceFrontier::iterator LatchDF = DF->find(Latch);
480 if (LatchDF != DF->end())
481 DF->removeFromFrontier(LatchDF, Header);
486 // If loop header includes loop variant instruction operands then
487 // this loop can not be eliminated. This is used by processOneIterationLoop().
488 bool LoopIndexSplit::safeHeader(SplitInfo &SD, BasicBlock *Header) {
490 Instruction *Terminator = Header->getTerminator();
491 for(BasicBlock::iterator BI = Header->begin(), BE = Header->end();
499 // SplitCondition itself is OK.
500 if (I == SD.SplitCondition)
503 // Induction variable is OK.
507 // Induction variable increment is OK.
508 if (I == IndVarIncrement)
511 // Terminator is also harmless.
515 // Otherwise we have a instruction that may not be safe.
522 // If Exit block includes loop variant instructions then this
523 // loop may not be eliminated. This is used by processOneIterationLoop().
524 bool LoopIndexSplit::safeExitBlock(SplitInfo &SD, BasicBlock *ExitBlock) {
526 for (BasicBlock::iterator BI = ExitBlock->begin(), BE = ExitBlock->end();
534 // Induction variable increment is OK.
535 if (IndVarIncrement && IndVarIncrement == I)
538 // Check if I is induction variable increment instruction.
539 if (!IndVarIncrement && I->getOpcode() == Instruction::Add) {
541 Value *Op0 = I->getOperand(0);
542 Value *Op1 = I->getOperand(1);
544 ConstantInt *CI = NULL;
546 if ((PN = dyn_cast<PHINode>(Op0))) {
547 if ((CI = dyn_cast<ConstantInt>(Op1)))
550 if ((PN = dyn_cast<PHINode>(Op1))) {
551 if ((CI = dyn_cast<ConstantInt>(Op0)))
555 if (IndVarIncrement && PN == IndVar && CI->isOne())
559 // I is an Exit condition if next instruction is block terminator.
560 // Exit condition is OK if it compares loop invariant exit value,
561 // which is checked below.
562 else if (ICmpInst *EC = dyn_cast<ICmpInst>(I)) {
563 if (EC == ExitCondition)
567 if (I == ExitBlock->getTerminator())
570 // Otherwise we have instruction that may not be safe.
574 // We could not find any reason to consider ExitBlock unsafe.
578 /// Find cost of spliting loop L. Cost is measured in terms of size growth.
579 /// Size is growth is calculated based on amount of code duplicated in second
581 unsigned LoopIndexSplit::findSplitCost(Loop *L, SplitInfo &SD) {
584 BasicBlock *SDBlock = SD.SplitCondition->getParent();
585 for (Loop::block_iterator I = L->block_begin(), E = L->block_end();
588 // If a block is not dominated by split condition block then
589 // it must be duplicated in both loops.
590 if (!DT->dominates(SDBlock, BB))
597 /// removeBlocks - Remove basic block DeadBB and all blocks dominated by DeadBB.
598 /// This routine is used to remove split condition's dead branch, dominated by
599 /// DeadBB. LiveBB dominates split conidition's other branch.
600 void LoopIndexSplit::removeBlocks(BasicBlock *DeadBB, Loop *LP,
601 BasicBlock *LiveBB) {
603 SmallVector<std::pair<BasicBlock *, succ_iterator>, 8> WorkList;
604 WorkList.push_back(std::make_pair(DeadBB, succ_begin(DeadBB)));
605 while (!WorkList.empty()) {
606 BasicBlock *BB = WorkList.back(). first;
607 succ_iterator SIter = WorkList.back().second;
609 // If all successor's are processed then remove this block.
610 if (SIter == succ_end(BB)) {
612 for(BasicBlock::iterator BBI = BB->begin(), BBE = BB->end();
614 Instruction *I = BBI;
615 I->replaceAllUsesWith(UndefValue::get(I->getType()));
616 I->eraseFromParent();
618 LPM->deleteSimpleAnalysisValue(BB, LP);
622 BB->eraseFromParent();
624 BasicBlock *SuccBB = *SIter;
625 ++WorkList.back().second;
627 if (DT->dominates(BB, SuccBB)) {
628 WorkList.push_back(std::make_pair(SuccBB, succ_begin(SuccBB)));
631 // If SuccBB is not dominated by BB then it is not removed, however remove
632 // any PHI incoming edge from BB.
633 for(BasicBlock::iterator SBI = SuccBB->begin(), SBE = SuccBB->end();
635 if (PHINode *PN = dyn_cast<PHINode>(SBI))
636 PN->removeIncomingValue(BB);
641 DT->changeImmediateDominator(SuccBB, LiveBB);
643 // If BB is not dominating SuccBB then SuccBB is in BB's dominance
645 DominanceFrontier::iterator BBDF = DF->find(BB);
646 DF->removeFromFrontier(BBDF, SuccBB);
648 // LiveBB is now dominating SuccBB. Which means SuccBB's dominance
649 // frontier is member of LiveBB's dominance frontier. However, SuccBB
650 // itself is not member of LiveBB's dominance frontier.
651 DominanceFrontier::iterator LiveDF = DF->find(LiveBB);
652 DominanceFrontier::iterator SuccDF = DF->find(SuccBB);
653 DominanceFrontier::DomSetType SuccBBSet = SuccDF->second;
654 for (DominanceFrontier::DomSetType::iterator SuccBBSetI = SuccBBSet.begin(),
655 SuccBBSetE = SuccBBSet.end(); SuccBBSetI != SuccBBSetE; ++SuccBBSetI) {
656 BasicBlock *DFMember = *SuccBBSetI;
657 // Insert only if LiveBB dominates DFMember.
658 if (!DT->dominates(LiveBB, DFMember))
659 LiveDF->second.insert(DFMember);
662 DF->removeFromFrontier(LiveDF, SuccBB);
668 bool LoopIndexSplit::splitLoop(SplitInfo &SD) {
670 BasicBlock *Preheader = L->getLoopPreheader();
671 BasicBlock *SplitBlock = SD.SplitCondition->getParent();
672 BasicBlock *Latch = L->getLoopLatch();
673 BasicBlock *Header = L->getHeader();
674 BranchInst *SplitTerminator = cast<BranchInst>(SplitBlock->getTerminator());
676 // FIXME - Unable to handle triange loops at the moment.
677 // In triangle loop, split condition is in header and one of the
678 // the split destination is loop latch. If split condition is EQ
679 // then such loops are already handle in processOneIterationLoop().
680 if (Header == SplitBlock
681 && (Latch == SplitTerminator->getSuccessor(0)
682 || Latch == SplitTerminator->getSuccessor(1)))
685 // True loop is original loop. False loop is cloned loop.
687 bool SignedPredicate = ExitCondition->isSignedPredicate();
688 //[*] Calculate True loop's new Exit Value in loop preheader.
689 // TLExitValue = min(SplitValue, ExitValue)
690 //[*] Calculate False loop's new Start Value in loop preheader.
691 // FLStartValue = min(SplitValue, TrueLoop.StartValue)
692 Value *TLExitValue = NULL;
693 Value *FLStartValue = NULL;
694 if (isa<ConstantInt>(SD.SplitValue)) {
695 TLExitValue = SD.SplitValue;
696 FLStartValue = SD.SplitValue;
699 Value *C1 = new ICmpInst(SignedPredicate ?
700 ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT,
702 ExitCondition->getOperand(ExitValueNum),
704 Preheader->getTerminator());
705 TLExitValue = new SelectInst(C1, SD.SplitValue,
706 ExitCondition->getOperand(ExitValueNum),
707 "lsplit.ev", Preheader->getTerminator());
709 Value *C2 = new ICmpInst(SignedPredicate ?
710 ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT,
711 SD.SplitValue, StartValue, "lsplit.sv",
712 Preheader->getTerminator());
713 FLStartValue = new SelectInst(C2, SD.SplitValue, StartValue,
714 "lsplit.sv", Preheader->getTerminator());
717 //[*] Clone loop. Avoid true destination of split condition and
718 // the blocks dominated by true destination.
719 DenseMap<const Value *, Value *> ValueMap;
720 Loop *FalseLoop = CloneLoop(L, LPM, LI, ValueMap, this);
721 BasicBlock *FalseHeader = FalseLoop->getHeader();
723 //[*] True loop's exit edge enters False loop.
724 PHINode *IndVarClone = cast<PHINode>(ValueMap[IndVar]);
725 BasicBlock *ExitBlock = ExitCondition->getParent();
726 BranchInst *ExitInsn = dyn_cast<BranchInst>(ExitBlock->getTerminator());
727 assert (ExitInsn && "Unable to find suitable loop exit branch");
728 BasicBlock *ExitDest = ExitInsn->getSuccessor(1);
730 if (L->contains(ExitDest)) {
731 ExitDest = ExitInsn->getSuccessor(0);
732 ExitInsn->setSuccessor(0, FalseHeader);
734 ExitInsn->setSuccessor(1, FalseHeader);
736 // Collect inverse map of Header PHINodes.
737 DenseMap<Value *, Value *> InverseMap;
738 for (BasicBlock::iterator BI = L->getHeader()->begin(),
739 BE = L->getHeader()->end(); BI != BE; ++BI) {
740 if (PHINode *PN = dyn_cast<PHINode>(BI)) {
741 PHINode *PNClone = cast<PHINode>(ValueMap[PN]);
742 InverseMap[PNClone] = PN;
747 // Update False loop's header
748 for (BasicBlock::iterator BI = FalseHeader->begin(), BE = FalseHeader->end();
750 if (PHINode *PN = dyn_cast<PHINode>(BI)) {
751 PN->removeIncomingValue(Preheader);
752 if (PN == IndVarClone)
753 PN->addIncoming(FLStartValue, ExitBlock);
755 PHINode *OrigPN = cast<PHINode>(InverseMap[PN]);
756 Value *V2 = OrigPN->getIncomingValueForBlock(ExitBlock);
757 PN->addIncoming(V2, ExitBlock);
763 // Update ExitDest. Now it's predecessor is False loop's exit block.
764 BasicBlock *ExitBlockClone = cast<BasicBlock>(ValueMap[ExitBlock]);
765 for (BasicBlock::iterator BI = ExitDest->begin(), BE = ExitDest->end();
767 if (PHINode *PN = dyn_cast<PHINode>(BI)) {
768 PN->addIncoming(ValueMap[PN->getIncomingValueForBlock(ExitBlock)], ExitBlockClone);
769 PN->removeIncomingValue(ExitBlock);
775 DT->changeImmediateDominator(FalseHeader, ExitBlock);
776 DT->changeImmediateDominator(ExitDest, cast<BasicBlock>(ValueMap[ExitBlock]));
779 assert (!L->contains(ExitDest) && " Unable to find exit edge destination");
781 //[*] Split Exit Edge.
782 SplitEdge(ExitBlock, FalseHeader, this);
784 //[*] Eliminate split condition's false branch from True loop.
785 BranchInst *BR = cast<BranchInst>(SplitBlock->getTerminator());
786 BasicBlock *FBB = BR->getSuccessor(1);
787 BR->setUnconditionalDest(BR->getSuccessor(0));
788 removeBlocks(FBB, L, BR->getSuccessor(0));
790 //[*] Update True loop's exit value using new exit value.
791 ExitCondition->setOperand(ExitValueNum, TLExitValue);
793 //[*] Eliminate split condition's true branch in False loop CFG.
794 BasicBlock *FSplitBlock = cast<BasicBlock>(ValueMap[SplitBlock]);
795 BranchInst *FBR = cast<BranchInst>(FSplitBlock->getTerminator());
796 BasicBlock *TBB = FBR->getSuccessor(0);
797 FBR->setUnconditionalDest(FBR->getSuccessor(1));
798 removeBlocks(TBB, FalseLoop, cast<BasicBlock>(FBR->getSuccessor(0)));