[flang-commits] [flang] [Flang][Driver] Emit module summary for LTO (PR #164302)
Tarun Prabhu via flang-commits
flang-commits at lists.llvm.org
Mon Oct 20 18:00:25 PDT 2025
================
@@ -1,21 +1,35 @@
! Test that the output is LLVM bitcode for LTO and not a native objectfile by
-! disassembling it to LLVM IR.
-! Right now there is nothing special about it and it is similar to non-lto IR,
-! more work is needed to add things like module summaries.
+! disassembling it to LLVM IR. Also tests module summaries are emitted for LTO
! RUN: %flang %s -c -o - | not llvm-dis -o %t
! RUN: %flang_fc1 %s -emit-llvm-bc -o - | llvm-dis -o - | FileCheck %s
-
-! RUN: %flang -flto %s -c -o - | llvm-dis -o - | FileCheck %s
-! RUN: %flang -flto=thin %s -c -o - | llvm-dis -o - | FileCheck %s
-
! CHECK: define void @_QQmain()
! CHECK-NEXT: ret void
! CHECK-NEXT: }
+! CHECK-NOT: !{{.*}} = !{i32 1, !"ThinLTO", i32 0}
+! CHECK-NOT: ^{{.*}} = module:
+! CHECK-NOT: ^{{.*}} = gv: (name:
+! CHECK-NOT: ^{{.*}} = blockcount:
+
+! RUN: %flang -flto %s -c -o - | llvm-dis -o - | FileCheck %s --check-prefix=FULL
+! THIN: define void @_QQmain()
+! THIN-NEXT: ret void
+! THIN-NEXT: }
+! THIN-NOT: !{{.*}} = !{i32 1, !"ThinLTO", i32 0}
----------------
tarunprabhu wrote:
When setting `-flto=full`, metadata named `ThinLTO` is _present_ in the module (line 27), but when `-flto=thin`, it is not? Does the 0 value for `"ThinLTO"` mean that the ThinLTO is off?
Also, it looks like the output in both the thin and full LTO cases are the same - or at least, what is being checked in this test is the same. What is the difference between the two schemes?
I apologize for my ignorance - as I said, I am not very familiar with LLVM's LTO implementation. Do you mind clarifying some of this? Thanks.
https://github.com/llvm/llvm-project/pull/164302
More information about the flang-commits
mailing list