diff options
author | Alexis Engelke <engelke@in.tum.de> | 2024-06-20 13:18:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 13:18:41 +0200 |
commit | 6859685a87ad093d60c8bed60b116143c0a684c7 (patch) | |
tree | 9885c0c6c1764803c1b5b7a596f7e522cbd6d85a /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | b18bf8faaef952323c96e4c6b82f25623073fb1c (diff) | |
download | llvm-6859685a87ad093d60c8bed60b116143c0a684c7.zip llvm-6859685a87ad093d60c8bed60b116143c0a684c7.tar.gz llvm-6859685a87ad093d60c8bed60b116143c0a684c7.tar.bz2 |
[CodeGen] Use temp symbol for MBBs (#95031)
Internal label names never occur in the symbol table, so when using an
object streamer, there's no point in constructing these names and then
adding them to hash tables -- they are never visible in the output.
It's not possible to reuse createTempSymbol, because on BPF has a
different prefix for globals and basic blocks right now.
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 16505f2..abf43e3 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -80,10 +80,11 @@ MCSymbol *MachineBasicBlock::getSymbol() const { } CachedMCSymbol = Ctx.getOrCreateSymbol(MF->getName() + Suffix); } else { - const StringRef Prefix = Ctx.getAsmInfo()->getPrivateLabelPrefix(); - CachedMCSymbol = Ctx.getOrCreateSymbol(Twine(Prefix) + "BB" + - Twine(MF->getFunctionNumber()) + - "_" + Twine(getNumber())); + // If the block occurs as label in inline assembly, parsing the assembly + // needs an actual label name => set AlwaysEmit in these cases. + CachedMCSymbol = Ctx.createBlockSymbol( + "BB" + Twine(MF->getFunctionNumber()) + "_" + Twine(getNumber()), + /*AlwaysEmit=*/hasLabelMustBeEmitted()); } } return CachedMCSymbol; @@ -104,10 +105,9 @@ MCSymbol *MachineBasicBlock::getEndSymbol() const { if (!CachedEndMCSymbol) { const MachineFunction *MF = getParent(); MCContext &Ctx = MF->getContext(); - auto Prefix = Ctx.getAsmInfo()->getPrivateLabelPrefix(); - CachedEndMCSymbol = Ctx.getOrCreateSymbol(Twine(Prefix) + "BB_END" + - Twine(MF->getFunctionNumber()) + - "_" + Twine(getNumber())); + CachedEndMCSymbol = Ctx.createBlockSymbol( + "BB_END" + Twine(MF->getFunctionNumber()) + "_" + Twine(getNumber()), + /*AlwaysEmit=*/false); } return CachedEndMCSymbol; } |