From: Craig Topper Date: Sun, 22 Jan 2017 06:53:07 +0000 (+0000) Subject: [IR] Add LLVM_READONLY to BasicBlock::getTerminator. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=112dbbc59bb15be2409c9a65b9de0f5624312406;p=llvm [IR] Add LLVM_READONLY to BasicBlock::getTerminator. I noticed that this function got called twice in compiled code to create succ_begin and succ_end iterators. Adding this directive helps the compiler share the call. Ideally we'd just make this method available for inlining since its quite simple, but the current header file arrangements don't allow that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292754 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/IR/BasicBlock.h b/include/llvm/IR/BasicBlock.h index ae40e710e1e..41dc9a0ae18 100644 --- a/include/llvm/IR/BasicBlock.h +++ b/include/llvm/IR/BasicBlock.h @@ -111,7 +111,7 @@ public: /// \brief Returns the terminator instruction if the block is well formed or /// null if the block is not well formed. - TerminatorInst *getTerminator(); + TerminatorInst *getTerminator() LLVM_READONLY; const TerminatorInst *getTerminator() const { return const_cast(this)->getTerminator(); }