[llvm] add support for the SPV_KHR_linkonce_odr extension (PR #81512)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 12 10:41:38 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 32eb95cc40d93bc5fb67e0b52531f7620204ec8c 41b1ca1263ac2afe8cd4298be6fd6561c4cfa382 -- llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp b/llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp
index fd287f2a94..baeed2ad89 100644
--- a/llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp
@@ -346,13 +346,14 @@ bool SPIRVCallLowering::lowerFormalArguments(MachineIRBuilder &MIRBuilder,
addStringImm(F.getName(), MIB);
} else if (F.getLinkage() == GlobalValue::LinkageTypes::ExternalLinkage ||
F.getLinkage() == GlobalValue::LinkOnceODRLinkage) {
- SPIRV::LinkageType::LinkageType LnkTy = F.isDeclaration()
- ? SPIRV::LinkageType::Import
- : (F.getLinkage() == GlobalValue::LinkOnceODRLinkage &&
- ST->canUseExtension(
- SPIRV::Extension::SPV_KHR_linkonce_odr)
- ? SPIRV::LinkageType::LinkOnceODR
- : SPIRV::LinkageType::Export);
+ SPIRV::LinkageType::LinkageType LnkTy =
+ F.isDeclaration()
+ ? SPIRV::LinkageType::Import
+ : (F.getLinkage() == GlobalValue::LinkOnceODRLinkage &&
+ ST->canUseExtension(
+ SPIRV::Extension::SPV_KHR_linkonce_odr)
+ ? SPIRV::LinkageType::LinkOnceODR
+ : SPIRV::LinkageType::Export);
buildOpDecorate(FuncVReg, MIRBuilder, SPIRV::Decoration::LinkageAttributes,
{static_cast<uint32_t>(LnkTy)}, F.getGlobalIdentifier());
}
diff --git a/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp b/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
index 6bcd8d4d51..354cd5d9b2 100644
--- a/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVSubtarget.cpp
@@ -54,11 +54,11 @@ cl::list<SPIRV::Extension::Extension> Extensions(
"SPV_KHR_bit_instructions",
"This enables bit instructions to be used by SPIR-V modules "
"without requiring the Shader capability"),
- clEnumValN(SPIRV::Extension::SPV_KHR_linkonce_odr,
- "SPV_KHR_linkonce_odr",
- "Allows to use the LinkOnceODR linkage type that is to let "
- "a function or global variable to be merged with other functions "
- "or global variables of the same name when linkage occurs."),
+ clEnumValN(
+ SPIRV::Extension::SPV_KHR_linkonce_odr, "SPV_KHR_linkonce_odr",
+ "Allows to use the LinkOnceODR linkage type that is to let "
+ "a function or global variable to be merged with other functions "
+ "or global variables of the same name when linkage occurs."),
clEnumValN(SPIRV::Extension::SPV_INTEL_function_pointers,
"SPV_INTEL_function_pointers",
"Allows translation of function pointers")));
``````````
</details>
https://github.com/llvm/llvm-project/pull/81512
More information about the llvm-commits
mailing list