Skip to content

Commit a133aee

Browse files
authored
[LTO] Fix a bug when you enable -flto=thin
1 parent 57bd0f2 commit a133aee

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
10781078
if (CodeGenOpts.UnifiedLTO)
10791079
TheModule->addModuleFlag(Module::Error, "UnifiedLTO", uint32_t(1));
10801080
}
1081-
if (!CodeGenOpts.PrepareForLTO) {
1081+
if (!CodeGenOpts.PrepareForLTO || CodeGenOpts.PrepareForThinLTO) {
10821082
if (Action == Backend_EmitBC)
10831083
MPM.addPass(BitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists,
10841084
EmitLTOSummary));
@@ -1121,7 +1121,7 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
11211121
MPM.addPass(WelcomeToLLVMMSVCPass(true));
11221122

11231123
// For /GL(LTO)
1124-
if (CodeGenOpts.PrepareForLTO) {
1124+
if (CodeGenOpts.PrepareForLTO && !CodeGenOpts.PrepareForThinLTO) {
11251125
bool EmitLTOSummary = shouldEmitRegularLTOSummary();
11261126
if (Action == Backend_EmitBC)
11271127
MPM.addPass(BitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists,

0 commit comments

Comments
 (0)