aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp13
-rw-r--r--test/CodeGen/ARM/indirectbr.ll6
-rw-r--r--test/CodeGen/PowerPC/indirectbr.ll8
3 files changed, 14 insertions, 13 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 64f49c4..eb73237 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -1677,14 +1677,15 @@ MCSymbol *AsmPrinter::GetBlockAddressSymbol(const Function *F,
// This code must use the function name itself, and not the function number,
// since it must be possible to generate the label name from within other
// functions.
- std::string FuncName = Mang->getMangledName(F);
+ SmallString<60> FnName;
+ Mang->getNameWithPrefix(FnName, F, false);
+ // FIXME: THIS IS BROKEN IF THE LLVM BASIC BLOCK DOESN'T HAVE A NAME!
SmallString<60> NameResult;
- raw_svector_ostream(NameResult) << MAI->getPrivateGlobalPrefix() << "BA"
- << FuncName.size() << '_' << FuncName << '_';
- Mang->getNameWithPrefix(NameResult, BB->getName());
- if (Suffix[0])
- NameResult += Suffix;
+ Mang->getNameWithPrefix(NameResult,
+ StringRef("BA") + Twine((unsigned)FnName.size()) +
+ "_" + FnName.str() + "_" + BB->getName() + Suffix,
+ Mangler::Private);
return OutContext.GetOrCreateSymbol(NameResult.str());
}
diff --git a/test/CodeGen/ARM/indirectbr.ll b/test/CodeGen/ARM/indirectbr.ll
index 8b56f13..cd16084 100644
--- a/test/CodeGen/ARM/indirectbr.ll
+++ b/test/CodeGen/ARM/indirectbr.ll
@@ -55,6 +55,6 @@ L1: ; preds = %L2, %bb2
store i8* blockaddress(@foo, %L5), i8** @nextaddr, align 4
ret i32 %res.3
}
-; ARM: .long LBA4__foo__L5-(LPC{{.*}}+8)
-; THUMB: .long LBA4__foo__L5-(LPC{{.*}}+4)
-; THUMB2: .long LBA4__foo__L5
+; ARM: .long L_BA4__foo_L5-(LPC{{.*}}+8)
+; THUMB: .long L_BA4__foo_L5-(LPC{{.*}}+4)
+; THUMB2: .long L_BA4__foo_L5
diff --git a/test/CodeGen/PowerPC/indirectbr.ll b/test/CodeGen/PowerPC/indirectbr.ll
index 1b302e4..fbc7bd2 100644
--- a/test/CodeGen/PowerPC/indirectbr.ll
+++ b/test/CodeGen/PowerPC/indirectbr.ll
@@ -43,12 +43,12 @@ L2: ; preds = %L3, %bb2
L1: ; preds = %L2, %bb2
%res.3 = phi i32 [ %phitmp, %L2 ], [ 2, %bb2 ] ; <i32> [#uses=1]
-; PIC: addis r4, r2, ha16(LBA4__foo__L5-"L1$pb")
-; PIC: li r5, lo16(LBA4__foo__L5-"L1$pb")
+; PIC: addis r4, r2, ha16(L_BA4__foo_L5-"L1$pb")
+; PIC: li r5, lo16(L_BA4__foo_L5-"L1$pb")
; PIC: add r4, r4, r5
; PIC: stw r4
-; STATIC: li r2, lo16(LBA4__foo__L5)
-; STATIC: addis r2, r2, ha16(LBA4__foo__L5)
+; STATIC: li r2, lo16(L_BA4__foo_L5)
+; STATIC: addis r2, r2, ha16(L_BA4__foo_L5)
; STATIC: stw r2
store i8* blockaddress(@foo, %L5), i8** @nextaddr, align 4
ret i32 %res.3