[llvm] d132b47 - [RISCV] Replace llvm_unreachable with report_fatal_error.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 15 08:40:56 PST 2022


Author: Craig Topper
Date: 2022-02-15T08:40:37-08:00
New Revision: d132b47bb9c2f3028c4d2897b4e920579b055103

URL: https://github.com/llvm/llvm-project/commit/d132b47bb9c2f3028c4d2897b4e920579b055103
DIFF: https://github.com/llvm/llvm-project/commit/d132b47bb9c2f3028c4d2897b4e920579b055103.diff

LOG: [RISCV] Replace llvm_unreachable with report_fatal_error.

Parsing errors aren't handled earlier in all cases. A simple
example is llc -mtriple=riscv64 -mattr=+zve32f. If F or Finx is
not also specified, this will hit a parse error.

Use a fatal_error so that the error is conveyed to the user.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
index aa95331251c95..78a9e5838aa44 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
@@ -48,9 +48,7 @@ void RISCVTargetStreamer::emitTargetAttributes(const MCSubtargetInfo &STI) {
   auto ParseResult = RISCVFeatures::parseFeatureBits(
       STI.hasFeature(RISCV::Feature64Bit), STI.getFeatureBits());
   if (!ParseResult) {
-    /* Assume any error about features should handled earlier.  */
-    consumeError(ParseResult.takeError());
-    llvm_unreachable("Parsing feature error when emitTargetAttributes?");
+    report_fatal_error(ParseResult.takeError());
   } else {
     auto &ISAInfo = *ParseResult;
     emitTextAttribute(RISCVAttrs::ARCH, ISAInfo->toString());


        


More information about the llvm-commits mailing list