Skip to content

Commit 7604147

Browse files
authored
[OPT] Add removed unused interface var pass to legalization passes (KhronosGroup#5579)
DXC does not do a good job of recognizing which variables need to be on the entry point for which functions. This is because it does not want to have to walk the call tree to determine which instructions are reachable from which entry points. This is also useful if the same input variable gets used from two different shader, but the uses in one get optimized away. Will parially fix microsoft/DirectXShaderCompiler#4621. Will not fix code compiled with -fcgl.
1 parent f9184c6 commit 7604147

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

source/opt/optimizer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ Optimizer& Optimizer::RegisterLegalizationPasses(bool preserve_interface) {
167167
.RegisterPass(CreateDeadInsertElimPass())
168168
.RegisterPass(CreateReduceLoadSizePass())
169169
.RegisterPass(CreateAggressiveDCEPass(preserve_interface))
170+
.RegisterPass(CreateRemoveUnusedInterfaceVariablesPass())
170171
.RegisterPass(CreateInterpolateFixupPass())
171172
.RegisterPass(CreateInvocationInterlockPlacementPass());
172173
}

0 commit comments

Comments
 (0)