[llvm] 99b5631 - [AMDGPU][MC] Corrected error position for invalid operands
Dmitry Preobrazhensky via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 1 03:31:36 PST 2021
Author: Dmitry Preobrazhensky
Date: 2021-02-01T14:31:08+03:00
New Revision: 99b5631649e09970769562abb05475b79eb44e3c
URL: https://github.com/llvm/llvm-project/commit/99b5631649e09970769562abb05475b79eb44e3c
DIFF: https://github.com/llvm/llvm-project/commit/99b5631649e09970769562abb05475b79eb44e3c.diff
LOG: [AMDGPU][MC] Corrected error position for invalid operands
Generic parser may report an incorrect error position when an offending operand is followed by a comma.
See bug 48884 for details: https://bugs.llvm.org/show_bug.cgi?id=48884.
Differential Revision: https://reviews.llvm.org/D95674
Added:
Modified:
llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
llvm/test/MC/AMDGPU/gfx10_err_pos.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
index af4a47935e3f..3f3f0863dced 100644
--- a/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
+++ b/llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
@@ -4942,9 +4942,6 @@ bool AMDGPUAsmParser::ParseInstruction(ParseInstructionInfo &Info,
Mode = OperandMode_NSA;
OperandMatchResultTy Res = parseOperand(Operands, Name, Mode);
- // Eat the comma or space if there is one.
- trySkipToken(AsmToken::Comma);
-
if (Res != MatchOperand_Success) {
checkUnsupportedInstruction(Name, NameLoc);
if (!Parser.hasPendingError()) {
@@ -4959,6 +4956,9 @@ bool AMDGPUAsmParser::ParseInstruction(ParseInstructionInfo &Info,
}
return true;
}
+
+ // Eat the comma or space if there is one.
+ trySkipToken(AsmToken::Comma);
}
return false;
diff --git a/llvm/test/MC/AMDGPU/gfx10_err_pos.s b/llvm/test/MC/AMDGPU/gfx10_err_pos.s
index 639fe3d2de92..7f4aba0a05e3 100644
--- a/llvm/test/MC/AMDGPU/gfx10_err_pos.s
+++ b/llvm/test/MC/AMDGPU/gfx10_err_pos.s
@@ -535,6 +535,11 @@ v_ceil_f16 v0, abs(neg(1))
// CHECK-NEXT:{{^}}v_ceil_f16 v0, abs(neg(1))
// CHECK-NEXT:{{^}} ^
+image_atomic_xor v4, v32, s[96:103] dmask:0x1 dim:, glc
+// CHECK: error: failed parsing operand.
+// CHECK-NEXT:{{^}}image_atomic_xor v4, v32, s[96:103] dmask:0x1 dim:, glc
+// CHECK-NEXT:{{^}} ^
+
//==============================================================================
// first register index should not exceed second index
More information about the llvm-commits
mailing list