[llvm] [LV] Add test showing lack of gather/scatter can prevent if-convert (PR #195042)

Gaƫtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 02:06:14 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(
+    "force-target-supports-gather-scatter-ops", cl::init(false), cl::Hidden,
+    cl::desc("Assume the target supports gather/scatter operations (used for "
+             "testing)."));
+
+bool VFSelectionContext::isLegalMaskedLoadOrStore(
+    Instruction *I, ElementCount VF, unsigned InterleaveFactor) const {
----------------
gbossu wrote:

I added a `InterleaveFactor` parameter so that `isLegalMaskedLoadOrStore` can be used as the central place to query the legality of masked accesses, whether interleaved or not.

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


More information about the llvm-commits mailing list