[PATCH] D152273: [RISCV] Don't persist invalid feature state on .option arch error
Jessica Clarke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 6 12:15:42 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rGdb1d72b155c6: [RISCV] Don't persist invalid feature state on .option arch error (authored by jrtc27).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152273/new/
https://reviews.llvm.org/D152273
Files:
llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
llvm/test/MC/RISCV/option-invalid.s
Index: llvm/test/MC/RISCV/option-invalid.s
===================================================================
--- llvm/test/MC/RISCV/option-invalid.s
+++ llvm/test/MC/RISCV/option-invalid.s
@@ -1,5 +1,5 @@
# RUN: not llvm-mc -triple riscv32 < %s 2>&1 \
-# RUN: | FileCheck -check-prefixes=CHECK %s
+# RUN: | FileCheck --implicit-check-not=error: %s
# CHECK: :[[#@LINE+1]]:8: error: expected identifier
.option
@@ -47,6 +47,9 @@
# CHECK: :[[#@LINE+1]]:20: error: 'f' and 'zfinx' extensions are incompatible
.option arch, +f, +zfinx
+## Make sure the above error isn't sticky
+.option arch, +f
+
# CHECK: :[[#@LINE+1]]:13: error: expected newline
.option rvc foo
Index: llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
===================================================================
--- llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -2758,9 +2758,14 @@
Args.emplace_back(Type, Ext->Key);
if (Type == RISCVOptionArchArgType::Plus) {
+ FeatureBitset OldFeatureBits = STI->getFeatureBits();
+
setFeatureBits(Ext->Value, Ext->Key);
auto ParseResult = RISCVFeatures::parseFeatureBits(isRV64(), STI->getFeatureBits());
if (!ParseResult) {
+ copySTI().setFeatureBits(OldFeatureBits);
+ setAvailableFeatures(ComputeAvailableFeatures(OldFeatureBits));
+
std::string Buffer;
raw_string_ostream OutputErrMsg(Buffer);
handleAllErrors(ParseResult.takeError(), [&](llvm::StringError &ErrMsg) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152273.528987.patch
Type: text/x-patch
Size: 1566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230606/936cb046/attachment.bin>
More information about the llvm-commits
mailing list