]> granicus.if.org Git - llvm/commitdiff
[IR] Add LLVM_READONLY to BasicBlock::getTerminator.
authorCraig Topper <craig.topper@gmail.com>
Sun, 22 Jan 2017 06:53:07 +0000 (06:53 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sun, 22 Jan 2017 06:53:07 +0000 (06:53 +0000)
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

include/llvm/IR/BasicBlock.h

index ae40e710e1e161eb5fae09ad9b97e49a3afbd42e..41dc9a0ae18d023ce98afc5d22f6d4d7345edadd 100644 (file)
@@ -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();
   }