[llvm] [hlsl][spirv] Add late pass in spirv backend to remove dead resources (PR #225270)
Helena Kotas via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 5 12:47:16 PDT 2026
hekota wrote:
> @bogner @hekota, does that match where you want resource legalization to go?
I think there are 2 parts of this:
1. Removal of unused resources: for DXIL this happens in the `DXILRemoveUnusedResources` pass. It removes any calls to `dx_resource_handlefrom{implicit}binding` whose return value is either not used at all, or it is saved to a global variable that does not have external linkage and is not used anywhere else in the module. In the latter case the global variable is removed as well (https://github.com/llvm/llvm-project/pull/200965).
2. Removal of resource global variables after moving the handles to SSA values. This happens during DXIL lowering:(https://github.com/llvm/llvm-project/blob/afca127bbb62fa30e3734ea149618c2b92bffb6b/llvm/lib/Target/DirectX/DXILOpLowering.cpp#L252)
In both cases the globals are found through the `dx_resource_handlefrom{implicit}binding` calls, so it only applies to resources.
https://github.com/llvm/llvm-project/pull/225270
More information about the llvm-commits
mailing list