Skip to content

Commit 8680300

Browse files
committed
[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
1 parent b9a30b6 commit 8680300

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

llvm/lib/CodeGen/MIRParser/MIParser.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ bool MIParser::parse(MachineInstr *&MI) {
11001100
if (!IsImplicitOp) {
11011101
if (!MCID.isVariadic() && NumExplicitOps >= MCID.getNumOperands() &&
11021102
!Operand.Operand.isValidExcessOperand())
1103-
return error("too many operands for instruction");
1103+
return error(Operand.Begin, "too many operands for instruction");
11041104

11051105
++NumExplicitOps;
11061106
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
# RUN: not llc -march=amdgcn -run-pass=none -o /dev/null %s 2>&1 | FileCheck %s
1+
# RUN: not llc -march=amdgcn -run-pass=none -o /dev/null %s 2>&1 | \
2+
# RUN: FileCheck --strict-whitespace %s
23

34
---
45
name: extra_imm_operand
56
body: |
67
bb.0:
7-
; CHECK: [[@LINE+3]]:18: too many operands for instruction
8-
; CHECK-NEXT: S_ENDPGM 0, 0
9-
; CHECK_NEXT: ^
8+
; CHECK: [[@LINE+3]]:17: too many operands for instruction
9+
; CHECK-NEXT: {{^}} S_ENDPGM 0, 0
10+
; CHECK-NEXT: {{^}} ^
1011
S_ENDPGM 0, 0
1112
1213
...
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
# RUN: not llc -march=amdgcn -run-pass=none -o /dev/null %s 2>&1 | FileCheck %s
1+
# RUN: not llc -march=amdgcn -run-pass=none -o /dev/null %s 2>&1 | \
2+
# RUN: FileCheck --strict-whitespace %s
23

34
---
45
name: extra_reg_operand
56
body: |
67
bb.0:
7-
; CHECK: [[@LINE+3]]:29: too many operands for instruction
8-
; S_ENDPGM 0, undef $vgpr0
9-
; CHECK_NEXT: ^
8+
; CHECK: [[@LINE+3]]:17: too many operands for instruction
9+
; CHECK-NEXT: {{^}} S_ENDPGM 0, undef $vgpr0
10+
; CHECK-NEXT: {{^}} ^
1011
S_ENDPGM 0, undef $vgpr0
1112
1213
...

0 commit comments

Comments
 (0)