aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/LTO/LTOBackend.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@sifive.com>2022-01-06 08:59:40 +0800
committerFreddy Ye <freddy.ye@intel.com>2022-01-06 09:24:35 +0800
commit0f5b718030e7112773ff4e88dd026204ba5b2890 (patch)
treef370fdd4b92eb18ef97c41b552d54f645d54997a /llvm/lib/LTO/LTOBackend.cpp
parent74bb4ad5d4eb08f997a94b92d4e4eb27d48591b2 (diff)
downloadllvm-0f5b718030e7112773ff4e88dd026204ba5b2890.zip
llvm-0f5b718030e7112773ff4e88dd026204ba5b2890.tar.gz
llvm-0f5b718030e7112773ff4e88dd026204ba5b2890.tar.bz2
[LTO][codegen] Add TargetLibraryInfoWrapperPass initially
Many codegen pass require this pass with useful triple info. Legacy pass manager need to add a TargetLibraryInfo with the module info before run passes. Or the TargetLibraryInfo will be initialized too conservative. Reviewed By: pengfei, aeubanks Differential Revision: https://reviews.llvm.org/D115850
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
-rw-r--r--llvm/lib/LTO/LTOBackend.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 855d0fc..308c602 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -415,6 +415,8 @@ static void codegen(const Config &Conf, TargetMachine *TM,
TM->Options.ObjectFilenameForDebug = Stream->ObjectPathName;
legacy::PassManager CodeGenPasses;
+ TargetLibraryInfoImpl TLII(Triple(Mod.getTargetTriple()));
+ CodeGenPasses.add(new TargetLibraryInfoWrapperPass(TLII));
CodeGenPasses.add(
createImmutableModuleSummaryIndexWrapperPass(&CombinedIndex));
if (Conf.PreCodeGenPassesHook)