-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
Description
-> auto *MergePN =
PHINode::Create(I.getType(), /*NumReservedValues*/ 2, ".us-phi");
MergePN->insertBefore(MergeBB->getFirstInsertionPt());
I.replaceAllUsesWith(MergePN);
MergePN->addIncoming(&I, ExitBB);
MergePN->addIncoming(&ClonedI, ClonedExitBB); ClonedTerminator->eraseFromParent();
-> BranchInst::Create(ClonedSuccBB, ClonedParentBB);This instruction TI is moved out of the loop (i.e., the hoisted conditional instruction in LoopUnswitch) without dropping its debug location.
TI.moveBefore(*SplitBB, SplitBB->end()); Value *Cond = skipTrivialSelect(BI->getCondition());
if (InsertFreeze)
-> Cond = new FreezeInst(Cond, Cond->getName() + ".fr", BI->getIterator());
BI->setCondition(Cond); // After MSSAU update, remove the cloned terminator instruction NewTI.
ParentBB->getTerminator()->eraseFromParent();
// Create a new unconditional branch to the continuing block (as opposed to
// the one cloned).
-> BranchInst::Create(RetainedSuccBB, ParentBB);-> PHINode *Phi =
PHINode::Create(SI->getType(), 2, "unswitched.select", SI->getIterator());
Phi->addIncoming(SI->getTrueValue(), ThenBB);
Phi->addIncoming(SI->getFalseValue(), HeadBB);
SI->replaceAllUsesWith(Phi);
SI->eraseFromParent();godbolt: https://godbolt.org/z/dGGs89eKT (Note that the hoisted br instruction with !dbg !8 in %entry is corresponding to L2339 and other instructions without !dbg are corresponding to other Lxxx)