[llvm] [LV] Add `-force-target-supports-masked-memory-ops` option (PR #184325)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 3 04:36:28 PST 2026


================
@@ -1178,16 +1183,18 @@ class LoopVectorizationCostModel {
   /// for the given \p DataType and kind of access to \p Ptr.
   bool isLegalMaskedStore(Type *DataType, Value *Ptr, Align Alignment,
                           unsigned AddressSpace) const {
-    return Legal->isConsecutivePtr(DataType, Ptr) &&
-           TTI.isLegalMaskedStore(DataType, Alignment, AddressSpace);
+    return ForceTargetSupportsMaskedMemoryOps ||
+           (Legal->isConsecutivePtr(DataType, Ptr) &&
+            TTI.isLegalMaskedStore(DataType, Alignment, AddressSpace));
   }
 
   /// Returns true if the target machine supports masked load operation
   /// for the given \p DataType and kind of access to \p Ptr.
   bool isLegalMaskedLoad(Type *DataType, Value *Ptr, Align Alignment,
                          unsigned AddressSpace) const {
-    return Legal->isConsecutivePtr(DataType, Ptr) &&
-           TTI.isLegalMaskedLoad(DataType, Alignment, AddressSpace);
+    return ForceTargetSupportsMaskedMemoryOps ||
+           (Legal->isConsecutivePtr(DataType, Ptr) &&
+            TTI.isLegalMaskedLoad(DataType, Alignment, AddressSpace));
----------------
david-arm wrote:

See comment above.

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


More information about the llvm-commits mailing list