[lld] [COFF] Change /lldemit:llvm to use the pre-codegen module (PR #98589)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 11 22:32:16 PDT 2024
https://github.com/MaskRay created https://github.com/llvm/llvm-project/pull/98589
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.
>From 5d9bd8839f4b16a8c84daca526c712245e37b03a Mon Sep 17 00:00:00 2001
From: Fangrui Song <i at maskray.me>
Date: Thu, 11 Jul 2024 22:32:06 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.5-bogner
---
lld/COFF/LTO.cpp | 2 +-
lld/test/COFF/lto-emit-llvm.ll | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/lld/COFF/LTO.cpp b/lld/COFF/LTO.cpp
index be49aa6e8bb3d..5c881bc01c663 100644
--- a/lld/COFF/LTO.cpp
+++ b/lld/COFF/LTO.cpp
@@ -91,7 +91,7 @@ lto::Config BitcodeCompiler::createConfig() {
c.TimeTraceGranularity = ctx.config.timeTraceGranularity;
if (ctx.config.emit == EmitKind::LLVM) {
- c.PostInternalizeModuleHook = [this](size_t task, const Module &m) {
+ c.PreCodeGenModuleHook = [this](size_t task, const Module &m) {
if (std::unique_ptr<raw_fd_ostream> os =
openLTOOutputFile(ctx.config.outputFile))
WriteBitcodeToFile(m, *os, false);
diff --git a/lld/test/COFF/lto-emit-llvm.ll b/lld/test/COFF/lto-emit-llvm.ll
index 985058de10a48..3ba6cf722e97f 100644
--- a/lld/test/COFF/lto-emit-llvm.ll
+++ b/lld/test/COFF/lto-emit-llvm.ll
@@ -1,10 +1,11 @@
; REQUIRES: x86
-; RUN: llvm-as -o %T/lto.obj %s
+; RUN: rm -rf %t && mkdir %t
+; RUN: llvm-as -o %t/lto.obj %s
-; RUN: lld-link /lldemit:llvm /out:%T/lto.bc /entry:main /subsystem:console %T/lto.obj
-; RUN: llvm-dis %T/lto.bc -o - | FileCheck %s
+; RUN: lld-link /lldemit:llvm /out:%t/lto.bc /entry:main /subsystem:console %t/lto.obj
+; RUN: llvm-dis %t/lto.bc -o - | FileCheck %s
-; CHECK: define void @main()
+; CHECK: define void @main() local_unnamed_addr
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
More information about the llvm-commits
mailing list