[flang-commits] [flang] [Flang][Driver] Emit module summary for LTO	(PR #164302)
    Anchu Rajendran S via flang-commits 
    flang-commits at lists.llvm.org
       
    Tue Oct 21 11:57:50 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}
----------------
anchuraj wrote:
Hi, ThinLTO requires more work to enable module summaries. I was wrong to test only the emitted module summary. At least https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/BackendUtil.cpp#L1168C9-L1182C8 needs to be enabled. I have removed the tests for thinLTO. This PR enables only module summary for Full LTO by default (same as https://reviews.llvm.org/D34156). Thank you for pointing out this
https://github.com/llvm/llvm-project/pull/164302
    
    
More information about the flang-commits
mailing list