[llvm] [LV] Add tests showing incorrect handling of large vscale ranges (NFC). (PR #219290)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 06:40:29 PDT 2026


https://github.com/fhahn commented:

> Can you explain what the incorrect behaviour is? I interpret this to mean broken but the test implies this is a performance issue? Is it the case you know the code has an overflow bug and this is just the effect?

It adds a test (`wide_vscale_range_needs_tail_folding`) for an overflow when determining whether a reminder loop is needed. It is a low-trip count loop and in that case LV should only try to vectorize if there's no scalar remainder loop. For the test case, we incorrectly determine in the cost model that no remainder is needed (due to the overflow).

The code we generate is correct (i.e. we still keep the branch to check if scalar remainder is needed), but we took an incorrect decision at the cost level 


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


More information about the llvm-commits mailing list