================
@@ -1060,23 +1060,17 @@ void 
CodeGenAction::runOptimizationPipeline(llvm::raw_pwrite_stream &os) {
 
   if (action == BackendActionTy::Backend_EmitBC ||
       action == BackendActionTy::Backend_EmitLL || opts.PrepareForFatLTO) {
-    if (opts.PrepareForThinLTO) {
-      // TODO: ThinLTO module summary support is yet to be enabled.
-      if (action == BackendActionTy::Backend_EmitBC)
-        mpm.addPass(llvm::BitcodeWriterPass(os));
-      else if (action == BackendActionTy::Backend_EmitLL)
-        mpm.addPass(llvm::PrintModulePass(os));
-    } else {
+    if (!opts.PrepareForThinLTO)
----------------
kkwli wrote:

This is basically the original logic. It emits `!3 = !{i32 1, !"ThinLTO", i32 
0}` when <u>not</u> `-flto=thin` is specified. In this case, "ThinLTO" is set 
to off. This particular behavior is the same as what clang has:
```
$ build/bin/clang -S -emit-llvm -flto -o - main.c | grep LTO
!4 = !{i32 1, !"ThinLTO", i32 0}
!5 = !{i32 1, !"EnableSplitLTOUnit", i32 1}
^0 = module: (path: "[Regular LTO]", hash: (0, 0, 0, 0, 0))

$ build/bin/clang -S -emit-llvm -flto=thin -o - main.c | grep LTO
!4 = !{i32 1, !"EnableSplitLTOUnit", i32 0}
^0 = module: (path: "[Regular LTO]", hash: (0, 0, 0, 0, 0))

```

I add a comment to clarify it.

https://github.com/llvm/llvm-project/pull/195999
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to