Skip to content

[Win] Enable function-level linking for Release - #8802

Draft
Alex Sepkowski (alsepkow) wants to merge 1 commit into
microsoft:mainfrom
alsepkow:user/alsepkow/enable-release-function-sections
Draft

[Win] Enable function-level linking for Release#8802
Alex Sepkowski (alsepkow) wants to merge 1 commit into
microsoft:mainfrom
alsepkow:user/alsepkow/enable-release-function-sections

Conversation

@alsepkow

Copy link
Copy Markdown
Contributor

Enable function-level dead-code elimination for Windows Release builds.

  • Add /Gy to the C and C++ Release flags so the existing /OPT:REF linker setting can discard individual unused functions from referenced object files.
  • Resolve the long-standing MSVC dead-strip FIXME in HandleLLVMOptions.cmake.

Testing:

  • Configured an x64 Release build with Visual Studio 18 2026 and SPIR-V/tests disabled.
  • Verified generated Release .vcxproj files contain <FunctionLevelLinking>true</FunctionLevelLinking>.
  • Built the Release llvm-tblgen target successfully.

No release note is needed because this changes build configuration rather than compiler-visible behavior.

Compile C and C++ Release functions into individual COMDATs so the existing /OPT:REF linker setting can discard unused functions from referenced object files. This resolves the long-standing MSVC dead-strip FIXME.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0f4d0e10-e926-4bce-b36b-0abebc08f6dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

1 participant