[all-commits] [llvm/llvm-project] 7ed2f7: [HLSL] Set visibility of cbuffer global variables ...
Helena Kotas via All-commits
all-commits at lists.llvm.org
Mon Jun 8 19:05:48 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 7ed2f70f6c5b3849017f0eb38c521cc5d42040a2
https://github.com/llvm/llvm-project/commit/7ed2f70f6c5b3849017f0eb38c521cc5d42040a2
Author: Helena Kotas <hekotas at microsoft.com>
Date: 2026-06-08 (Mon, 08 Jun 2026)
Changed paths:
M clang/lib/CodeGen/CGHLSLRuntime.cpp
M clang/test/CodeGenHLSL/ArrayAssignable.hlsl
M clang/test/CodeGenHLSL/ArrayAssignable.logicalptr.hlsl
M clang/test/CodeGenHLSL/cbuffer-matrix-layout-keyword.hlsl
M clang/test/CodeGenHLSL/resources/cbuffer-empty-struct-array.hlsl
M clang/test/CodeGenHLSL/resources/cbuffer.hlsl
M clang/test/CodeGenHLSL/resources/cbuffer_and_namespaces.hlsl
M clang/test/CodeGenHLSL/resources/cbuffer_with_packoffset.hlsl
M clang/test/CodeGenHLSL/resources/cbuffer_with_static_global_and_function.hlsl
M clang/test/CodeGenHLSL/resources/default_cbuffer.hlsl
M clang/test/CodeGenHLSL/resources/default_cbuffer_with_layout.hlsl
M llvm/include/llvm/Frontend/HLSL/CBuffer.h
M llvm/lib/Frontend/HLSL/CBuffer.cpp
M llvm/lib/Target/DirectX/DXILCBufferAccess.cpp
M llvm/lib/Target/SPIRV/SPIRVCBufferAccess.cpp
A llvm/test/CodeGen/DirectX/cbuffer_global_elim.ll
A llvm/test/CodeGen/SPIRV/cbuffer_global_elim.ll
Log Message:
-----------
[HLSL] Set visibility of cbuffer global variables to internal (#200312)
Global variables for all resources except `cbuffer` are already emitted
with internal linkage (since #166844). This change adds internal linkage
to the `cbuffer` handle globals as well.
One problem is that the `cbuffer` handle globals appears unused between
Clang CodeGen and `{DXIL|SPIRV}CBufferAccess` pass, which replaces
individual `cbuffer` constant globals with accesses through the
`cbuffer` handle globals. Before this pass runs, the unused globals
could get optimized away in `GlobalOptPass` with `-O3`.
To solve this, the `cbuffer` handle globals are added to the
`@llvm.compiler.used` list to make sure they stay in the module until
the `{DXIL|SPRIV}CBufferAccess` pass, which then removes them from the
list.
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