Skip to content

Commit cf6233f

Browse files
authored
[lld-link] Change /lldemit:llvm to use the pre-codegen module
This matches ELF (#97480). clang cc1 -emit-llvm and -emit-llvm-bc for ThinLTO backend compilation also uses `PreCodeGenModuleHook`. While here, replace deprecated %T with %t. Pull Request: #98589
1 parent 746cea3 commit cf6233f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lld/COFF/LTO.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ lto::Config BitcodeCompiler::createConfig() {
9191
c.TimeTraceGranularity = ctx.config.timeTraceGranularity;
9292

9393
if (ctx.config.emit == EmitKind::LLVM) {
94-
c.PostInternalizeModuleHook = [this](size_t task, const Module &m) {
94+
c.PreCodeGenModuleHook = [this](size_t task, const Module &m) {
9595
if (std::unique_ptr<raw_fd_ostream> os =
9696
openLTOOutputFile(ctx.config.outputFile))
9797
WriteBitcodeToFile(m, *os, false);

lld/test/COFF/lto-emit-llvm.ll

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
; REQUIRES: x86
2-
; RUN: llvm-as -o %T/lto.obj %s
2+
; RUN: rm -rf %t && mkdir %t
3+
; RUN: llvm-as -o %t/lto.obj %s
34

4-
; RUN: lld-link /lldemit:llvm /out:%T/lto.bc /entry:main /subsystem:console %T/lto.obj
5-
; RUN: llvm-dis %T/lto.bc -o - | FileCheck %s
5+
; RUN: lld-link /lldemit:llvm /out:%t/lto.bc /entry:main /subsystem:console %t/lto.obj
6+
; RUN: llvm-dis %t/lto.bc -o - | FileCheck %s
67

7-
; CHECK: define void @main()
8+
; CHECK: define void @main() local_unnamed_addr
89

910
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
1011
target triple = "x86_64-pc-windows-msvc"

0 commit comments

Comments
 (0)