From 751eaaa4cadf30b0a5be729d0e0a32dc00f76332 Mon Sep 17 00:00:00 2001 From: Leonard Chan Date: Wed, 21 Aug 2019 17:24:14 +0000 Subject: [PATCH] [LTO] Always mark regular LTO units with EnableSplitLTOUnit=1 under the new pass manager Match the behavior of D65009 under the new pass manager. This addresses the test clang/test/CodeGen/split-lto-unit.c when running under the new PM. Differential Revision: https://reviews.llvm.org/D66488 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369550 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/BackendUtil.cpp | 2 +- test/CodeGen/split-lto-unit.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index e6cbd6490d..2932fb0fe8 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -1291,7 +1291,7 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager( if (!TheModule->getModuleFlag("ThinLTO")) TheModule->addModuleFlag(Module::Error, "ThinLTO", uint32_t(0)); TheModule->addModuleFlag(Module::Error, "EnableSplitLTOUnit", - CodeGenOpts.EnableSplitLTOUnit); + uint32_t(1)); } MPM.addPass( BitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists, EmitLTOSummary)); diff --git a/test/CodeGen/split-lto-unit.c b/test/CodeGen/split-lto-unit.c index 8e83ebaa6f..bd15765643 100644 --- a/test/CodeGen/split-lto-unit.c +++ b/test/CodeGen/split-lto-unit.c @@ -7,6 +7,7 @@ // SPLIT: !{i32 1, !"EnableSplitLTOUnit", i32 1} // // ; Check that regular LTO has EnableSplitLTOUnit = 1 -// RUN: %clang_cc1 -flto -triple x86_64-pc-linux-gnu -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s --implicit-check-not="EnableSplitLTOUnit" --check-prefix=SPLIT +// RUN: %clang_cc1 -fno-experimental-new-pass-manager -flto -triple x86_64-pc-linux-gnu -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s --implicit-check-not="EnableSplitLTOUnit" --check-prefix=SPLIT +// RUN: %clang_cc1 -fexperimental-new-pass-manager -flto -triple x86_64-pc-linux-gnu -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s --implicit-check-not="EnableSplitLTOUnit" --check-prefix=SPLIT int main() {} -- 2.40.0