From c7b950171d4b5e4e16de5d5c7c86592ed1fb5dac Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Wed, 27 Apr 2016 05:11:44 +0000 Subject: [PATCH] Revert "Support "preserving" the summary information when using setModule() API in LTOCodeGenerator" This reverts commit r267665. ASAN shows that there is a use of undefined value. From: Mehdi Amini llvm-svn: 267668 --- llvm/include/llvm/LTO/LTOCodeGenerator.h | 1 - llvm/lib/LTO/LTOCodeGenerator.cpp | 9 +----- llvm/test/LTO/X86/set-merged-thin.ll | 37 ------------------------ 3 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 llvm/test/LTO/X86/set-merged-thin.ll diff --git a/llvm/include/llvm/LTO/LTOCodeGenerator.h b/llvm/include/llvm/LTO/LTOCodeGenerator.h index 91b034cd9055..4f78d27b10da 100644 --- a/llvm/include/llvm/LTO/LTOCodeGenerator.h +++ b/llvm/include/llvm/LTO/LTOCodeGenerator.h @@ -201,7 +201,6 @@ private: LLVMContext &Context; std::unique_ptr MergedModule; - bool MainModuleHasSummary = false; std::unique_ptr TheLinker; std::unique_ptr TargetMach; bool EmitDwarfDebugInfo = false; diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp index 8497114f64f4..013046415983 100644 --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++ b/llvm/lib/LTO/LTOCodeGenerator.cpp @@ -18,7 +18,6 @@ #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Analysis/Passes.h" -#include "llvm/Analysis/ModuleSummaryAnalysis.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/Bitcode/ReaderWriter.h" @@ -146,7 +145,6 @@ void LTOCodeGenerator::setModule(std::unique_ptr Mod) { MergedModule = Mod->takeModule(); TheLinker = make_unique(*MergedModule); - MainModuleHasSummary = Mod->isThinLTO(); const std::vector &Undefs = Mod->getAsmUndefinedRefs(); for (int I = 0, E = Undefs.size(); I != E; ++I) @@ -211,13 +209,8 @@ bool LTOCodeGenerator::writeMergedModules(const char *Path) { return false; } - std::unique_ptr Index; - if (MainModuleHasSummary) - Index = ModuleSummaryIndexBuilder(MergedModule.get()).takeIndex(); - // write bitcode to it - WriteBitcodeToFile(MergedModule.get(), Out.os(), ShouldEmbedUselists, - Index.get()); + WriteBitcodeToFile(MergedModule.get(), Out.os(), ShouldEmbedUselists); Out.os().close(); if (Out.os().has_error()) { diff --git a/llvm/test/LTO/X86/set-merged-thin.ll b/llvm/test/LTO/X86/set-merged-thin.ll deleted file mode 100644 index be2f97ab4d9a..000000000000 --- a/llvm/test/LTO/X86/set-merged-thin.ll +++ /dev/null @@ -1,37 +0,0 @@ -; RUN: opt -module-summary < %s > %t1 -; RUN: llvm-lto -save-merged-module -exported-symbol=_main -set-merged-module -o %t2 %t1 -; RUN: llvm-bcanalyzer -dump %t2.merged.bc | FileCheck %s -; Verify that the module includes the ThinLTO summary -; CHECK: