[llvm] 4d81aec - [MIR] Fix CFI_INSTRUCTION escape printing
Scott Linder via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 24 15:15:43 PDT 2020
Author: Scott Linder
Date: 2020-06-24T18:15:28-04:00
New Revision: 4d81aec40c62a0599a4bfbd7b45df78b302dbc3c
URL: https://github.com/llvm/llvm-project/commit/4d81aec40c62a0599a4bfbd7b45df78b302dbc3c
DIFF: https://github.com/llvm/llvm-project/commit/4d81aec40c62a0599a4bfbd7b45df78b302dbc3c.diff
LOG: [MIR] Fix CFI_INSTRUCTION escape printing
Summary:
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.
Reviewers: thegameg, arsenm
Reviewed By: thegameg, arsenm
Subscribers: wdng, arsenm, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D82478
Added:
llvm/test/CodeGen/MIR/Generic/cfi-escape.mir
Modified:
llvm/lib/CodeGen/MachineOperand.cpp
llvm/test/CodeGen/MIR/AArch64/cfi.mir
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MachineOperand.cpp b/llvm/lib/CodeGen/MachineOperand.cpp
index 912b30679e6f..2b4fd654e46c 100644
--- a/llvm/lib/CodeGen/MachineOperand.cpp
+++ b/llvm/lib/CodeGen/MachineOperand.cpp
@@ -670,7 +670,7 @@ static void printCFI(raw_ostream &OS, const MCCFIInstruction &CFI,
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;
}
diff --git a/llvm/test/CodeGen/MIR/AArch64/cfi.mir b/llvm/test/CodeGen/MIR/AArch64/cfi.mir
index 04380e07f3ee..5768bcafe479 100644
--- a/llvm/test/CodeGen/MIR/AArch64/cfi.mir
+++ b/llvm/test/CodeGen/MIR/AArch64/cfi.mir
@@ -42,7 +42,7 @@ body: |
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
diff --git a/llvm/test/CodeGen/MIR/Generic/cfi-escape.mir b/llvm/test/CodeGen/MIR/Generic/cfi-escape.mir
new file mode 100644
index 000000000000..61a814eb1694
--- /dev/null
+++ b/llvm/test/CodeGen/MIR/Generic/cfi-escape.mir
@@ -0,0 +1,11 @@
+# RUN: llc -run-pass none -o - %s | llc -x=mir -run-pass none -o - | FileCheck %s
+
+# Check that we don't print a trailing comma for CFI escape indices, and that
+# in general we can round trip them.
+
+name: func
+# CHECK-LABEL: name: func
+body: |
+ bb.0:
+ CFI_INSTRUCTION escape 0x61, 0x62, 0x63
+ ; CHECK: CFI_INSTRUCTION escape 0x61, 0x62, 0x63{{$}}
More information about the llvm-commits
mailing list