[clang] d1e2b96 - [clang][fatlto] Don't set ThinLTO module flag with FatLTO (#75079)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 18 13:03:17 PST 2023
Author: Paul Kirth
Date: 2023-12-18T13:03:13-08:00
New Revision: d1e2b96b606e5bf8329ab5821f7a614163a56e16
URL: https://github.com/llvm/llvm-project/commit/d1e2b96b606e5bf8329ab5821f7a614163a56e16
DIFF: https://github.com/llvm/llvm-project/commit/d1e2b96b606e5bf8329ab5821f7a614163a56e16.diff
LOG: [clang][fatlto] Don't set ThinLTO module flag with FatLTO (#75079)
Since FatLTO now uses the UnifiedLTO pipeline, we should not set the
ThinLTO module flag to true, since it may cause an assertion failure.
See https://github.com/llvm/llvm-project/issues/70703 for context.
Added:
Modified:
clang/lib/CodeGen/BackendUtil.cpp
clang/test/CodeGen/fat-lto-objects.c
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 7d16de33763a0d..480410db1021b7 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1068,11 +1068,8 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
}
}
if (CodeGenOpts.FatLTO) {
- // Set module flags, like EnableSplitLTOUnit and UnifiedLTO, since FatLTO
+ // Set the EnableSplitLTOUnit and UnifiedLTO module flags, since FatLTO
// uses a
diff erent action than Backend_EmitBC or Backend_EmitLL.
- if (!TheModule->getModuleFlag("ThinLTO"))
- TheModule->addModuleFlag(llvm::Module::Error, "ThinLTO",
- uint32_t(CodeGenOpts.PrepareForThinLTO));
if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
TheModule->addModuleFlag(llvm::Module::Error, "EnableSplitLTOUnit",
uint32_t(CodeGenOpts.EnableSplitLTOUnit));
diff --git a/clang/test/CodeGen/fat-lto-objects.c b/clang/test/CodeGen/fat-lto-objects.c
index 95207e77c244cc..5c8ad1fd93c4b3 100644
--- a/clang/test/CodeGen/fat-lto-objects.c
+++ b/clang/test/CodeGen/fat-lto-objects.c
@@ -35,8 +35,7 @@
// SPLIT: ![[#]] = !{i32 1, !"EnableSplitLTOUnit", i32 1}
// NOSPLIT: ![[#]] = !{i32 1, !"EnableSplitLTOUnit", i32 0}
-/// Check that the ThinLTO metadata is set true for both full and thin LTO, since FatLTO is based on UnifiedLTO.
-// FULL: ![[#]] = !{i32 1, !"ThinLTO", i32 1}
+// FULL-NOT: ![[#]] = !{i32 1, !"ThinLTO", i32 0}
// THIN-NOT: ![[#]] = !{i32 1, !"ThinLTO", i32 0}
/// FatLTO always uses UnifiedLTO. It's an error if they aren't set together
More information about the cfe-commits
mailing list