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

Gaƫtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 04:14:26 PDT 2026


================
@@ -59,20 +59,25 @@ static cl::opt<bool> ForceTargetSupportsMaskedMemoryOps(
     cl::desc("Assume the target supports masked memory operations (used for "
              "testing)."));
 
-bool VFSelectionContext::isLegalMaskedStore(Type *DataType, Value *Ptr,
-                                            Align Alignment,
-                                            unsigned AddressSpace) const {
-  return Legal->isConsecutivePtr(DataType, Ptr) &&
-         (ForceTargetSupportsMaskedMemoryOps ||
-          TTI.isLegalMaskedStore(DataType, Alignment, AddressSpace));
-}
+static cl::opt<bool> ForceTargetSupportsGatherScatterOps(
----------------
gbossu wrote:

If I bring the new `ForceTargetSupportsGatherScatterOps` option, it needs to work when we query the availability of masked ld/st both for the interleaved and non-interleaved case. Otherwise, it's not all that useful and would not work for the test case I want to add.

As I mentioned in https://github.com/llvm/llvm-project/pull/194579#discussion_r3167349594, I think the better approach is to take "access pattern" legality checks out of `isLegalMaskedLoadOrStore`. This way, the interleaved case can keep relying on the fact that an interleave group was found, and the standard widening case can call `isConsecutivePtr()`. What do you think?

The reason I didn't do that was to maintain the semantics of the old `isLegalMasked(Load|Store)`, but this really complicates refactoring.

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


More information about the llvm-commits mailing list