Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions llvm/include/llvm/CodeGen/MachineFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,10 @@ class LLVM_ABI MachineFunction {
//
template <> struct GraphTraits<MachineFunction*> :
public GraphTraits<MachineBasicBlock*> {
static NodeRef getEntryNode(MachineFunction *F) { return &F->front(); }
static NodeRef getEntryNode(MachineFunction *F) {
assert(!F->empty() && "No entry node for an empty function");
return &F->front();
}

// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
using nodes_iterator = pointer_iterator<MachineFunction::iterator>;
Expand All @@ -1516,7 +1519,10 @@ template <> struct GraphTraits<MachineFunction*> :
};
template <> struct GraphTraits<const MachineFunction*> :
public GraphTraits<const MachineBasicBlock*> {
static NodeRef getEntryNode(const MachineFunction *F) { return &F->front(); }
static NodeRef getEntryNode(const MachineFunction *F) {
assert(!F->empty() && "No entry node for an empty function");
return &F->front();
}

// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
using nodes_iterator = pointer_iterator<MachineFunction::const_iterator>;
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/CodeGen/MachineDominators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ MachineDominatorTreeWrapperPass::MachineDominatorTreeWrapperPass()
char &llvm::MachineDominatorsID = MachineDominatorTreeWrapperPass::ID;

bool MachineDominatorTreeWrapperPass::runOnMachineFunction(MachineFunction &F) {
assert(!F.empty() && "Function is empty");
DT = MachineDominatorTree(F);
return false;
}
Expand Down
Loading