[PATCH] D22167: Add 'thinlto_src_module' md with asserts or -enable-import-metadata
Piotr Padlewski via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 8 14:32:52 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL274938: Add 'thinlto_src_module' md with asserts or -enable-import-metadata (authored by Prazek).
Changed prior to commit:
http://reviews.llvm.org/D22167?vs=63311&id=63319#toc
Repository:
rL LLVM
http://reviews.llvm.org/D22167
Files:
llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
llvm/trunk/test/Transforms/FunctionImport/funcimport.ll
Index: llvm/trunk/test/Transforms/FunctionImport/funcimport.ll
===================================================================
--- llvm/trunk/test/Transforms/FunctionImport/funcimport.ll
+++ llvm/trunk/test/Transforms/FunctionImport/funcimport.ll
@@ -4,12 +4,12 @@
; RUN: llvm-lto -thinlto -print-summary-global-ids -o %t3 %t.bc %t2.bc 2>&1 | FileCheck %s --check-prefix=GUID
; Do the import now
-; RUN: opt -disable-force-link-odr -function-import -stats -print-imports -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=INSTLIMDEF
+; RUN: opt -disable-force-link-odr -function-import -stats -print-imports -enable-import-metadata -summary-file %t3.thinlto.bc %t.bc -S 2>&1 | FileCheck %s --check-prefix=CHECK --check-prefix=INSTLIMDEF
; "-stats" requires +Asserts.
-; REQUIRES: asserts
+; REQUIRES asserts
; Test import with smaller instruction limit
-; RUN: opt -disable-force-link-odr -function-import -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=5 -S | FileCheck %s --check-prefix=CHECK --check-prefix=INSTLIM5
+; RUN: opt -disable-force-link-odr -function-import -enable-import-metadata -summary-file %t3.thinlto.bc %t.bc -import-instr-limit=5 -S | FileCheck %s --check-prefix=CHECK --check-prefix=INSTLIM5
; INSTLIM5-NOT: @staticfunc.llvm.
; Test import with smaller instruction limit and without the -disable-force-link-odr
Index: llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
+++ llvm/trunk/lib/Transforms/IPO/FunctionImport.cpp
@@ -58,6 +58,16 @@
DontForceImportReferencedDiscardableSymbols("disable-force-link-odr",
cl::init(false), cl::Hidden);
+static cl::opt<bool> EnableImportMetadata(
+ "enable-import-metadata", cl::init(
+#if !defined(NDEBUG)
+ true /*Enabled with asserts.*/
+#else
+ false
+#endif
+ ),
+ cl::Hidden, cl::desc("Enable import metadata like 'thinlto_src_module'"));
+
// Load lazily a module from \p FileName in \p Context.
static std::unique_ptr<Module> loadFile(const std::string &FileName,
LLVMContext &Context) {
@@ -591,12 +601,15 @@
<< SrcModule->getSourceFileName() << "\n");
if (Import) {
F.materialize();
- // Add 'thinlto_src_module' metadata for statistics and debugging.
- F.setMetadata("thinlto_src_module",
- llvm::MDNode::get(DestModule.getContext(),
- {llvm::MDString::get(
- DestModule.getContext(),
- SrcModule->getSourceFileName())}));
+ if (EnableImportMetadata) {
+ // Add 'thinlto_src_module' metadata for statistics and debugging.
+ F.setMetadata(
+ "thinlto_src_module",
+ llvm::MDNode::get(
+ DestModule.getContext(),
+ {llvm::MDString::get(DestModule.getContext(),
+ SrcModule->getSourceFileName())}));
+ }
GlobalsToImport.insert(&F);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22167.63319.patch
Type: text/x-patch
Size: 3343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160708/e911c7f2/attachment.bin>
More information about the llvm-commits
mailing list