[flang-commits] [flang] [llvm] [VPlan] Expand WidenInt inductions with nuw/nsw (PR #163538)

Luke Lau via flang-commits flang-commits at lists.llvm.org
Fri Oct 24 01:06:51 PDT 2025


================
@@ -122,6 +122,22 @@ std::optional<VPValue *>
 getRecipesForUncountableExit(VPlan &Plan,
                              SmallVectorImpl<VPRecipeBase *> &Recipes,
                              SmallVectorImpl<VPRecipeBase *> &GEPs);
+
+/// Extracts and returns nowrap flags from the induction binop in \p ID. \p
+/// DropNWFlags tells us whether whether we should drop NoWrap flags, which we
+/// should when tail-folding, for example.
+inline VPIRFlags getNoWrapFlagsFromIndDesc(const InductionDescriptor &ID,
+                                           bool DropNWFlags) {
+  if (ID.getKind() == InductionDescriptor::IK_FpInduction)
+    return ID.getInductionBinOp()->getFastMathFlags();
----------------
lukel97 wrote:

It looks like this also propagates fast math flags for widened FP inductions? Do we have tests for this?

Also do we need to drop the flags here for tail folded loops?

https://github.com/llvm/llvm-project/pull/163538


More information about the flang-commits mailing list