From eb278db84d377e2e7bcdd8c69ab4496f38d276ce Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sun, 22 Jan 2017 06:53:07 +0000 Subject: [PATCH] [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. llvm-svn: 292754 --- include/llvm/IR/BasicBlock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(); }