[PATCH] D92960: [AMDGPU][MC] Restore old error position for "too few operands"

Scott Linder via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 9 12:20:06 PST 2020


scott.linder created this revision.
Herald added subscribers: kerbowa, hiraditya, t-tye, tpr, dstuttard, yaxunl, nhaehnle, jvesely, kzhuravl, arsenm.
scott.linder requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

Revert part of https://reviews.llvm.org/D92084 to make it simpler to
start consuming the EndOfStatement token within AMDGPU's
ParseInstruction in a future patch. This also brings us back to what
every other target currently does.

A future change to move the position back to the end of the statement
would likely need to audit all of the AMDGPUOperand SMLoc ranges, and
determine the SMLoc for the last character of the last operand.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D92960

Files:
  llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
  llvm/test/MC/AMDGPU/exp-err.s
  llvm/test/MC/AMDGPU/gfx10_err_pos.s


Index: llvm/test/MC/AMDGPU/gfx10_err_pos.s
===================================================================
--- llvm/test/MC/AMDGPU/gfx10_err_pos.s
+++ llvm/test/MC/AMDGPU/gfx10_err_pos.s
@@ -992,12 +992,12 @@
 tbuffer_store_format_xyzw v[1:4], off, ttmp[4:7]
 // CHECK: error: too few operands for instruction
 // CHECK-NEXT:{{^}}tbuffer_store_format_xyzw v[1:4], off, ttmp[4:7]
-// CHECK-NEXT:{{^}}                                                ^
+// CHECK-NEXT:{{^}}^
 
 v_add_f32_e64 v0, v1
 // CHECK: error: too few operands for instruction
 // CHECK-NEXT:{{^}}v_add_f32_e64 v0, v1
-// CHECK-NEXT:{{^}}                    ^
+// CHECK-NEXT:{{^}}^
 
 //==============================================================================
 // too large value for expcnt
Index: llvm/test/MC/AMDGPU/exp-err.s
===================================================================
--- llvm/test/MC/AMDGPU/exp-err.s
+++ llvm/test/MC/AMDGPU/exp-err.s
@@ -53,7 +53,7 @@
 // GCN: :5: error: unknown token in expression
 
 exp
-// GCN: :4: error: too few operands for instruction
+// GCN: :1: error: too few operands for instruction
 
 exp mrt0 s0, v0, v0, v0
 // GCN: 10: error: invalid operand for instruction
Index: llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
===================================================================
--- llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -4040,7 +4040,7 @@
     SMLoc ErrorLoc = IDLoc;
     if (ErrorInfo != ~0ULL) {
       if (ErrorInfo >= Operands.size()) {
-        return Error(getLoc(), "too few operands for instruction");
+        return Error(IDLoc, "too few operands for instruction");
       }
       ErrorLoc = ((AMDGPUOperand &)*Operands[ErrorInfo]).getStartLoc();
       if (ErrorLoc == SMLoc())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92960.310608.patch
Type: text/x-patch
Size: 1817 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201209/6bed593a/attachment.bin>


More information about the llvm-commits mailing list