forked from OSchip/llvm-project
Move BasicBlock::getTerminator definition to the header
This way it can be inlined to its caller. This method shows up in the profile and it is essentially a fancy getter. It would benefit from inlining into its callers. NFC.
This commit is contained in:
parent
01bc5b7034
commit
857d699667
|
@ -116,7 +116,11 @@ public:
|
||||||
|
|
||||||
/// Returns the terminator instruction if the block is well formed or null
|
/// Returns the terminator instruction if the block is well formed or null
|
||||||
/// if the block is not well formed.
|
/// if the block is not well formed.
|
||||||
const Instruction *getTerminator() const LLVM_READONLY;
|
const Instruction *getTerminator() const LLVM_READONLY {
|
||||||
|
if (InstList.empty() || !InstList.back().isTerminator())
|
||||||
|
return nullptr;
|
||||||
|
return &InstList.back();
|
||||||
|
}
|
||||||
Instruction *getTerminator() {
|
Instruction *getTerminator() {
|
||||||
return const_cast<Instruction *>(
|
return const_cast<Instruction *>(
|
||||||
static_cast<const BasicBlock *>(this)->getTerminator());
|
static_cast<const BasicBlock *>(this)->getTerminator());
|
||||||
|
|
|
@ -148,12 +148,6 @@ const Module *BasicBlock::getModule() const {
|
||||||
return getParent()->getParent();
|
return getParent()->getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Instruction *BasicBlock::getTerminator() const {
|
|
||||||
if (InstList.empty() || !InstList.back().isTerminator())
|
|
||||||
return nullptr;
|
|
||||||
return &InstList.back();
|
|
||||||
}
|
|
||||||
|
|
||||||
const CallInst *BasicBlock::getTerminatingMustTailCall() const {
|
const CallInst *BasicBlock::getTerminatingMustTailCall() const {
|
||||||
if (InstList.empty())
|
if (InstList.empty())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
Loading…
Reference in New Issue