Skip to content

Commit c8ebf76

Browse files
committed
[SPIRV] Emit LinkageType for function with hidden visibility
1 parent abd9129 commit c8ebf76

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

llvm/lib/Target/SPIRV/SPIRVUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1042,7 +1042,7 @@ getFirstValidInstructionInsertPoint(MachineBasicBlock &BB) {
10421042

10431043
std::optional<SPIRV::LinkageType::LinkageType>
10441044
getSpirvLinkageTypeFor(const SPIRVSubtarget &ST, const GlobalValue &GV) {
1045-
if (GV.hasLocalLinkage() || GV.hasHiddenVisibility())
1045+
if (GV.hasLocalLinkage())
10461046
return std::nullopt;
10471047

10481048
if (GV.isDeclarationForLinker())

llvm/test/CodeGen/SPIRV/linkage/link-hidden.ll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
; RUN: not llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - 2>&1 | FileCheck %s
2-
; CHECK: LLVM ERROR: Unknown function in:
3-
; CHECK-SAME: OpFunctionCall %{{[0-9]+}}:type, @bar
1+
; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3+
4+
; CHECK: OpName %[[BAR:[0-9]+]] "bar"
5+
; CHECK: OpDecorate %[[BAR]] LinkageAttributes "bar" Import
6+
; CHECK: %[[BAR]] = OpFunction
47

58
define hidden spir_kernel void @foo() addrspace(4) {
69
entry:

0 commit comments

Comments
 (0)