[TableGen] Simplify some code. NFC
authorCraig Topper <craig.topper@sifive.com>
Sat, 1 Apr 2023 06:35:43 +0000 (23:35 -0700)
committerCraig Topper <craig.topper@sifive.com>
Sat, 1 Apr 2023 06:35:48 +0000 (23:35 -0700)
This code was creating 1 entry or 0 entry std::array to pass to
to ArrayRef arguments. ArrayRef has a constructor from a single
object and we can use std::nullopt for an empty ArrayRef.

llvm/utils/TableGen/DAGISelMatcherGen.cpp

index ab75181..9992535 100644 (file)
@@ -695,12 +695,11 @@ void MatcherGen::EmitResultLeafAsOperand(const TreePatternNode *N,
     }
 
     if (Def->getName() == "undef_tied_input") {
-      std::array<MVT::SimpleValueType, 1> ResultVTs = {{ N->getSimpleType(0) }};
-      std::array<unsigned, 0> InstOps;
+      MVT::SimpleValueType ResultVT = N->getSimpleType(0);
       auto IDOperandNo = NextRecordedOperandNo++;
       AddMatcher(new EmitNodeMatcher("TargetOpcode::IMPLICIT_DEF",
-                                     ResultVTs, InstOps, false, false, false,
-                                     false, -1, IDOperandNo));
+                                     ResultVT, std::nullopt, false, false,
+                                     false, false, -1, IDOperandNo));
       ResultOps.push_back(IDOperandNo);
       return;
     }