[clang] [clang] Do not emit template parameter objects as COMDATs when they have internal linkage. (PR #125448)

Owen Anderson via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 2 19:10:30 PST 2025


================
@@ -3765,7 +3765,7 @@ ConstantAddress CodeGenModule::GetAddrOfTemplateParamObject(
   auto *GV = new llvm::GlobalVariable(getModule(), Init->getType(),
                                       /*isConstant=*/true, Linkage, Init, Name);
   setGVProperties(GV, TPO);
-  if (supportsCOMDAT())
+  if (supportsCOMDAT() && Linkage == llvm::GlobalValue::LinkOnceODRLinkage)
----------------
resistor wrote:

Linkage is set to either LinkOnceODRLinkage or InternalLinkage a few lines above this.

https://github.com/llvm/llvm-project/pull/125448


More information about the cfe-commits mailing list