[all-commits] [llvm/llvm-project] 95c248: [clang][SPIR-V] Implement -fspv-preserve-interface...

Diego Novillo via All-commits all-commits at lists.llvm.org
Tue Jun 9 01:40:13 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 95c24830265cba8c4844dda3384025bac0bf96b4
      https://github.com/llvm/llvm-project/commit/95c24830265cba8c4844dda3384025bac0bf96b4
  Author: Diego Novillo <dnovillo at nvidia.com>
  Date:   2026-06-09 (Tue, 09 Jun 2026)

  Changed paths:
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Options/Options.td
    M clang/lib/CodeGen/CGHLSLRuntime.cpp
    M clang/lib/Driver/ToolChains/Clang.cpp
    A clang/test/CodeGenHLSL/preserve-interface-dce.hlsl
    A clang/test/CodeGenHLSL/preserve-interface.hlsl
    A clang/test/Driver/dxc_fspv_preserve_interface.hlsl
    M llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
    A llvm/test/CodeGen/SPIRV/preserve-interface-dce.ll
    A llvm/test/CodeGen/SPIRV/preserve-interface.ll

  Log Message:
  -----------
  [clang][SPIR-V] Implement -fspv-preserve-interface (#196404)

This flag, originally implemented in DXC, prevents GlobalDCE from
removing entry-point interface variables, even if they are unreferenced
after inlining.

This adds `HLSLSpvPreserveInterface` to `LangOptions.def` and
`Options.td`. In `CGHLSLRuntime::finishCodeGen()`, it adds all
`addrspace(7)` and `addrspace(8)` globals to `llvm.compiler.used`.

In `processGlobalValue()`, it extends the condition that emits
`spv_unref_global` to fire for globals whose only uses come from
`llvm.compiler.used` or `llvm.used`.

Fixes https://github.com/llvm/llvm-project/issues/136936



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list