[PATCH] D123971: [clang][PS4] Enable SplitLTOUnits by default
Matthew Voss via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 11 16:25:29 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG392b30680752: [clang][PS4] Enable SplitLTOUnits and Unified LTO by default (authored by ormris).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Changed prior to commit:
https://reviews.llvm.org/D123971?vs=530117&id=539331#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D123971/new/
https://reviews.llvm.org/D123971
Files:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CodeGen/split-lto-unit.c
clang/test/CodeGenCXX/unified-cfi-lto.cpp
clang/test/Driver/lto-unit.c
clang/test/Driver/split-lto-unit.c
Index: clang/test/Driver/split-lto-unit.c
===================================================================
--- clang/test/Driver/split-lto-unit.c
+++ clang/test/Driver/split-lto-unit.c
@@ -7,6 +7,10 @@
// RUN: %clang --target=x86_64-apple-darwin13.3.0 -### %s -fwhole-program-vtables -flto=thin 2>&1 | FileCheck --check-prefix=NOUNIT %s
// RUN: %clang --target=x86_64-scei-ps4 -### %s -fwhole-program-vtables -flto=full 2>&1 | FileCheck --check-prefix=UNIT %s
// RUN: %clang --target=x86_64-scei-ps4 -### %s -fwhole-program-vtables -flto=thin 2>&1 | FileCheck --check-prefix=NOUNIT %s
+// RUN: %clang --target=x86_64-sie-ps5 -### %s -fwhole-program-vtables -flto=full 2>&1 | FileCheck --check-prefix=UNIT %s
+// RUN: %clang --target=x86_64-sie-ps5 -### %s -fwhole-program-vtables -flto=thin 2>&1 | FileCheck --check-prefix=UNIT %s
+// RUN: %clang --target=x86_64-unknown-linux -### %s -fwhole-program-vtables -flto=full -funified-lto 2>&1 | FileCheck --check-prefix=UNIT %s
+// RUN: %clang --target=x86_64-unknown-linux -### %s -fwhole-program-vtables -flto=thin -funified-lto 2>&1 | FileCheck --check-prefix=UNIT %s
// UNIT: "-fsplit-lto-unit"
// NOUNIT-NOT: "-fsplit-lto-unit"
Index: clang/test/Driver/lto-unit.c
===================================================================
--- clang/test/Driver/lto-unit.c
+++ clang/test/Driver/lto-unit.c
@@ -4,5 +4,10 @@
// RUN: %clang --target=x86_64-apple-darwin13.3.0 -### %s -flto=thin 2>&1 | FileCheck --check-prefix=UNIT %s
// RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=full 2>&1 | FileCheck --check-prefix=UNIT %s
// RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=thin 2>&1 | FileCheck --check-prefix=UNIT %s
+// RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=full -funified-lto 2>&1 | FileCheck --check-prefix=UNIT %s
+// RUN: %clang --target=x86_64-scei-ps4 -### %s -flto=thin -funified-lto 2>&1 | FileCheck --check-prefix=NOUNIT %s
+// RUN: %clang --target=x86_64-unknown-linux -### %s -flto=full -funified-lto 2>&1 | FileCheck --check-prefix=UNIT %s
+// RUN: %clang --target=x86_64-unknown-linux -### %s -flto=thin -funified-lto 2>&1 | FileCheck --check-prefix=UNIT %s
// UNIT: "-flto-unit"
+// NOUNIT-NOT: "-flto-unit"
Index: clang/test/CodeGenCXX/unified-cfi-lto.cpp
===================================================================
--- clang/test/CodeGenCXX/unified-cfi-lto.cpp
+++ clang/test/CodeGenCXX/unified-cfi-lto.cpp
@@ -1,6 +1,6 @@
// Ensure that the frontend adds the proper metadata when CFI is
// enabled.
-// RUN: %clang --target=x86_64-scei-ps4 -funified-lto -flto -fsanitize=cfi -fvisibility=hidden -c %s -o %t.o
+// RUN: %clang --target=x86_64-scei-ps4 -funified-lto -flto -fsanitize=cfi -fvisibility=hidden -fno-sanitize-ignorelist -c %s -o %t.o
// RUN: llvm-dis %t.o -o %t1
// RUN: FileCheck <%t1.0 %s
Index: clang/test/CodeGen/split-lto-unit.c
===================================================================
--- clang/test/CodeGen/split-lto-unit.c
+++ clang/test/CodeGen/split-lto-unit.c
@@ -1,6 +1,7 @@
// ; Check that -flto=thin without -fsplit-lto-unit has EnableSplitLTOUnit = 0
// RUN: %clang_cc1 -flto=thin -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s
// RUN: %clang_cc1 -flto=thin -emit-llvm < %s | FileCheck %s
+// RUN: %clang_cc1 -flto=thin -funified-lto -triple=x86_64-scei-ps4 -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s
// CHECK: !{i32 1, !"EnableSplitLTOUnit", i32 0}
//
// ; Check that -flto=thin with -fsplit-lto-unit has EnableSplitLTOUnit = 1
@@ -12,4 +13,9 @@
// RUN: %clang_cc1 -flto -triple x86_64-pc-linux-gnu -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s --implicit-check-not="EnableSplitLTOUnit" --check-prefix=SPLIT
// RUN: %clang_cc1 -flto -triple x86_64-pc-linux-gnu -emit-llvm < %s | FileCheck %s --implicit-check-not="EnableSplitLTOUnit" --check-prefix=SPLIT
+// ; Check that regular LTO has EnableSplitLTOUnit = 1, if using distinct pipelines. For unified pipelines, use EnableSplitLTOUnit = 0.
+// RUN: %clang_cc1 -flto -triple x86_64-pc-linux-gnu -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s --implicit-check-not="EnableSplitLTOUnit" --check-prefix=SPLIT
+// RUN: %clang_cc1 -flto -funified-lto -triple x86_64-scei-ps4 -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s
+// RUN: %clang_cc1 -flto=thin -funified-lto -fsplit-lto-unit -triple x86_64-pc-linux-gnu -emit-llvm-bc < %s | llvm-dis -o - | FileCheck %s --implicit-check-not="EnableSplitLTOUnit" --check-prefix=SPLIT
+
int main(void) {}
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4776,7 +4776,7 @@
// Select the appropriate action.
RewriteKind rewriteKind = RK_None;
- bool UnifiedLTO = false;
+ bool UnifiedLTO = Triple.isPS();;
if (IsUsingLTO) {
UnifiedLTO = Args.hasFlag(options::OPT_funified_lto,
options::OPT_fno_unified_lto, false);
@@ -7343,7 +7343,8 @@
bool DefaultsSplitLTOUnit =
(WholeProgramVTables || SanitizeArgs.needsLTO()) &&
- (LTOMode == LTOK_Full || TC.canSplitThinLTOUnit());
+ (LTOMode == LTOK_Full || TC.canSplitThinLTOUnit()) ||
+ (!Triple.isPS4() && UnifiedLTO);
bool SplitLTOUnit =
Args.hasFlag(options::OPT_fsplit_lto_unit,
options::OPT_fno_split_lto_unit, DefaultsSplitLTOUnit);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123971.539331.patch
Type: text/x-patch
Size: 5412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230711/8598898e/attachment.bin>
More information about the llvm-commits
mailing list