summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEli Bendersky <eliben@google.com>2013-04-22 21:21:08 +0000
committerEli Bendersky <eliben@google.com>2013-04-22 21:21:08 +0000
commit2ad047e04dd4c19defade4799834efacb0024551 (patch)
tree02e957d41ae6dede9b3b5de0db47288eed949c77 /include
parent0af5493701f9982d7451c8b3c1b7699cc84ac94c (diff)
downloadllvm-2ad047e04dd4c19defade4799834efacb0024551.tar.gz
llvm-2ad047e04dd4c19defade4799834efacb0024551.tar.bz2
llvm-2ad047e04dd4c19defade4799834efacb0024551.tar.xz
Optimize MachineBasicBlock::getSymbol by caching the symbol. Since the symbol
name computation is expensive, this helps save about 25% of the time spent in this function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@180049 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CodeGen/MachineBasicBlock.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h
index 492a3ff49f..0f2f8746b3 100644
--- a/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/include/llvm/CodeGen/MachineBasicBlock.h
@@ -71,7 +71,6 @@ class MachineBasicBlock : public ilist_node<MachineBasicBlock> {
std::vector<MachineBasicBlock *> Predecessors;
std::vector<MachineBasicBlock *> Successors;
-
/// Weights - Keep track of the weights to the successors. This vector
/// has the same order as Successors, or it is empty if we don't use it
/// (disable optimization).
@@ -96,6 +95,10 @@ class MachineBasicBlock : public ilist_node<MachineBasicBlock> {
/// target of an indirect branch.
bool AddressTaken;
+ /// \brief since getSymbol is a relatively heavy-weight operation, the symbol
+ /// is only computed once and is cached.
+ mutable MCSymbol *CachedMCSymbol;
+
// Intrusive list support
MachineBasicBlock() {}