[PATCH] D93685: [MIRPrinter] Fix incorrect output of unnamed stack names

Gabriel Hjort Ã…kerlund via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 23 00:22:47 PST 2020


ehjogab updated this revision to Diff 313497.
ehjogab added a comment.
Herald added subscribers: nemanjai, qcolombet.

Moved testcase to correct location
Split RUN into multiple lines
Added check of frame object list
Fixed failing testcase


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93685/new/

https://reviews.llvm.org/D93685

Files:
  llvm/lib/CodeGen/MIRPrinter.cpp
  llvm/test/CodeGen/MIR/AArch64/unnamed-stack.ll
  llvm/test/CodeGen/PowerPC/alloca-crspill.ll


Index: llvm/test/CodeGen/PowerPC/alloca-crspill.ll
===================================================================
--- llvm/test/CodeGen/PowerPC/alloca-crspill.ll
+++ llvm/test/CodeGen/PowerPC/alloca-crspill.ll
@@ -49,8 +49,8 @@
 ; CHECK64-NEXT:       debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
 
 ; CHECK64-NEXT: stack:
-; CHECK64-NEXT:   - { id: 0, name: '<unnamed alloca>', type: variable-sized, offset: -8,
-; CHECK64-NEXT:       alignment: 1, stack-id: default, callee-saved-register: '', callee-saved-restored: true,
+; CHECK64-NEXT:   - { id: 0, name: '', type: variable-sized, offset: -8, alignment: 1, 
+; CHECK64-NEXT:       stack-id: default, callee-saved-register: '', callee-saved-restored: true,
 ; CHECK64-NEXT:       local-offset: 0, debug-info-variable: '', debug-info-expression: '',
 ; CHECK64-NEXT:       debug-info-location: '' }
 ; CHECK64-NEXT:   - { id: 1, name: '', type: default, offset: -16, size: 8, alignment: 8,
@@ -68,8 +68,8 @@
 ; CHECK32-NEXT:       debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
 
 ; CHECK32-NEXT: stack:
-; CHECK32-NEXT:   - { id: 0, name: '<unnamed alloca>', type: variable-sized, offset: -4,
-; CHECK32-NEXT:       alignment: 1, stack-id: default, callee-saved-register: '', callee-saved-restored: true,
+; CHECK32-NEXT:   - { id: 0, name: '', type: variable-sized, offset: -4, alignment: 1, 
+; CHECK32-NEXT:       stack-id: default, callee-saved-register: '', callee-saved-restored: true,
 ; CHECK32-NEXT:       local-offset: 0, debug-info-variable: '', debug-info-expression: '',
 ; CHECK32-NEXT:       debug-info-location: '' }
 ; CHECK32-NEXT:   - { id: 1, name: '', type: default, offset: -8, size: 4, alignment: 4,
Index: llvm/test/CodeGen/MIR/AArch64/unnamed-stack.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/MIR/AArch64/unnamed-stack.ll
@@ -0,0 +1,24 @@
+; RUN: llc -O0 -march aarch64 -global-isel -stop-after=irtranslator -o %t.mir %s
+; RUN: llc -march aarch64 -run-pass=none -o - %t.mir | FileCheck %s
+
+define i16 @unnamed_stack() {
+entry:
+  ; CHECK-NAME: unnamed_stack
+  ; CHECK:      stack:
+  ; CHECK-NEXT:   - { id: 0, name: '',
+  ; 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:      stack:
+  ; CHECK-NEXT:   - { id: 0, name: ptr,
+  ; CHECK:      %0:_(p0) = G_FRAME_INDEX %stack.0.ptr
+  %ptr = alloca i16
+  %0 = load i16, i16* %ptr
+  ret i16 %0
+}
Index: llvm/lib/CodeGen/MIRPrinter.cpp
===================================================================
--- llvm/lib/CodeGen/MIRPrinter.cpp
+++ 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() : "<unnamed alloca>");
+          Alloca->hasName() ? Alloca->getName() : "");
     YamlObject.Type = MFI.isSpillSlotObjectIndex(I)
                           ? yaml::MachineStackObject::SpillSlot
                           : MFI.isVariableSizedObjectIndex(I)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93685.313497.patch
Type: text/x-patch
Size: 3239 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201223/fdb0c95a/attachment.bin>


More information about the llvm-commits mailing list