[llvm] [VPlan] Impl VPlan-based pattern match for ExtendedRed and MulAccRed (PR #113903)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 23 07:14:39 PDT 2025
================
@@ -706,6 +710,12 @@ class VPRecipeWithIRFlags : public VPSingleDefRecipe {
: VPSingleDefRecipe(SC, Operands, DL), OpType(OperationType::DisjointOp),
DisjointFlags(DisjointFlags) {}
+ template <typename IterT>
+ VPRecipeWithIRFlags(const unsigned char SC, IterT Operands,
+ NonNegFlagsTy NonNegFlags, DebugLoc DL = {})
----------------
sdesmalen-arm wrote:
nit:
I'm wondering if it makes sense to make `NonNegFlags` a `std::optional<NonNegFlagsTy>`, and initialise it with `{}` by default (here and in the other classes), so that you don't need to do:
```
if (Something->isZExt())
... = new VPWidenCastRecipe(..., Something->isNonNeg());
else
... = new VPWidenCastRecipe(...);
```
and instead just do:
```
std::optional<NonNegFlagsTy> NonNegFlags = Something->isZExt() ? Something->isNonNeg() : {};
... = new VPWidenCastRecipe(..., NonNegFlags);
```
What do you think?
https://github.com/llvm/llvm-project/pull/113903
More information about the llvm-commits
mailing list