Skip to content

Commit 4f2a00d

Browse files
authored
[SDPatternMatcher] Remove std::optional around SDNodeFlags in BinaryOpc_match. NFC (#160178)
Using all 0 flags as the default works correctly. We'll get (0 & N->getFlags()) == 0 which is always true which is what we want.
1 parent 207d399 commit 4f2a00d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

llvm/include/llvm/CodeGen/SDPatternMatch.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,9 @@ struct BinaryOpc_match {
597597
unsigned Opcode;
598598
LHS_P LHS;
599599
RHS_P RHS;
600-
std::optional<SDNodeFlags> Flags;
600+
SDNodeFlags Flags;
601601
BinaryOpc_match(unsigned Opc, const LHS_P &L, const RHS_P &R,
602-
std::optional<SDNodeFlags> Flgs = std::nullopt)
602+
SDNodeFlags Flgs = SDNodeFlags())
603603
: Opcode(Opc), LHS(L), RHS(R), Flags(Flgs) {}
604604

605605
template <typename MatchContext>
@@ -613,10 +613,7 @@ struct BinaryOpc_match {
613613
RHS.match(Ctx, N->getOperand(EO.FirstIndex)))))
614614
return false;
615615

616-
if (!Flags.has_value())
617-
return true;
618-
619-
return (*Flags & N->getFlags()) == *Flags;
616+
return (Flags & N->getFlags()) == Flags;
620617
}
621618

622619
return false;

0 commit comments

Comments
 (0)