Lines Matching defs:Term
79 bool openIf(BranchInst *Term);
81 bool insertElse(BranchInst *Term);
85 BranchInst *Term);
87 bool handleLoop(BranchInst *Term);
205 bool SIAnnotateControlFlow::openIf(BranchInst *Term) {
206 if (isUniform(Term))
209 IRBuilder<> IRB(Term);
210 Value *IfCall = IRB.CreateCall(If, {Term->getCondition()});
213 Term->setCondition(Cond);
214 push(Term->getSuccessor(1), Mask);
219 bool SIAnnotateControlFlow::insertElse(BranchInst *Term) {
220 if (isUniform(Term)) {
224 IRBuilder<> IRB(Term);
228 Term->setCondition(Cond);
229 push(Term->getSuccessor(1), Mask);
235 Value *Cond, PHINode *Broken, llvm::Loop *L, BranchInst *Term) {
256 Term : L->getHeader()->getTerminator();
270 bool SIAnnotateControlFlow::handleLoop(BranchInst *Term) {
271 if (isUniform(Term))
274 BasicBlock *BB = Term->getParent();
279 BasicBlock *Target = Term->getSuccessor(1);
283 Value *Cond = Term->getCondition();
284 Term->setCondition(BoolTrue);
285 Value *Arg = handleLoopCondition(Cond, Broken, L, Term);
299 CallInst *LoopCall = IRBuilder<>(Term).CreateCall(Loop, {Arg});
300 Term->setCondition(LoopCall);
302 push(Term->getSuccessor(0), Arg);
364 BranchInst *Term = dyn_cast<BranchInst>(BB->getTerminator());
366 if (!Term || Term->isUnconditional()) {
373 if (I.nodeVisited(Term->getSuccessor(1))) {
377 if (DT->dominates(Term->getSuccessor(1), BB))
378 Changed |= handleLoop(Term);
383 PHINode *Phi = dyn_cast<PHINode>(Term->getCondition());
385 Changed |= insertElse(Term);
393 Changed |= openIf(Term);