Author: Shilei Tian Date: 2026-07-22T09:12:48-04:00 New Revision: d9cf5980b7788a8840d69c6e4abb9092a35997bc
URL: https://github.com/llvm/llvm-project/commit/d9cf5980b7788a8840d69c6e4abb9092a35997bc DIFF: https://github.com/llvm/llvm-project/commit/d9cf5980b7788a8840d69c6e4abb9092a35997bc.diff LOG: [Clang][LTO] Assign GUIDs after post-opt bitcode linking (#211155) Run AssignGUIDPass after LinkInModulesPass so newly linked globals have GUIDs before LTO summary emission. Fixes LCOMPILER-2475. Added: Modified: clang/lib/CodeGen/BackendUtil.cpp clang/test/CodeGen/linking-bitcode-postopt.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 2b755fa916e55..068b1b4c262c8 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -91,6 +91,7 @@ #include "llvm/Transforms/Scalar/EarlyCSE.h" #include "llvm/Transforms/Scalar/GVN.h" #include "llvm/Transforms/Scalar/JumpThreading.h" +#include "llvm/Transforms/Utils/AssignGUID.h" #include "llvm/Transforms/Utils/Debugify.h" #include "llvm/Transforms/Utils/ModuleUtils.h" #include <limits> @@ -1139,8 +1140,10 @@ void EmitAssemblyHelper::RunOptimizationPipeline( } // Link against bitcodes supplied via the -mlink-builtin-bitcode option - if (CodeGenOpts.LinkBitcodePostopt) + if (CodeGenOpts.LinkBitcodePostopt) { MPM.addPass(LinkInModulesPass(BC)); + MPM.addPass(AssignGUIDPass()); + } if (LangOpts.HIPStdPar && !LangOpts.CUDAIsDevice && LangOpts.HIPStdParInterposeAlloc) diff --git a/clang/test/CodeGen/linking-bitcode-postopt.cpp b/clang/test/CodeGen/linking-bitcode-postopt.cpp index a0486ed0c9a83..0b0026d25a9c9 100644 --- a/clang/test/CodeGen/linking-bitcode-postopt.cpp +++ b/clang/test/CodeGen/linking-bitcode-postopt.cpp @@ -13,7 +13,7 @@ // RUN: -mlink-builtin-bitcode-postopt \ // RUN: %s 2>&1 | FileCheck --check-prefixes=OPTION-POSITIVE %s -// OPTION-POSITIVE: LinkInModulesPass +// OPTION-POSITIVE: LinkInModulesPass,assign-guid // RUN: %clang_cc1 -triple amdgcn-- -emit-llvm-bc -o /dev/null \ // RUN: -mllvm -print-pipeline-passes \ _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
