Browse Source

Remove llvm.donothing for dxil <= 1.5 instead of using validator version (#2634)

Tex Riddell 5 years ago
parent
commit
f38f449ea7
1 changed files with 6 additions and 3 deletions
  1. 6 3
      lib/HLSL/DxilPreparePasses.cpp

+ 6 - 3
lib/HLSL/DxilPreparePasses.cpp

@@ -331,7 +331,7 @@ public:
 
 
   const char *getPassName() const override { return "HLSL DXIL Finalize Module"; }
   const char *getPassName() const override { return "HLSL DXIL Finalize Module"; }
 
 
-  void patchValidation_1_6(Module &M) {
+  void patchDxil_1_5(Module &M) {
     Function *DoNothingF = nullptr;
     Function *DoNothingF = nullptr;
     for (Function &F : M) {
     for (Function &F : M) {
       if (F.isIntrinsic() && F.getIntrinsicID() == Intrinsic::donothing) {
       if (F.isIntrinsic() && F.getIntrinsicID() == Intrinsic::donothing) {
@@ -385,6 +385,9 @@ public:
       unsigned ValMajor = 0;
       unsigned ValMajor = 0;
       unsigned ValMinor = 0;
       unsigned ValMinor = 0;
       M.GetDxilModule().GetValidatorVersion(ValMajor, ValMinor);
       M.GetDxilModule().GetValidatorVersion(ValMajor, ValMinor);
+      unsigned DxilMajor = 0;
+      unsigned DxilMinor = 0;
+      M.GetDxilModule().GetDxilVersion(DxilMajor, DxilMinor);
 
 
       bool IsLib = DM.GetShaderModel()->IsLib();
       bool IsLib = DM.GetShaderModel()->IsLib();
       // Skip validation patch for lib.
       // Skip validation patch for lib.
@@ -399,8 +402,8 @@ public:
           MarkUsedSignatureElements(DM.GetPatchConstantFunction(), DM);
           MarkUsedSignatureElements(DM.GetPatchConstantFunction(), DM);
       }
       }
 
 
-      if (ValMajor == 1 && ValMinor <= 6) {
-        patchValidation_1_6(M);
+      if (DxilMajor == 1 && DxilMinor <= 5) {
+        patchDxil_1_5(M);
       }
       }
 
 
       // Remove store undef output.
       // Remove store undef output.