diff --git a/llvm/lib/CodeGen/MIRPrinter.cpp b/llvm/lib/CodeGen/MIRPrinter.cpp --- a/llvm/lib/CodeGen/MIRPrinter.cpp +++ b/llvm/lib/CodeGen/MIRPrinter.cpp @@ -415,7 +415,7 @@ YamlObject.ID = ID; if (const auto *Alloca = MFI.getObjectAllocation(I)) YamlObject.Name.Value = std::string( - Alloca->hasName() ? Alloca->getName() : ""); + Alloca->hasName() ? Alloca->getName() : ""); YamlObject.Type = MFI.isSpillSlotObjectIndex(I) ? yaml::MachineStackObject::SpillSlot : MFI.isVariableSizedObjectIndex(I) diff --git a/llvm/test/CodeGen/MIR/Generic/unnamed-stack.ll b/llvm/test/CodeGen/MIR/Generic/unnamed-stack.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/MIR/Generic/unnamed-stack.ll @@ -0,0 +1,19 @@ +; RUN: llc -O0 -march aarch64 -global-isel -stop-after=irtranslator -o %t.mir %s && llc -march aarch64 -run-pass=none -o - %t.mir | FileCheck %s + +define i16 @unnamed_stack() { +entry: + ; CHECK-NAME: unnamed_stack + ; CHECK: %0:_(p0) = G_FRAME_INDEX %stack.0 + %0 = alloca i16 + %1 = load i16, i16* %0 + ret i16 %1 +} + +define i16 @named_stack() { +entry: + ; CHECK-NAME: named_stack + ; CHECK: %0:_(p0) = G_FRAME_INDEX %stack.0.ptr + %ptr = alloca i16 + %0 = load i16, i16* %ptr + ret i16 %0 +}