diff options
Diffstat (limited to 'lib/CodeGen/MachineBasicBlock.cpp')
| -rw-r--r-- | lib/CodeGen/MachineBasicBlock.cpp | 18 | 
1 files changed, 11 insertions, 7 deletions
| diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp index 898e165feeab..78e9950e5ef5 100644 --- a/lib/CodeGen/MachineBasicBlock.cpp +++ b/lib/CodeGen/MachineBasicBlock.cpp @@ -37,7 +37,7 @@ using namespace llvm;  MachineBasicBlock::MachineBasicBlock(MachineFunction &mf, const BasicBlock *bb)    : BB(bb), Number(-1), xParent(&mf), Alignment(0), IsLandingPad(false), -    AddressTaken(false) { +    AddressTaken(false), CachedMCSymbol(NULL) {    Insts.Parent = this;  } @@ -48,12 +48,16 @@ MachineBasicBlock::~MachineBasicBlock() {  /// getSymbol - Return the MCSymbol for this basic block.  ///  MCSymbol *MachineBasicBlock::getSymbol() const { -  const MachineFunction *MF = getParent(); -  MCContext &Ctx = MF->getContext(); -  const char *Prefix = Ctx.getAsmInfo().getPrivateGlobalPrefix(); -  return Ctx.GetOrCreateSymbol(Twine(Prefix) + "BB" + -                               Twine(MF->getFunctionNumber()) + "_" + -                               Twine(getNumber())); +  if (!CachedMCSymbol) { +    const MachineFunction *MF = getParent(); +    MCContext &Ctx = MF->getContext(); +    const char *Prefix = Ctx.getAsmInfo().getPrivateGlobalPrefix(); +    CachedMCSymbol = Ctx.GetOrCreateSymbol(Twine(Prefix) + "BB" + +                                           Twine(MF->getFunctionNumber()) + +                                           "_" + Twine(getNumber())); +  } + +  return CachedMCSymbol;  } | 
