llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Shilei Tian (shiltian)

<details>
<summary>Changes</summary>

Run AssignGUIDPass after LinkInModulesPass so newly linked globals have
GUIDs before LTO summary emission.


---
Full diff: https://github.com/llvm/llvm-project/pull/211155.diff


2 Files Affected:

- (modified) clang/lib/CodeGen/BackendUtil.cpp (+4-1) 
- (modified) clang/test/CodeGen/linking-bitcode-postopt.cpp (+1-1) 


``````````diff
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 \

``````````

</details>


https://github.com/llvm/llvm-project/pull/211155
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to