mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Avoid a call to getOrCreateSymbol when we already have the symbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238890 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9c8ebbf969
commit
2bff0d30f8
@ -128,6 +128,7 @@ GetSymbolFromOperand(const MachineOperand &MO) const {
|
||||
const DataLayout *DL = TM.getDataLayout();
|
||||
assert((MO.isGlobal() || MO.isSymbol() || MO.isMBB()) && "Isn't a symbol reference");
|
||||
|
||||
MCSymbol *Sym = nullptr;
|
||||
SmallString<128> Name;
|
||||
StringRef Suffix;
|
||||
|
||||
@ -160,12 +161,14 @@ GetSymbolFromOperand(const MachineOperand &MO) const {
|
||||
else
|
||||
getMang()->getNameWithPrefix(Name, MO.getSymbolName());
|
||||
} else if (MO.isMBB()) {
|
||||
Name += MO.getMBB()->getSymbol()->getName();
|
||||
assert(Suffix.empty());
|
||||
Sym = MO.getMBB()->getSymbol();
|
||||
}
|
||||
unsigned OrigLen = Name.size() - PrefixLen;
|
||||
|
||||
Name += Suffix;
|
||||
MCSymbol *Sym = Ctx.getOrCreateSymbol(Name);
|
||||
if (!Sym)
|
||||
Sym = Ctx.getOrCreateSymbol(Name);
|
||||
|
||||
StringRef OrigName = StringRef(Name).substr(PrefixLen, OrigLen);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user