[PATCH] D82478: [MIR] Fix CFI_INSTRUCTION escape printing
Scott Linder via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 24 09:45:55 PDT 2020
scott.linder created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
The printer seems to intend to not print the trailing comma but has a
copy-paste error for the last value in the escape, and the parser
enforces having no trailing comma, but somehow a test was never included
to actually confirm it.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D82478
Files:
llvm/lib/CodeGen/MachineOperand.cpp
llvm/test/CodeGen/MIR/AArch64/cfi.mir
llvm/test/CodeGen/MIR/Generic/cfi-escape.mir
Index: llvm/test/CodeGen/MIR/Generic/cfi-escape.mir
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/MIR/Generic/cfi-escape.mir
@@ -0,0 +1,20 @@
+# RUN: llc -x=mir -run-pass none -o %t < %s
+# RUN: llc -x=mir -run-pass none -o - < %t | FileCheck %s
+
+# Check that we don't print a trailing comma for CFI escape indices, and that
+# in general we can round trip them.
+
+--- |
+
+ define void @func() {
+ ret void
+ }
+
+...
+---
+name: func
+# CHECK-LABEL: name: func
+body: |
+ bb.0:
+ CFI_INSTRUCTION escape 0x61, 0x62, 0x63
+ ; CHECK: CFI_INSTRUCTION escape 0x61, 0x62, 0x63{{$}}
Index: llvm/test/CodeGen/MIR/AArch64/cfi.mir
===================================================================
--- llvm/test/CodeGen/MIR/AArch64/cfi.mir
+++ llvm/test/CodeGen/MIR/AArch64/cfi.mir
@@ -44,7 +44,7 @@
CFI_INSTRUCTION restore_state
; CHECK: CFI_INSTRUCTION restore_state
CFI_INSTRUCTION escape 0x61, 0x62, 0x63
- ; CHECK: CFI_INSTRUCTION escape 0x61, 0x62, 0x63
+ ; CHECK: CFI_INSTRUCTION escape 0x61, 0x62, 0x63{{$}}
CFI_INSTRUCTION window_save
; CHECK: CFI_INSTRUCTION window_save
CFI_INSTRUCTION negate_ra_sign_state
Index: llvm/lib/CodeGen/MachineOperand.cpp
===================================================================
--- llvm/lib/CodeGen/MachineOperand.cpp
+++ llvm/lib/CodeGen/MachineOperand.cpp
@@ -677,7 +677,7 @@
size_t e = CFI.getValues().size() - 1;
for (size_t i = 0; i < e; ++i)
OS << format("0x%02x", uint8_t(CFI.getValues()[i])) << ", ";
- OS << format("0x%02x", uint8_t(CFI.getValues()[e])) << ", ";
+ OS << format("0x%02x", uint8_t(CFI.getValues()[e]));
}
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82478.273078.patch
Type: text/x-patch
Size: 1737 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200624/51a028b4/attachment.bin>
More information about the llvm-commits
mailing list