[flang-commits] [flang] [Flang][Driver] Emit module summary for Full LTO (PR #164302)

Tarun Prabhu via flang-commits flang-commits at lists.llvm.org
Wed Oct 22 10:14:47 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:

Sorry, I got a bit confused and asked a strange question. Let me try again.

In this test, when `-flto=full`, we are checking for the "ThinLTO = 0" metadata and the presence of "`module:`, `gv:`, `blockcount:`" (I assume that this is the summary, is that right?). 

However, when `flto=thin`, we are only checking for the absence of the "ThinLTO" metadata. We are not checking for the absence of the summaries. Should we be doing that as well?

https://github.com/llvm/llvm-project/pull/164302


More information about the flang-commits mailing list