Update prebuilt Clang to r416183b from Android.
https://android.googlesource.com/platform/prebuilts/clang/host/
linux-x86/+/06a71ddac05c22edb2d10b590e1769b3f8619bef
clang 12.0.5 (based on r416183b) from build 7284624.
Change-Id: I277a316abcf47307562d8b748b84870f31a72866
Signed-off-by: Olivier Deprez <olivier.deprez@arm.com>
diff --git a/linux-x64/clang/include/llvm/LTO/LTO.h b/linux-x64/clang/include/llvm/LTO/LTO.h
index ca0a8b6..4f16913 100644
--- a/linux-x64/clang/include/llvm/LTO/LTO.h
+++ b/linux-x64/clang/include/llvm/LTO/LTO.h
@@ -17,28 +17,24 @@
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/StringMap.h"
-#include "llvm/ADT/StringSet.h"
-#include "llvm/IR/DiagnosticInfo.h"
+#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/IR/ModuleSummaryIndex.h"
-#include "llvm/IR/RemarkStreamer.h"
#include "llvm/LTO/Config.h"
-#include "llvm/Linker/IRMover.h"
#include "llvm/Object/IRSymtab.h"
#include "llvm/Support/Error.h"
-#include "llvm/Support/ToolOutputFile.h"
#include "llvm/Support/thread.h"
-#include "llvm/Target/TargetOptions.h"
#include "llvm/Transforms/IPO/FunctionImport.h"
namespace llvm {
-class BitcodeModule;
class Error;
+class IRMover;
class LLVMContext;
class MemoryBufferRef;
class Module;
-class Target;
class raw_pwrite_stream;
+class Target;
+class ToolOutputFile;
/// Resolve linkage for prevailing symbols in the \p Index. Linkage changes
/// recorded in the index and the ThinLTO backends must apply the changes to
@@ -59,7 +55,9 @@
/// must apply the changes to the Module via thinLTOInternalizeModule.
void thinLTOInternalizeAndPromoteInIndex(
ModuleSummaryIndex &Index,
- function_ref<bool(StringRef, GlobalValue::GUID)> isExported);
+ function_ref<bool(StringRef, ValueInfo)> isExported,
+ function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)>
+ isPrevailing);
/// Computes a unique hash for the Module considering the current list of
/// export/import and other global analysis results.
@@ -84,15 +82,19 @@
const std::string &NewPrefix);
/// Setup optimization remarks.
-Expected<std::unique_ptr<ToolOutputFile>>
-setupOptimizationRemarks(LLVMContext &Context, StringRef RemarksFilename,
- StringRef RemarksPasses, StringRef RemarksFormat,
- bool RemarksWithHotness, int Count = -1);
+Expected<std::unique_ptr<ToolOutputFile>> setupLLVMOptimizationRemarks(
+ LLVMContext &Context, StringRef RemarksFilename, StringRef RemarksPasses,
+ StringRef RemarksFormat, bool RemarksWithHotness,
+ Optional<uint64_t> RemarksHotnessThreshold = 0, int Count = -1);
/// Setups the output file for saving statistics.
Expected<std::unique_ptr<ToolOutputFile>>
setupStatsFile(StringRef StatsFilename);
+/// Produces a container ordering for optimal multi-threaded processing. Returns
+/// ordered indices to elements in the input array.
+std::vector<int> generateModulesOrdering(ArrayRef<BitcodeModule *> R);
+
class LTO;
struct SymbolResolution;
class ThinBackendProc;
@@ -220,12 +222,13 @@
/// The details of this type definition aren't important; clients can only
/// create a ThinBackend using one of the create*ThinBackend() functions below.
using ThinBackend = std::function<std::unique_ptr<ThinBackendProc>(
- Config &C, ModuleSummaryIndex &CombinedIndex,
+ const Config &C, ModuleSummaryIndex &CombinedIndex,
StringMap<GVSummaryMapTy> &ModuleToDefinedGVSummaries,
AddStreamFn AddStream, NativeObjectCache Cache)>;
/// This ThinBackend runs the individual backend jobs in-process.
-ThinBackend createInProcessThinBackend(unsigned ParallelismLevel);
+/// The default value means to use one job per hardware core (not hyper-thread).
+ThinBackend createInProcessThinBackend(ThreadPoolStrategy Parallelism);
/// This ThinBackend writes individual module indexes to files, instead of
/// running the individual backend jobs. This backend is for distributed builds
@@ -296,14 +299,19 @@
/// Cache) for each task identifier.
Error run(AddStreamFn AddStream, NativeObjectCache Cache = nullptr);
+ /// Static method that returns a list of libcall symbols that can be generated
+ /// by LTO but might not be visible from bitcode symbol table.
+ static ArrayRef<const char*> getRuntimeLibcallSymbols();
+
private:
Config Conf;
struct RegularLTOState {
- RegularLTOState(unsigned ParallelCodeGenParallelismLevel, Config &Conf);
+ RegularLTOState(unsigned ParallelCodeGenParallelismLevel,
+ const Config &Conf);
struct CommonResolution {
uint64_t Size = 0;
- unsigned Align = 0;
+ MaybeAlign Align;
/// Record if at least one instance of the common was marked as prevailing
bool Prevailing = false;
};
@@ -323,14 +331,20 @@
std::vector<GlobalValue *> Keep;
};
std::vector<AddedModule> ModsWithSummaries;
+ bool EmptyCombinedModule = true;
} RegularLTO;
+ using ModuleMapType = MapVector<StringRef, BitcodeModule>;
+
struct ThinLTOState {
ThinLTOState(ThinBackend Backend);
ThinBackend Backend;
ModuleSummaryIndex CombinedIndex;
- MapVector<StringRef, BitcodeModule> ModuleMap;
+ // The full set of bitcode modules in input order.
+ ModuleMapType ModuleMap;
+ // The bitcode modules to compile, if specified by the LTO Config.
+ Optional<ModuleMapType> ModulesToCompile;
DenseMap<GlobalValue::GUID, StringRef> PrevailingModuleForGUID;
} ThinLTO;