24 std::vector<BasicBlock *> UnreachableBlocks;
28 UnreachableBlocks.push_back(&
I);
30 if (UnreachableBlocks.size() <= 1)
38 BB->back().eraseFromParent();
46 std::vector<BasicBlock *> ReturningBlocks;
50 ReturningBlocks.push_back(&
I);
52 if (ReturningBlocks.size() <= 1)
59 "UnifiedReturnBlock", &
F);
62 if (
F.getReturnType()->isVoidTy()) {
78 PN->
addIncoming(BB->getTerminator()->getOperand(0), BB);
80 BB->back().eraseFromParent();
91 Changed |= unifyUnreachableBlocks(
F);
LLVM Basic Block Representation.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
static BranchInst * Create(BasicBlock *IfTrue, InsertPosition InsertBefore=nullptr)
LLVM_ABI InstListType::iterator insertInto(BasicBlock *ParentBB, InstListType::iterator It)
Inserts an unlinked instruction into ParentBB at position It and returns the iterator of the inserted...
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
static PHINode * Create(Type *Ty, unsigned NumReservedValues, const Twine &NameStr="", InsertPosition InsertBefore=nullptr)
Constructors - NumReservedValues is a hint for the number of incoming edges that this phi node will h...
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
static ReturnInst * Create(LLVMContext &C, Value *retVal=nullptr, InsertPosition InsertBefore=nullptr)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
This function has undefined behavior.
This is an optimization pass for GlobalISel generic memory operations.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.