[OPT] Add removed unused interface var pass to legalization passes (#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
https://github.com/microsoft/DirectXShaderCompiler/issues/4621. Will not
fix code compiled with -fcgl.
This commit is contained in:
Steven Perron 2024-02-14 13:08:25 -05:00 committed by GitHub
parent f9184c6501
commit 7604147c25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -167,6 +167,7 @@ Optimizer& Optimizer::RegisterLegalizationPasses(bool preserve_interface) {
.RegisterPass(CreateDeadInsertElimPass())
.RegisterPass(CreateReduceLoadSizePass())
.RegisterPass(CreateAggressiveDCEPass(preserve_interface))
.RegisterPass(CreateRemoveUnusedInterfaceVariablesPass())
.RegisterPass(CreateInterpolateFixupPass())
.RegisterPass(CreateInvocationInterlockPlacementPass());
}