From 31ca6abe848bf94c5cd39d0cbb9d497d74a7141c Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 22 Sep 2025 12:13:57 -0700 Subject: [PATCH] [SDPatternMatcher] Remove std::optional around SDNodeFlags in BinaryOpc_match. NFC 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. --- llvm/include/llvm/CodeGen/SDPatternMatch.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/llvm/include/llvm/CodeGen/SDPatternMatch.h b/llvm/include/llvm/CodeGen/SDPatternMatch.h index 21dec19e3cb9d..201dc68de8b76 100644 --- a/llvm/include/llvm/CodeGen/SDPatternMatch.h +++ b/llvm/include/llvm/CodeGen/SDPatternMatch.h @@ -597,9 +597,9 @@ struct BinaryOpc_match { unsigned Opcode; LHS_P LHS; RHS_P RHS; - std::optional Flags; + SDNodeFlags Flags; BinaryOpc_match(unsigned Opc, const LHS_P &L, const RHS_P &R, - std::optional Flgs = std::nullopt) + SDNodeFlags Flgs = SDNodeFlags()) : Opcode(Opc), LHS(L), RHS(R), Flags(Flgs) {} template @@ -613,10 +613,7 @@ struct BinaryOpc_match { RHS.match(Ctx, N->getOperand(EO.FirstIndex))))) return false; - if (!Flags.has_value()) - return true; - - return (*Flags & N->getFlags()) == *Flags; + return (Flags & N->getFlags()) == Flags; } return false;