[llvm] r292754 - [IR] Add LLVM_READONLY to BasicBlock::getTerminator.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 21 22:53:07 PST 2017


Author: ctopper
Date: Sun Jan 22 00:53:07 2017
New Revision: 292754

URL: http://llvm.org/viewvc/llvm-project?rev=292754&view=rev
Log:
[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.

Modified:
    llvm/trunk/include/llvm/IR/BasicBlock.h

Modified: llvm/trunk/include/llvm/IR/BasicBlock.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/BasicBlock.h?rev=292754&r1=292753&r2=292754&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/BasicBlock.h (original)
+++ llvm/trunk/include/llvm/IR/BasicBlock.h Sun Jan 22 00:53:07 2017
@@ -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<BasicBlock *>(this)->getTerminator();
   }




More information about the llvm-commits mailing list