From 3b9d6216a41cfd43759e787db26d797e1f0ba0a8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 14 Mar 2010 17:53:23 +0000 Subject: fix AsmPrinter::GetBlockAddressSymbol to always return a unique label instead of trying to form one based on the BB name (which causes collisions if the name is empty). This fixes PR6608 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98495 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/MachineModuleInfo.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/CodeGen/MachineModuleInfo.cpp') diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp index fdbda8f715..a23cc1a877 100644 --- a/lib/CodeGen/MachineModuleInfo.cpp +++ b/lib/CodeGen/MachineModuleInfo.cpp @@ -104,6 +104,18 @@ void MachineModuleInfo::AnalyzeModule(Module &M) { UsedFunctions.insert(F); } +/// getAddrLabelSymbol - Return the symbol to be used for the specified basic +/// block when its address is taken. This cannot be its normal LBB label +/// because the block may be accessed outside its containing function. +MCSymbol *MachineModuleInfo::getAddrLabelSymbol(const BasicBlock *BB) { + assert(BB->hasAddressTaken() && + "Shouldn't get label for block without address taken"); + MCSymbol *&Entry = AddrLabelSymbols[const_cast(BB)]; + if (Entry) return Entry; + return Entry = Context.CreateTempSymbol(); +} + + //===-EH-------------------------------------------------------------------===// /// getOrCreateLandingPadInfo - Find or create an LandingPadInfo for the -- cgit v1.2.3