瀏覽代碼

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

Tex Riddell 5 年之前
父節點
當前提交
f38f449ea7
共有 1 個文件被更改,包括 6 次插入3 次删除
  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"; }
 
-  void patchValidation_1_6(Module &M) {
+  void patchDxil_1_5(Module &M) {
     Function *DoNothingF = nullptr;
     for (Function &F : M) {
       if (F.isIntrinsic() && F.getIntrinsicID() == Intrinsic::donothing) {
@@ -385,6 +385,9 @@ public:
       unsigned ValMajor = 0;
       unsigned ValMinor = 0;
       M.GetDxilModule().GetValidatorVersion(ValMajor, ValMinor);
+      unsigned DxilMajor = 0;
+      unsigned DxilMinor = 0;
+      M.GetDxilModule().GetDxilVersion(DxilMajor, DxilMinor);
 
       bool IsLib = DM.GetShaderModel()->IsLib();
       // Skip validation patch for lib.
@@ -399,8 +402,8 @@ public:
           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.