[llvm] [NVPTX] Lower LLVM masked vector loads and stores to PTX (PR #159387)
    Drew Kersnar via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Oct 21 12:29:45 PDT 2025
    
    
  
================
@@ -186,12 +186,16 @@ class ARMTTIImpl final : public BasicTTIImplBase<ARMTTIImpl> {
 
   bool isProfitableLSRChainElement(Instruction *I) const override;
 
-  bool isLegalMaskedLoad(Type *DataTy, Align Alignment,
-                         unsigned AddressSpace) const override;
-
-  bool isLegalMaskedStore(Type *DataTy, Align Alignment,
-                          unsigned AddressSpace) const override {
-    return isLegalMaskedLoad(DataTy, Alignment, AddressSpace);
+  bool
+  isLegalMaskedLoad(Type *DataTy, Align Alignment, unsigned AddressSpace,
+                    TTI::MaskKind MaskKind =
+                        TTI::MaskKind::VariableOrConstantMask) const override;
+
+  bool
+  isLegalMaskedStore(Type *DataTy, Align Alignment, unsigned AddressSpace,
+                     TTI::MaskKind MaskKind =
+                         TTI::MaskKind::VariableOrConstantMask) const override {
+    return isLegalMaskedLoad(DataTy, Alignment, AddressSpace, MaskKind);
   }
----------------
dakersnar wrote:
Does this seem like the correct solution?
My goal was to minimize the churn from this change by having the generic TTI API have a default value for MaskKind, so callers that are not relevant to NVPTX do not need to change. However, some of these overrides, particularly for ARM and x86, are called _directly_ by other ARM and x86 TTI functions. Thus, I either have to:
1. Change those calls to include a MaskKind
2. Add the default value to the _override_ definition, not just the generic definition in TargetTransformInfo.h.
Right now I've done 2. Would 1 be better?
https://github.com/llvm/llvm-project/pull/159387
    
    
More information about the llvm-commits
mailing list