[PATCH] D157194: [VPlan] Model wrap flags directly, remove *NUW opcodes (NFC)

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 6 11:11:27 PDT 2023


Ayal added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8788
 
     // Create the active lane mask for the next iteration of the loop.
+    CanonicalIVIncrementParts = VPInstruction::createOverflowingBinOp(
----------------
nit (independent of this patch): comment above needs fixing.


================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.cpp:764-765
                       return true;
                     auto *VPI = cast<VPInstruction>(U);
                     return VPI->getOpcode() ==
+                           VPInstruction::CanonicalIVIncrement;
----------------
nit: can fold into a single

```
  return isa<VPScalarIVStepsRecipe>(U) || isa<VPDerivedIVRecipe>(U)) 
             || cast<VPInstruction>(U)->getCode() == VPInstruction::CanonicalIVIncrement;
```


================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.cpp:768
                   }) &&
            "the canonical IV should only be used by its increments or "
            "ScalarIVSteps when resetting the start value");
----------------



================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:855
+  /// Set NoUnsignedWrap and NoSignedWrap flags.
+  void setWrapFlags(bool HasNUW, bool HasNSW);
+
----------------
Could the wrap flags be set instead by a (designated) constructor?


================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:1027
 
+  static VPInstruction *createOverflowingBinOp(unsigned Opcode,
+                                               ArrayRef<VPValue *> Operands,
----------------
Have a designated constructor that takes wrap flags as parameters and sets them?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157194/new/

https://reviews.llvm.org/D157194



More information about the llvm-commits mailing list