Răsfoiți Sursa

Fix test failures on retail builds due to IR differences

Tex Riddell 7 ani în urmă
părinte
comite
6fe3881a31

+ 6 - 6
tools/clang/test/CodeGenHLSL/quick-test/cbuffer_half_vect_idx.hlsl

@@ -1,11 +1,11 @@
 // RUN: %dxc -E main -T ps_6_2 -enable-16bit-types %s | FileCheck %s
 // RUN: %dxc -E main -T ps_6_2 -enable-16bit-types %s | FileCheck %s
 
 
-// CHECK: call %dx.types.CBufRet.f16.8 @dx.op.cbufferLoadLegacy.f16(i32 59, %dx.types.Handle %constants_cbuffer, i32 0)  ; CBufferLoadLegacy(handle,regIndex)
-// CHECK: extractvalue %dx.types.CBufRet.f16.8 %0, 0
-// CHECK: extractvalue %dx.types.CBufRet.f16.8 %0, 1
-// CHECK: call %dx.types.CBufRet.f16.8 @dx.op.cbufferLoadLegacy.f16(i32 59, %dx.types.Handle %constants_cbuffer, i32 1)  ; CBufferLoadLegacy(handle,regIndex)
-// CHECK: extractvalue %dx.types.CBufRet.f16.8 %3, 6
-// CHECK: extractvalue %dx.types.CBufRet.f16.8 %3, 7
+// CHECK: call %dx.types.CBufRet.f16.8 @dx.op.cbufferLoadLegacy.f16(i32 59, %dx.types.Handle %constants_cbuffer, i32 0)
+// CHECK: extractvalue %dx.types.CBufRet.f16.8 %{{[^,]+}}, 0
+// CHECK: extractvalue %dx.types.CBufRet.f16.8 %{{[^,]+}}, 1
+// CHECK: call %dx.types.CBufRet.f16.8 @dx.op.cbufferLoadLegacy.f16(i32 59, %dx.types.Handle %constants_cbuffer, i32 1)
+// CHECK: extractvalue %dx.types.CBufRet.f16.8 %{{[^,]+}}, 6
+// CHECK: extractvalue %dx.types.CBufRet.f16.8 %{{[^,]+}}, 7
 
 
 cbuffer constants : register(b0)
 cbuffer constants : register(b0)
 {
 {

+ 1 - 1
tools/clang/test/CodeGenHLSL/quick-test/lib_mat_entry.hlsl

@@ -10,7 +10,7 @@
 // CHECK: @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %A, i32 7)
 // CHECK: @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %A, i32 7)
 
 
 
 
-// CHECK: [[BCI:%.*]] = bitcast [24 x float]* %1 to [2 x %class.matrix.float.4.3]*
+// CHECK: [[BCI:%.*]] = bitcast [24 x float]* {{.*}} to [2 x %class.matrix.float.4.3]*
 // CHECK: call float @"\01?mat_array_test@@YAMV?$vector@M$03@@0Y01V?$matrix@M$03$02@@@Z"(<4 x float> {{.*}}, <4 x float> {{.*}}, [2 x %class.matrix.float.4.3]* [[BCI]]
 // CHECK: call float @"\01?mat_array_test@@YAMV?$vector@M$03@@0Y01V?$matrix@M$03$02@@@Z"(<4 x float> {{.*}}, <4 x float> {{.*}}, [2 x %class.matrix.float.4.3]* [[BCI]]
 
 
 float mat_array_test(in float4 inGBuffer0,
 float mat_array_test(in float4 inGBuffer0,

+ 1 - 1
tools/clang/test/CodeGenHLSL/quick-test/lib_mat_entry2.hlsl

@@ -1,6 +1,6 @@
 // RUN: %dxc -T lib_6_3  %s | FileCheck %s
 // RUN: %dxc -T lib_6_3  %s | FileCheck %s
 
 
-// CHECK: [[BCI:%.*]] = bitcast <12 x float>* %1 to %class.matrix.float.4.3*
+// CHECK: [[BCI:%.*]] = bitcast <12 x float>* {{.*}} to %class.matrix.float.4.3*
 // CHECK:call <3 x float> @"\01?mat_test@@YA?AV?$vector@M$02@@V?$vector@M$03@@0AIAV?$matrix@M$03$02@@@Z"(<4 x float> {{.*}}, <4 x float> {{.*}}, %class.matrix.float.4.3* {{.*}}[[BCI]])
 // CHECK:call <3 x float> @"\01?mat_test@@YA?AV?$vector@M$02@@V?$vector@M$03@@0AIAV?$matrix@M$03$02@@@Z"(<4 x float> {{.*}}, <4 x float> {{.*}}, %class.matrix.float.4.3* {{.*}}[[BCI]])
 
 
 float3 mat_test(in float4 in0,
 float3 mat_test(in float4 in0,

+ 2 - 2
tools/clang/test/CodeGenHLSL/quick-test/lib_res_param_x.hlsl

@@ -4,8 +4,8 @@
 // CHECK: alloca %struct.T
 // CHECK: alloca %struct.T
 // CHECK: store %struct.RWByteAddressBuffer
 // CHECK: store %struct.RWByteAddressBuffer
 // CHECK: call void @"\01?resStruct@@YA?AUT2@@UT@@V?$vector@I$01@@@Z"(%struct.T2
 // CHECK: call void @"\01?resStruct@@YA?AUT2@@UT@@V?$vector@I$01@@@Z"(%struct.T2
-// CHECK: %[[ptr:[^, ]]] = getelementptr inbounds %struct.T2
-// CHECK: %[[val:[^, ]]] = load %"class.RWStructuredBuffer<D>", %"class.RWStructuredBuffer<D>"* %[[ptr]]
+// CHECK: %[[ptr:[^, ]+]] = getelementptr inbounds %struct.T2
+// CHECK: %[[val:[^, ]+]] = load %"class.RWStructuredBuffer<D>", %"class.RWStructuredBuffer<D>"* %[[ptr]]
 // CHECK: call %dx.types.Handle @"dx.op.createHandleForLib.class.RWStructuredBuffer<D>"(i32 160, %"class.RWStructuredBuffer<D>" %[[val]])
 // CHECK: call %dx.types.Handle @"dx.op.createHandleForLib.class.RWStructuredBuffer<D>"(i32 160, %"class.RWStructuredBuffer<D>" %[[val]])
 
 
 
 

+ 1 - 1
tools/clang/test/CodeGenHLSL/quick-test/no-phi-on-res.hlsl

@@ -2,7 +2,7 @@
 
 
 // Verify no phi on resource, handle, or anything
 // Verify no phi on resource, handle, or anything
 
 
-// CHECK: entry:
+// CHECK: define void @"\01?main@@YAXXZ"()
 // CHECK-NOT: phi
 // CHECK-NOT: phi
 // CHECK: ret void
 // CHECK: ret void
 
 

+ 1 - 1
tools/clang/test/CodeGenHLSL/quick-test/res_select3.hlsl

@@ -1,7 +1,7 @@
 // RUN: %dxc -T lib_6_3 -auto-binding-space 11 -default-linkage external %s | FileCheck %s
 // RUN: %dxc -T lib_6_3 -auto-binding-space 11 -default-linkage external %s | FileCheck %s
 
 
 // Make sure no phi/select of handle in lib.
 // Make sure no phi/select of handle in lib.
-// CHECK: entry:
+// CHECK: define i32 @"\01?test@@YAIHHH@Z"(i32 %i, i32 %j, i32 %m)
 // CHECK-NOT: phi %"class.
 // CHECK-NOT: phi %"class.
 // CHECK-NOT: phi %dx.types.Handle
 // CHECK-NOT: phi %dx.types.Handle
 // CHECK-NOT: select i1 %{{[^,]+}}, %"class.
 // CHECK-NOT: select i1 %{{[^,]+}}, %"class.

+ 1 - 1
tools/clang/test/CodeGenHLSL/quick-test/res_select3_x.hlsl

@@ -3,7 +3,7 @@
 // lib_6_x allows phi/select of resource in lib.
 // lib_6_x allows phi/select of resource in lib.
 // phi/select of handle should not be produced in this case, but would be allowed if it were.
 // phi/select of handle should not be produced in this case, but would be allowed if it were.
 
 
-// CHECK: entry:
+// CHECK: define i32 @"\01?test@@YAIHHH@Z"(i32 %i, i32 %j, i32 %m)
 // CHECK-NOT: phi %dx.types.Handle
 // CHECK-NOT: phi %dx.types.Handle
 // CHECK-NOT: select i1 %{{[^,]+}}, %dx.types.Handle
 // CHECK-NOT: select i1 %{{[^,]+}}, %dx.types.Handle
 // CHECK: phi %"class.
 // CHECK: phi %"class.

+ 1 - 1
tools/clang/test/CodeGenHLSL/quick-test/res_select4_x.hlsl

@@ -3,7 +3,7 @@
 // lib_6_x allows phi/select of resource in lib.
 // lib_6_x allows phi/select of resource in lib.
 // phi/select of handle should not be produced in this case, but would be allowed if it were.
 // phi/select of handle should not be produced in this case, but would be allowed if it were.
 
 
-// CHECK: entry:
+// CHECK: define i32 @"\01?test@@YAIHHH@Z"(i32 %i, i32 %j, i32 %m)
 // CHECK-NOT: phi %dx.types.Handle
 // CHECK-NOT: phi %dx.types.Handle
 // CHECK-NOT: select i1 %{{[^,]+}}, %dx.types.Handle
 // CHECK-NOT: select i1 %{{[^,]+}}, %dx.types.Handle
 // CHECK: phi %"class.
 // CHECK: phi %"class.

+ 1 - 1
tools/clang/test/CodeGenHLSL/quick-test/res_select5_x.hlsl

@@ -3,7 +3,7 @@
 // lib_6_x allows phi/select of resource in lib.
 // lib_6_x allows phi/select of resource in lib.
 // phi/select of handle should not be produced in this case, but would be allowed if it were.
 // phi/select of handle should not be produced in this case, but would be allowed if it were.
 
 
-// CHECK: entry:
+// CHECK: define <4 x float> @"\01?test@@YA?AV?$vector@M$03@@HHH@Z"(i32 %i, i32 %j, i32 %m)
 // CHECK-NOT: phi %dx.types.Handle
 // CHECK-NOT: phi %dx.types.Handle
 // CHECK-NOT: select i1 %{{[^,]+}}, %dx.types.Handle
 // CHECK-NOT: select i1 %{{[^,]+}}, %dx.types.Handle
 // CHECK: phi %"class.
 // CHECK: phi %"class.

+ 5 - 4
tools/clang/unittests/HLSL/LinkerTest.cpp

@@ -106,7 +106,8 @@ public:
   void Link(LPCWSTR pEntryName, LPCWSTR pShaderModel, IDxcLinker *pLinker,
   void Link(LPCWSTR pEntryName, LPCWSTR pShaderModel, IDxcLinker *pLinker,
             ArrayRef<LPCWSTR> libNames, llvm::ArrayRef<LPCSTR> pCheckMsgs,
             ArrayRef<LPCWSTR> libNames, llvm::ArrayRef<LPCSTR> pCheckMsgs,
             llvm::ArrayRef<LPCSTR> pCheckNotMsgs,
             llvm::ArrayRef<LPCSTR> pCheckNotMsgs,
-            llvm::ArrayRef<LPCWSTR> pArguments = {}) {
+            llvm::ArrayRef<LPCWSTR> pArguments = {},
+            bool bRegEx = false) {
     CComPtr<IDxcOperationResult> pResult;
     CComPtr<IDxcOperationResult> pResult;
     VERIFY_SUCCEEDED(pLinker->Link(pEntryName, pShaderModel, libNames.data(),
     VERIFY_SUCCEEDED(pLinker->Link(pEntryName, pShaderModel, libNames.data(),
                                    libNames.size(),
                                    libNames.size(),
@@ -122,8 +123,8 @@ public:
         m_dllSupport.CreateInstance(CLSID_DxcCompiler, &pCompiler));
         m_dllSupport.CreateInstance(CLSID_DxcCompiler, &pCompiler));
     VERIFY_SUCCEEDED(pCompiler->Disassemble(pProgram, &pDisassembly));
     VERIFY_SUCCEEDED(pCompiler->Disassemble(pProgram, &pDisassembly));
     std::string IR = BlobToUtf8(pDisassembly);
     std::string IR = BlobToUtf8(pDisassembly);
-    CheckMsgs(IR.c_str(), IR.size(), pCheckMsgs.data(), pCheckMsgs.size(), false);
-    CheckNotMsgs(IR.c_str(), IR.size(), pCheckNotMsgs.data(), pCheckNotMsgs.size(), false);
+    CheckMsgs(IR.c_str(), IR.size(), pCheckMsgs.data(), pCheckMsgs.size(), bRegEx);
+    CheckNotMsgs(IR.c_str(), IR.size(), pCheckNotMsgs.data(), pCheckNotMsgs.size(), bRegEx);
   }
   }
 
 
   void LinkCheckMsg(LPCWSTR pEntryName, LPCWSTR pShaderModel, IDxcLinker *pLinker,
   void LinkCheckMsg(LPCWSTR pEntryName, LPCWSTR pShaderModel, IDxcLinker *pLinker,
@@ -356,7 +357,7 @@ TEST_F(LinkerTest, RunLinkMatParamToLib) {
   Link(L"", L"lib_6_3", pLinker, {libName},
   Link(L"", L"lib_6_3", pLinker, {libName},
        // The bitcast cannot be removed because user function call use it as
        // The bitcast cannot be removed because user function call use it as
        // argument.
        // argument.
-       {"bitcast <12 x float>* %1 to %class.matrix.float.4.3*"}, {});
+       {"bitcast \\<12 x float\\>\\* \\%\\d+ to \\%class\\.matrix\\.float\\.4\\.3\\*"}, {}, {}, true);
 }
 }
 
 
 TEST_F(LinkerTest, RunLinkResRet) {
 TEST_F(LinkerTest, RunLinkResRet) {