[llvm] 8680300 - [MIR] Provide location of extra instruction operand when diagnosing it.
Ivan Kosarev via llvm-commits
llvm-commits at lists.llvm.org
Thu May 19 22:11:11 PDT 2022
Author: Ivan Kosarev
Date: 2022-05-20T05:56:25+01:00
New Revision: 86803008eabb8be14867ce2d41ef22e659a1a70c
URL: https://github.com/llvm/llvm-project/commit/86803008eabb8be14867ce2d41ef22e659a1a70c
DIFF: https://github.com/llvm/llvm-project/commit/86803008eabb8be14867ce2d41ef22e659a1a70c.diff
LOG: [MIR] Provide location of extra instruction operand when diagnosing it.
Also resolves misspelled FileCheck directives caught with D125604.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D125965
Added:
Modified:
llvm/lib/CodeGen/MIRParser/MIParser.cpp
llvm/test/CodeGen/MIR/AMDGPU/extra-imm-operand.mir
llvm/test/CodeGen/MIR/AMDGPU/extra-reg-operand.mir
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/MIRParser/MIParser.cpp b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
index 52ba26098600a..aed64d08dd92b 100644
--- a/llvm/lib/CodeGen/MIRParser/MIParser.cpp
+++ b/llvm/lib/CodeGen/MIRParser/MIParser.cpp
@@ -1100,7 +1100,7 @@ bool MIParser::parse(MachineInstr *&MI) {
if (!IsImplicitOp) {
if (!MCID.isVariadic() && NumExplicitOps >= MCID.getNumOperands() &&
!Operand.Operand.isValidExcessOperand())
- return error("too many operands for instruction");
+ return error(Operand.Begin, "too many operands for instruction");
++NumExplicitOps;
}
diff --git a/llvm/test/CodeGen/MIR/AMDGPU/extra-imm-operand.mir b/llvm/test/CodeGen/MIR/AMDGPU/extra-imm-operand.mir
index db484f0798fcf..65cb32cdd9aeb 100644
--- a/llvm/test/CodeGen/MIR/AMDGPU/extra-imm-operand.mir
+++ b/llvm/test/CodeGen/MIR/AMDGPU/extra-imm-operand.mir
@@ -1,12 +1,13 @@
-# RUN: not llc -march=amdgcn -run-pass=none -o /dev/null %s 2>&1 | FileCheck %s
+# RUN: not llc -march=amdgcn -run-pass=none -o /dev/null %s 2>&1 | \
+# RUN: FileCheck --strict-whitespace %s
---
name: extra_imm_operand
body: |
bb.0:
- ; CHECK: [[@LINE+3]]:18: too many operands for instruction
- ; CHECK-NEXT: S_ENDPGM 0, 0
- ; CHECK_NEXT: ^
+ ; CHECK: [[@LINE+3]]:17: too many operands for instruction
+ ; CHECK-NEXT: {{^}} S_ENDPGM 0, 0
+ ; CHECK-NEXT: {{^}} ^
S_ENDPGM 0, 0
...
diff --git a/llvm/test/CodeGen/MIR/AMDGPU/extra-reg-operand.mir b/llvm/test/CodeGen/MIR/AMDGPU/extra-reg-operand.mir
index 03a6777167fa6..d6b2522542a82 100644
--- a/llvm/test/CodeGen/MIR/AMDGPU/extra-reg-operand.mir
+++ b/llvm/test/CodeGen/MIR/AMDGPU/extra-reg-operand.mir
@@ -1,12 +1,13 @@
-# RUN: not llc -march=amdgcn -run-pass=none -o /dev/null %s 2>&1 | FileCheck %s
+# RUN: not llc -march=amdgcn -run-pass=none -o /dev/null %s 2>&1 | \
+# RUN: FileCheck --strict-whitespace %s
---
name: extra_reg_operand
body: |
bb.0:
- ; CHECK: [[@LINE+3]]:29: too many operands for instruction
- ; S_ENDPGM 0, undef $vgpr0
- ; CHECK_NEXT: ^
+ ; CHECK: [[@LINE+3]]:17: too many operands for instruction
+ ; CHECK-NEXT: {{^}} S_ENDPGM 0, undef $vgpr0
+ ; CHECK-NEXT: {{^}} ^
S_ENDPGM 0, undef $vgpr0
...
More information about the llvm-commits
mailing list