Skip to content

Commit d1e2b96

Browse files
authored
[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 #70703 for context.
1 parent e409f85 commit d1e2b96

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,11 +1068,8 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
10681068
}
10691069
}
10701070
if (CodeGenOpts.FatLTO) {
1071-
// Set module flags, like EnableSplitLTOUnit and UnifiedLTO, since FatLTO
1071+
// Set the EnableSplitLTOUnit and UnifiedLTO module flags, since FatLTO
10721072
// uses a different action than Backend_EmitBC or Backend_EmitLL.
1073-
if (!TheModule->getModuleFlag("ThinLTO"))
1074-
TheModule->addModuleFlag(llvm::Module::Error, "ThinLTO",
1075-
uint32_t(CodeGenOpts.PrepareForThinLTO));
10761073
if (!TheModule->getModuleFlag("EnableSplitLTOUnit"))
10771074
TheModule->addModuleFlag(llvm::Module::Error, "EnableSplitLTOUnit",
10781075
uint32_t(CodeGenOpts.EnableSplitLTOUnit));

clang/test/CodeGen/fat-lto-objects.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
// SPLIT: ![[#]] = !{i32 1, !"EnableSplitLTOUnit", i32 1}
3636
// NOSPLIT: ![[#]] = !{i32 1, !"EnableSplitLTOUnit", i32 0}
3737

38-
/// Check that the ThinLTO metadata is set true for both full and thin LTO, since FatLTO is based on UnifiedLTO.
39-
// FULL: ![[#]] = !{i32 1, !"ThinLTO", i32 1}
38+
// FULL-NOT: ![[#]] = !{i32 1, !"ThinLTO", i32 0}
4039
// THIN-NOT: ![[#]] = !{i32 1, !"ThinLTO", i32 0}
4140

4241
/// FatLTO always uses UnifiedLTO. It's an error if they aren't set together

0 commit comments

Comments
 (0)