[llvm] r266984 - [AMDGPU] Assembler: prevent parseDPPCtrlOps from eating invalid tokens
Sam Kolton via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 21 06:14:24 PDT 2016
Author: skolton
Date: Thu Apr 21 08:14:24 2016
New Revision: 266984
URL: http://llvm.org/viewvc/llvm-project?rev=266984&view=rev
Log:
[AMDGPU] Assembler: prevent parseDPPCtrlOps from eating invalid tokens
Reviewers: nhaustov, tstellarAMD
Subscribers: arsenm
Differential Revision: http://reviews.llvm.org/D19317
Modified:
llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp?rev=266984&r1=266983&r2=266984&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp Thu Apr 21 08:14:24 2016
@@ -2027,7 +2027,6 @@ bool AMDGPUOperand::isDPPCtrl() const {
AMDGPUAsmParser::OperandMatchResultTy
AMDGPUAsmParser::parseDPPCtrlOps(OperandVector &Operands) {
- // ToDo: use same syntax as sp3 for dpp_ctrl
SMLoc S = Parser.getTok().getLoc();
StringRef Prefix;
int64_t Int;
@@ -2043,6 +2042,19 @@ AMDGPUAsmParser::parseDPPCtrlOps(Operand
} else if (Prefix == "row_half_mirror") {
Int = 0x141;
} else {
+ // Check to prevent parseDPPCtrlOps from eating invalid tokens
+ if (Prefix != "quad_perm"
+ && Prefix != "row_shl"
+ && Prefix != "row_shr"
+ && Prefix != "row_ror"
+ && Prefix != "wave_shl"
+ && Prefix != "wave_rol"
+ && Prefix != "wave_shr"
+ && Prefix != "wave_ror"
+ && Prefix != "row_bcast") {
+ return MatchOperand_NoMatch;
+ }
+
Parser.Lex();
if (getLexer().isNot(AsmToken::Colon))
return MatchOperand_ParseFail;
@@ -2114,7 +2126,7 @@ AMDGPUAsmParser::parseDPPCtrlOps(Operand
Int = 0x143;
}
} else {
- return MatchOperand_NoMatch;
+ return MatchOperand_ParseFail;
}
}
}
More information about the llvm-commits
mailing list