From c9157d925c489f07ba9c0b2ce47e5149b75969a5 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 18 Dec 2023 21:30:12 +0100 Subject: Merge llvm-project main llvmorg-18-init-15088-gd14ee76181fb This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvm-project main llvmorg-18-init-15088-gd14ee76181fb. PR: 276104 MFC after: 1 month (cherry picked from commit 5f757f3ff9144b609b3c433dfd370cc6bdc191ad) --- contrib/llvm-project/llvm/lib/Transforms/Utils/CloneModule.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'contrib/llvm-project/llvm/lib/Transforms/Utils/CloneModule.cpp') diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/CloneModule.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/CloneModule.cpp index 55e051298a9a..00e40fe73d90 100644 --- a/contrib/llvm-project/llvm/lib/Transforms/Utils/CloneModule.cpp +++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/CloneModule.cpp @@ -34,6 +34,8 @@ static void copyComdat(GlobalObject *Dst, const GlobalObject *Src) { /// copies of global variables and functions, and making their (initializers and /// references, respectively) refer to the right globals. /// +/// Cloning un-materialized modules is not currently supported, so any +/// modules initialized via lazy loading should be materialized before cloning std::unique_ptr llvm::CloneModule(const Module &M) { // Create the value map that maps things from the old module over to the new // module. @@ -49,6 +51,9 @@ std::unique_ptr llvm::CloneModule(const Module &M, std::unique_ptr llvm::CloneModule( const Module &M, ValueToValueMapTy &VMap, function_ref ShouldCloneDefinition) { + + assert(M.isMaterialized() && "Module must be materialized before cloning!"); + // First off, we need to create the new module. std::unique_ptr New = std::make_unique(M.getModuleIdentifier(), M.getContext()); @@ -56,6 +61,7 @@ std::unique_ptr llvm::CloneModule( New->setDataLayout(M.getDataLayout()); New->setTargetTriple(M.getTargetTriple()); New->setModuleInlineAsm(M.getModuleInlineAsm()); + New->IsNewDbgInfoFormat = M.IsNewDbgInfoFormat; // Loop over all of the global variables, making corresponding globals in the // new module. Here we add them to the VMap and to the new Module. We -- cgit v1.2.3