From c45bb326a681570b88dd315299c10c2242c143a9 Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Thu, 30 Jan 2020 09:56:43 -0800 Subject: [ThinLTO] Disable "Always import constants" due to compile time issues Summary: Disable the always importing of constants introduced in D70404 by default under a new internal option, since it is causing order of magnitude compile time regressions during the thin link. Will continue investigating why the regressions occur. Reviewers: evgeny777, wmi Subscribers: mehdi_amini, inglorion, hiraditya, steven_wu, dexonsmith, arphaman, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D73724 --- llvm/lib/IR/ModuleSummaryIndex.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'llvm/lib/IR/ModuleSummaryIndex.cpp') diff --git a/llvm/lib/IR/ModuleSummaryIndex.cpp b/llvm/lib/IR/ModuleSummaryIndex.cpp index 301df9a..0a43e17 100644 --- a/llvm/lib/IR/ModuleSummaryIndex.cpp +++ b/llvm/lib/IR/ModuleSummaryIndex.cpp @@ -31,6 +31,12 @@ static cl::opt PropagateAttrs("propagate-attrs", cl::init(true), cl::Hidden, cl::desc("Propagate attributes in index")); +// FIXME: Enable again when thin link compile time regressions understood and +// addressed +static cl::opt ImportConstantsWithRefs( + "import-constants-with-refs", cl::init(false), cl::Hidden, + cl::desc("Import constant global variables with references")); + FunctionSummary FunctionSummary::ExternalNode = FunctionSummary::makeDummyFunctionSummary({}); @@ -221,8 +227,8 @@ bool ModuleSummaryIndex::canImportGlobalVar(GlobalValueSummary *S, // c) Link error (external declaration with internal definition). // However we do not promote objects referenced by writeonly GV // initializer by means of converting it to 'zeroinitializer' - return !GVS->isConstant() && !isReadOnly(GVS) && !isWriteOnly(GVS) && - GVS->refs().size(); + return !(ImportConstantsWithRefs && GVS->isConstant()) && + !isReadOnly(GVS) && !isWriteOnly(GVS) && GVS->refs().size(); }; auto *GVS = cast(S->getBaseObject()); -- cgit v1.1