[llvm] [DirectX] remove string function attribute DXIL not allowed (PR #90778)

Chris B via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 07:13:22 PDT 2024


================
@@ -110,9 +140,20 @@ class DXILPrepareModule : public ModulePass {
       if (!isValidForDXIL(I))
         AttrMask.addAttribute(I);
     }
+
+    
+    dxil::ValidatorVersionMD ValVerMD(M);
+    VersionTuple ValVer = ValVerMD.getAsVersionTuple();
+    bool SkipValidation = ValVer.getMajor() == 0 && ValVer.getMinor() == 0;
+
     for (auto &F : M.functions()) {
       F.removeFnAttrs(AttrMask);
       F.removeRetAttrs(AttrMask);
+      // Only remove string attributes if we are not skipping validation.
+      // This will reserve the experimental attributes when validation version
+      // is 0.0 for experiment mode.
+      if (!SkipValidation)
----------------
llvm-beanz wrote:

In that case it seems like we should always strip disallowed attributes (regardless of validation) and just allow experimental attributes when validation is disabled.

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


More information about the llvm-commits mailing list