Lines Matching full:bb
14 // sw.bb sw.bb
19 // br sw.bb / | \
20 // sw.bb.2 sw.bb.3 sw.bb.1
323 BasicBlock *BB; member
343 for (const BasicBlock *BB : Path) { in operator <<() local
345 if (BB->hasName()) in operator <<()
346 raw_string_ostream(BBName) << BB->getName(); in operator <<()
348 raw_string_ostream(BBName) << BB; in operator <<()
370 void setDeterminator(const BasicBlock *BB) { DBB = BB; } in setDeterminator()
483 void addToQueue(Value *Val, BasicBlock *BB, in addToQueue()
488 Q.push_back({Val, BB}); in addToQueue()
560 for (const BasicBlock *BB : Path) { in run() local
561 if (StateDef.contains(BB)) { in run()
562 const PHINode *Phi = dyn_cast<PHINode>(StateDef[BB]); in run()
568 TPath.setDeterminator(BB); in run()
574 if (TPath.isExitValueSet() && BB == Path.front()) in run()
577 PrevBB = BB; in run()
590 PathsType paths(BasicBlock *BB, VisitedBlocks &Visited, in paths()
605 Visited.insert(BB); in paths()
607 // Stop if we have reached the BB out of loop, since its successors have no in paths()
609 // TODO: Do we need to stop exploring if BB is the outer loop of the switch? in paths()
610 if (!LI->getLoopFor(BB)) in paths()
616 for (BasicBlock *Succ : successors(BB)) { in paths()
622 Res.push_back({BB}); in paths()
633 NewPath.push_front(BB); in paths()
643 Visited.erase(BB); in paths()
657 for (BasicBlock *BB : Path) in getStateDefMap()
658 LoopBBs.insert(BB); in getStateDefMap()
694 /// The determinator BB should precede the switch-defining BB.
724 "The first BB in a threading path should have the switch instruction"); in isSupported()
736 for (BasicBlock *BB : Path) { in isSupported()
737 if (BB == DeterminatorBB) in isSupported()
739 if (BB == SwitchCondDefBB) in isSupported()
741 if (BB == SwitchCondUseBB) in isSupported()
786 // just being used to ensure (BB, State) pairs are only counted once. in isLegalAndProfitableToTransform()
795 BasicBlock *BB = SwitchPaths->getSwitchBlock(); in isLegalAndProfitableToTransform() local
796 BasicBlock *VisitedBB = getClonedBB(BB, NextState, DuplicateMap); in isLegalAndProfitableToTransform()
798 Metrics.analyzeBasicBlock(BB, *TTI, EphValues); in isLegalAndProfitableToTransform()
799 DuplicateMap[BB].push_back({BB, NextState}); in isLegalAndProfitableToTransform()
811 BB = *BBIt; in isLegalAndProfitableToTransform()
812 VisitedBB = getClonedBB(BB, NextState, DuplicateMap); in isLegalAndProfitableToTransform()
815 Metrics.analyzeBasicBlock(BB, *TTI, EphValues); in isLegalAndProfitableToTransform()
816 DuplicateMap[BB].push_back({BB, NextState}); in isLegalAndProfitableToTransform()
918 for (BasicBlock *BB : successors(SwitchBlock)) in createAllExitPaths()
919 BlocksToClean.insert(BB); in createAllExitPaths()
935 for (BasicBlock *BB : BlocksToClean) in createAllExitPaths()
936 cleanPhiNodes(BB); in createAllExitPaths()
958 // When there is only one BB in PathBBs, the determinator takes itself as a in createExitPath()
962 BasicBlock *BB = *BBIt; in createExitPath() local
963 BlocksToClean.insert(BB); in createExitPath()
965 // We already cloned BB for this NextState, now just update the branch in createExitPath()
967 BasicBlock *NextBB = getClonedBB(BB, NextState, DuplicateMap); in createExitPath()
969 updatePredecessor(PrevBB, BB, NextBB, DTU); in createExitPath()
974 // Clone the BB and update the successor of Prev to jump to the new block in createExitPath()
976 BB, PrevBB, NextState, DuplicateMap, NewDefs, DTU); in createExitPath()
977 DuplicateMap[BB].push_back({NewBB, NextState}); in createExitPath()
995 BasicBlock *BB = I->getParent(); in updateSSA() local
1003 if (UserPN->getIncomingBlock(U) == BB) in updateSSA()
1005 } else if (User->getParent() == BB) { in updateSSA()
1019 // We found a use of I outside of BB. Rename all uses of I that are in updateSSA()
1023 SSAUpdate.AddAvailableValue(VarNum, BB, I); in updateSSA()
1040 /// BB, and remapping uses that were defined locally in the cloned BB.
1041 BasicBlock *cloneBlockAndUpdatePredecessor(BasicBlock *BB, BasicBlock *PrevBB, in cloneBlockAndUpdatePredecessor()
1048 BB, VMap, ".jt" + std::to_string(NextState.getLimitedValue()), in cloneBlockAndUpdatePredecessor()
1049 BB->getParent()); in cloneBlockAndUpdatePredecessor()
1050 NewBB->moveAfter(BB); in cloneBlockAndUpdatePredecessor()
1054 // Do not remap operands of PHINode in case a definition in BB is an in cloneBlockAndUpdatePredecessor()
1065 updateSuccessorPhis(BB, NewBB, NextState, VMap, DuplicateMap); in cloneBlockAndUpdatePredecessor()
1066 updatePredecessor(PrevBB, BB, NewBB, DTU); in cloneBlockAndUpdatePredecessor()
1079 /// Update the phi nodes in BB's successors.
1082 /// instruction wherever there is an incoming value from BB.
1083 void updateSuccessorPhis(BasicBlock *BB, BasicBlock *ClonedBB, in updateSuccessorPhis()
1088 // If BB is the last block in the path, we can simply update the one case in updateSuccessorPhis()
1090 if (BB == SwitchPaths->getSwitchBlock()) { in updateSuccessorPhis()
1100 for (BasicBlock *Succ : successors(BB)) { in updateSuccessorPhis()
1112 // If there is a phi with an incoming value from BB, create a new incoming in updateSuccessorPhis()
1114 // value from BB or a cloned value. in updateSuccessorPhis()
1118 Value *Incoming = Phi->getIncomingValueForBlock(BB); in updateSuccessorPhis()
1195 BasicBlock *BB = TPath.getPath().back(); in updateLastSuccessor() local
1196 BasicBlock *LastBlock = getClonedBB(BB, NextState, DuplicateMap); in updateLastSuccessor()
1220 void cleanPhiNodes(BasicBlock *BB) { in cleanPhiNodes()
1221 // If BB is no longer reachable, remove any remaining phi nodes in cleanPhiNodes()
1222 if (pred_empty(BB)) { in cleanPhiNodes()
1224 for (auto II = BB->begin(); PHINode *Phi = dyn_cast<PHINode>(II); ++II) { in cleanPhiNodes()
1235 for (auto II = BB->begin(); PHINode *Phi = dyn_cast<PHINode>(II); ++II) { in cleanPhiNodes()
1238 if (!isPredecessor(BB, IncomingBB)) in cleanPhiNodes()
1241 for (BasicBlock *BB : BlocksToRemove) in cleanPhiNodes()
1242 Phi->removeIncomingValue(BB); in cleanPhiNodes()
1246 /// Checks if BB was already cloned for a particular next state value. If it
1248 BasicBlock *getClonedBB(BasicBlock *BB, const APInt &NextState, in getClonedBB()
1250 CloneList ClonedBBs = DuplicateMap[BB]; in getClonedBB()
1253 // return the corresponding BB in getClonedBB()
1257 return It != ClonedBBs.end() ? (*It).BB : nullptr; in getClonedBB()
1275 /// Returns true if IncomingBB is a predecessor of BB.
1276 bool isPredecessor(BasicBlock *BB, BasicBlock *IncomingBB) { in isPredecessor()
1277 return llvm::is_contained(predecessors(BB), IncomingBB); in isPredecessor()
1304 for (BasicBlock &BB : F) { in run()
1305 auto *SI = dyn_cast<SwitchInst>(BB.getTerminator()); in run()
1309 LLVM_DEBUG(dbgs() << "\nCheck if SwitchInst in BB " << BB.getName() in run()
1316 LLVM_DEBUG(dbgs() << "\nSwitchInst in BB " << BB.getName() << " is a " in run()