[llvm] [TableGen] SubtargetEmitter must use std::nullopt (PR #69475)

Kai Nacke via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 18 08:24:52 PDT 2023


https://github.com/redstar created https://github.com/llvm/llvm-project/pull/69475

Use of llvm::Optional was migrated to std::optional. This included a change in the constructor of ArrayRef.
However, there are still 2 places in the SubtargetEmitter which uses llvm::None, causing a compile error when emitted.

>From 29b6f84a0f38bf6c31302408716f47541baaa12f Mon Sep 17 00:00:00 2001
From: Kai Nacke <kai.peter.nacke at ibm.com>
Date: Wed, 18 Oct 2023 15:18:04 +0000
Subject: [PATCH] [TableGen] SubtargetEmitter must use std::nullopt

Use of llvm::Optional was migrated to std::optional. This included
a change in the constructor of ArrayRef.
However, there are still 2 places in the SubtargetEmitter which
uses llvm::None, causing a compile error when emitted.
---
 llvm/utils/TableGen/SubtargetEmitter.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/utils/TableGen/SubtargetEmitter.cpp b/llvm/utils/TableGen/SubtargetEmitter.cpp
index 5e822078b947123..f7a7172d61fc618 100644
--- a/llvm/utils/TableGen/SubtargetEmitter.cpp
+++ b/llvm/utils/TableGen/SubtargetEmitter.cpp
@@ -1935,7 +1935,7 @@ void SubtargetEmitter::run(raw_ostream &OS) {
   if (NumProcs)
     OS << Target << "SubTypeKV, ";
   else
-    OS << "None, ";
+    OS << "std::nullopt, ";
   OS << '\n'; OS.indent(22);
   OS << Target << "WriteProcResTable, "
      << Target << "WriteLatencyTable, "
@@ -2028,7 +2028,7 @@ void SubtargetEmitter::run(raw_ostream &OS) {
   if (NumProcs)
     OS << "ArrayRef(" << Target << "SubTypeKV, " << NumProcs << "), ";
   else
-    OS << "None, ";
+    OS << "std::nullopt, ";
   OS << '\n'; OS.indent(24);
   OS << Target << "WriteProcResTable, "
      << Target << "WriteLatencyTable, "



More information about the llvm-commits mailing list