[llvm] [VPlan] Endow DerivedIV with IRFlags (PR #205908)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 22 03:10:09 PDT 2026


artagnon wrote:

> It seems that the no-wrap flags for Add cannot be directly applied to Mul, and vice versa. Likewise, the no-wrap flags in InductionDescriptor cannot be directly applied when expanding VPDerivedIVRecipe.
> Perhaps we should store the Add and Mul flags separately inside VPDerivedIVRecipe, and let its constructor properly infer the correct flags?

Yes, in the general case, add and mul need not necessarily have the same wrap flags. At the moment, I'm not sure if there's enough benefit in separating them at the cost of getting something like a confusing "DERIVED-IV nuw nuw" printed. What would, however, give us immediate benefits is GEPFlags sketched in https://github.com/llvm/llvm-project/pull/209611. I don't think we should infer the flags in the constructor, as it would unnecessarily pollute the constructor with an optional IndDesc API: however, what I do think we should do is to extend vputils::getFlagsFromIndDesc with a RecipeTy template parameter, and use that -- I'm planning that in a rebase of https://github.com/llvm/llvm-project/pull/209611.

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


More information about the llvm-commits mailing list