You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make DxilRemoveDeadBlocks init DxilModule, fix test (microsoft#5919)
DxilRemoveDeadBlocks assumed it could run with an uninitialized
DxilModule, because the test case had been captured from live state
without the needed DXIL metadata. DxilRemoveDeadBlocks relies on
DxilValueCache, which relies on code in DxilSimplify, which assumes we
have a DxilModule if there are dxil ops. Without an initialized
DxilModule with the correct low-precision mode, cached ops and types may
be wrong.
This change:
- modifies DxilRemoveDeadBlocks to remove bSkipInit
- updates the test to contain the metadata needed to initialize
DxilModule
!14 = !{!"clang version 3.7 (tags/RELEASE_370/final)"}
106
-
!15 = !{!"F:\5Cdxc\5Ctools\5Cclang\5Ctest\5CHLSLFileCheck\5Cpasses\5Cdxil\5Cdxil_remove_dead_pass\5Cdelete_constant_dce.hlsl", !"// RUN: %dxc %s -T ps_6_0 -Od | FileCheck %s\0D\0A\0D\0A// This test verifies the fix for a deficiency in RemoveDeadBlocks where:\0D\0A//\0D\0A// - Value 'ret' that can be reduced to constant by DxilValueCache is removed\0D\0A// - It held on uses for a PHI 'val', but 'val' was not removed\0D\0A// - 'val' is not used, but also not DCE'ed until after DeleteDeadRegion is run\0D\0A// - DeleteDeadRegion cannot delete 'if (foo)' because 'val' still exists.\0D\0A\0D\0A// CHECK: @main\0D\0A// CHECK-NOT: phi\0D\0A\0D\0Acbuffer cb : register(b0) {\0D\0A float foo;\0D\0A}\0D\0A\0D\0A[RootSignature(\22\22)]\0D\0Afloat main() : SV_Target {\0D\0A float val = 0;\0D\0A if (foo)\0D\0A val = 1;\0D\0A\0D\0A float zero = 0;\0D\0A float ret = val * zero;\0D\0A\0D\0A return ret;\0D\0A}\0D\0A"}
!15 = !{!"delete_constant_dce.hlsl", !"// RUN: %dxc %s -T ps_6_0 -Od | FileCheck %s\0D\0A\0D\0A// This test verifies the fix for a deficiency in RemoveDeadBlocks where:\0D\0A//\0D\0A// - Value 'ret' that can be reduced to constant by DxilValueCache is removed\0D\0A// - It held on uses for a PHI 'val', but 'val' was not removed\0D\0A// - 'val' is not used, but also not DCE'ed until after DeleteDeadRegion is run\0D\0A// - DeleteDeadRegion cannot delete 'if (foo)' because 'val' still exists.\0D\0A\0D\0A// CHECK: @main\0D\0A// CHECK-NOT: phi\0D\0A\0D\0Acbuffer cb : register(b0) {\0D\0A float foo;\0D\0A}\0D\0A\0D\0A[RootSignature(\22\22)]\0D\0Afloat main() : SV_Target {\0D\0A float val = 0;\0D\0A if (foo)\0D\0A val = 1;\0D\0A\0D\0A float zero = 0;\0D\0A float ret = val * zero;\0D\0A\0D\0A return ret;\0D\0A}\0D\0A"}
0 commit comments