microsoft / DirectXShaderCompiler

This repo hosts the source for the DirectX Shader Compiler which is based on LLVM/Clang.
Other
3.1k stars 691 forks source link

dxcompiler.dll has duplicate static initializers via DxcOptToggles.h #6896

Open chrdavis opened 2 months ago

chrdavis commented 2 months ago

Static initializers impact performance at load time.

Building latest from github and looking at static initializers shows the same TOGGLE* globals that are getting replicated in multiple compilands from the include/dxc/Support/DxcOptToggles.h header.

D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcassembler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_DEBUG_NOPS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcassembler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_ENABLE_AGGRESSIVE_REASSOCIATION'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcassembler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_GVN'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcassembler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_LICM'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcassembler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_LIFETIME_MARKERS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcassembler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_PARTIAL_LIFETIME_MARKERS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcassembler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_SINK'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcassembler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_STRUCTURIZE_LOOP_EXITS_FOR_UNROLL'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcassembler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_STRUCTURIZE_RETURNS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcompilerobj.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_DEBUG_NOPS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcompilerobj.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_ENABLE_AGGRESSIVE_REASSOCIATION'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcompilerobj.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_GVN'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcompilerobj.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_LICM'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcompilerobj.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_LIFETIME_MARKERS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcompilerobj.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_PARTIAL_LIFETIME_MARKERS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcompilerobj.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_SINK'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcompilerobj.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_STRUCTURIZE_LOOP_EXITS_FOR_UNROLL'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcompilerobj.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_STRUCTURIZE_RETURNS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\DXCompiler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_DEBUG_NOPS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\DXCompiler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_ENABLE_AGGRESSIVE_REASSOCIATION'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\DXCompiler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_GVN'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\DXCompiler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_LICM'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\DXCompiler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_LIFETIME_MARKERS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\DXCompiler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_PARTIAL_LIFETIME_MARKERS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\DXCompiler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_SINK'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\DXCompiler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_STRUCTURIZE_LOOP_EXITS_FOR_UNROLL'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\DXCompiler.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_STRUCTURIZE_RETURNS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcfilesystem.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_DEBUG_NOPS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcfilesystem.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_ENABLE_AGGRESSIVE_REASSOCIATION'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcfilesystem.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_GVN'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcfilesystem.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_LICM'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcfilesystem.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_LIFETIME_MARKERS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcfilesystem.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_PARTIAL_LIFETIME_MARKERS'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcfilesystem.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_SINK'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcfilesystem.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_STRUCTURIZE_LOOP_EXITS_FOR_UNROLL'' D:\DirectXShaderCompiler\VS\tools\clang\tools\dxcompiler\dxcompiler.dir\Release\dxcfilesystem.obj: [size = 40] hlsl::options::dynamic initializer for 'TOGGLE_STRUCTURIZE_RETURNS''

Truncating output due to size limit

damyanp commented 2 months ago

While this is true, I'm going to mark this as dormant since the team is focused on adding hlsl support to clang. We'd welcome PRs that address this issue.