[llvm] [LV] isScalarWithPredication to check for interleaved accesses (PR #194579)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 01:47:12 PDT 2026


https://github.com/fhahn commented:

>Instructions can get marked as isProfitableToScalarize (for fixed VFs) even though they will actually be widened because CM_Interleave takes precedence over isProfitableToScalarize. See tryToWidenMemory. This means we add the wrong cost: precomputeCosts adds the scalarization cost, whereas the widen recipe actually gets executed.

So the cost of the scalar variant is lower, and we mark it as to-be-scalarized, but it does not happen because we do not invalidate the memory widening decision? If that's the case, should we not set the decision to `CM_Scalarize`? I think we already do something similar for calls that are forced scalar.

> Having any instruction return true for isScalarWithPredication means that its parent BB gets added to PredicatedBBsAfterVectorization. The consequence is that this disables if-conversion for scalable VFs: precomputeCosts() thinks the conditional branch is still there, which gives Invalid costs for scalable VFs.

Would it be possible to add such a test?

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


More information about the llvm-commits mailing list