Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[LTO] Add unified LTO tests for the PS targets.#148229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
MaggieYingYi wants to merge2 commits intollvm:main
base:main
Choose a base branch
Loading
fromMaggieYingYi:yingyi/main/unified_LTO_tests

Conversation

MaggieYingYi
Copy link
Contributor

For the PS targets, unified LTO pipeline is used as default behaviour when enabling LTO. Other targets use Distinct LTO pipeline behaviour as default behaviours. Unified LTO tests are added in this PR:

  1. clang/test/CodeGen/asan-unified-lto.ll: add a RUN line to check the explicit Distinct LTO pipeline behavior for PS targets.
  2. clang/test/CodeGen/unified-lto-pipeline-ps.c: a new test for PS targets.

For the PS targets, unified LTO pipeline is used as default behaviour when enabling LTO. Other targets use Distinct LTO pipeline behaviour as default behavious. Unified LTO tests are added in this PR:1. clang/test/CodeGen/asan-unified-lto.ll: add a RUN line to check the explicit Distinct LTO pipeline behavior for PS targets.2. clang/test/CodeGen/unified-lto-pipeline-ps.c: a new test for PS targets.
@MaggieYingYiMaggieYingYi self-assigned thisJul 11, 2025
@llvmbotllvmbot added the clangClang issues not falling into any other category labelJul 11, 2025
@llvmbot
Copy link
Member

@llvm/pr-subscribers-clang

Author: Ying Yi (MaggieYingYi)

Changes

For the PS targets, unified LTO pipeline is used as default behaviour when enabling LTO. Other targets use Distinct LTO pipeline behaviour as default behaviours. Unified LTO tests are added in this PR:

  1. clang/test/CodeGen/asan-unified-lto.ll: add a RUN line to check the explicit Distinct LTO pipeline behavior for PS targets.
  2. clang/test/CodeGen/unified-lto-pipeline-ps.c: a new test for PS targets.

Full diff:https://github.com/llvm/llvm-project/pull/148229.diff

2 Files Affected:

  • (modified) clang/test/CodeGen/asan-unified-lto.ll (+1)
  • (added) clang/test/CodeGen/unified-lto-pipeline-ps.c (+33)
diff --git a/clang/test/CodeGen/asan-unified-lto.ll b/clang/test/CodeGen/asan-unified-lto.llindex 7b790d49e3fdb..21734e1fd8f67 100644--- a/clang/test/CodeGen/asan-unified-lto.ll+++ b/clang/test/CodeGen/asan-unified-lto.ll@@ -5,6 +5,7 @@  ; RUN: %clang_cc1 -emit-llvm-bc -O1 -flto -fsanitize=address -o - -x ir < %s | llvm-dis -o - | FileCheck %s ; RUN: %clang_cc1 -emit-llvm-bc -O1 -flto -funified-lto -fsanitize=address -o - -x ir < %s | llvm-dis -o - | FileCheck %s+; RUN: %clang_cc1 -emit-llvm-bc -O1 -flto -fno-unified-lto -fsanitize=address -o - -x ir < %s | llvm-dis -o - | FileCheck %s ; CHECK: @anon.3ee0898e5200a57350fed5485ae5d237  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"diff --git a/clang/test/CodeGen/unified-lto-pipeline-ps.c b/clang/test/CodeGen/unified-lto-pipeline-ps.cnew file mode 100644index 0000000000000..5849bf051dfec--- /dev/null+++ b/clang/test/CodeGen/unified-lto-pipeline-ps.c@@ -0,0 +1,33 @@+// RUN: %clang -flto=thin --target=x86_64-scei-ps4 -O2 -c %s -o %t.ps4.tu -Xclang -fdebug-pass-manager 2>%t.ps4.tu.txt+// RUN: %clang -flto=thin --target=x86_64-sie-ps5  -O2 -c %s -o %t.ps5.tu -Xclang -fdebug-pass-manager 2>%t.ps5.tu.txt+// RUN: %clang -flto=full --target=x86_64-scei-ps4 -O2 -c %s -o %t.ps4.fu -Xclang -fdebug-pass-manager 2>%t.ps4.fu.txt+// RUN: %clang -flto=full --target=x86_64-sie-ps5  -O2 -c %s -o %t.ps5.fu -Xclang -fdebug-pass-manager 2>%t.ps5.fu.txt+// RUN: %clang -flto=thin -fno-unified-lto --target=x86_64-scei-ps4 -O2 -c %s -o %t.ps4.tn -Xclang -fdebug-pass-manager 2>%t.ps4.tn.txt+// RUN: %clang -flto=full -fno-unified-lto --target=x86_64-scei-ps4 -O2 -c %s -o %t.ps4.fn -Xclang -fdebug-pass-manager 2>%t.ps4.fn.txt+// RUN: %clang -flto=thin --target=x86_64-unknown-linux -O2 -c %s -o %t.l.tn -Xclang -fdebug-pass-manager 2>%t.l.tn.txt+// RUN: %clang -flto=full --target=x86_64-unknown-linux -O2 -c %s -o %t.l.fn -Xclang -fdebug-pass-manager 2>%t.l.fn.txt+/// Pre-link bitcode and pass pipelines should be identical for (unified) thin/full on PS4/PS5.+/// Pipeline on PS5 is also identical (but bitcode won't be identical to PS4 due to the embedded triple).+// RUN: cmp %t.ps4.tu %t.ps4.fu+// RUN: cmp %t.ps5.tu %t.ps5.fu+// RUN: diff %t.ps4.tu.txt %t.ps4.fu.txt+// RUN: diff %t.ps4.tu.txt %t.ps5.tu.txt+// RUN: diff %t.ps5.tu.txt %t.ps5.fu.txt+// RUN: FileCheck --input-file %t.ps4.tu.txt %s+// CHECK: ThinLTOBitcodeWriterPass+/// Non-unified PS4/PS5 pass pipelines match Linux. Thin/full are different.+// RUN: not diff %t.ps4.tn.txt %t.ps4.fn.txt+// RUN: diff %t.ps4.tn.txt %t.l.tn.txt+// RUN: diff %t.ps4.fn.txt %t.l.fn.txt+/// PS4/PS5 unified use the full Linux pipeline (except ThinLTOBitcodeWriterPass vs BitcodeWriterPass).+// RUN: not diff -u %t.ps4.tu.txt %t.l.fn.txt | FileCheck %s --check-prefix=DIFF --implicit-check-not="{{^[-+!<>] }}"+// DIFF:      -Running pass: ThinLTOBitcodeWriterPass+// DIFF-NEXT: +Running pass: BitcodeWriterPass++int foo() {+  return 2 + 2;+}++int bar() {+  return foo() + 1;+}

@@ -0,0 +1,33 @@
// RUN: %clang -flto=thin --target=x86_64-scei-ps4 -O2 -c %s -o %t.ps4.tu -Xclang -fdebug-pass-manager 2>%t.ps4.tu.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

unified-lto-pipeline.c is present and serves the purpose. For target-generic codegen features, we usually test just one platform (it doesn't really scale if every platform that does no customization wants to add their own tests). If PS ever customizes the behavior, we can accept the new test.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thanks@MaskRay. Yes,unified-lto-pipeline.c serves the purpose. The initial test checked that pass pipeline for full is different from unified-lto. I added a newFileCheck for testing the different pass pipeline betweenfull-lto andunified-lto. In addition, I had removed theclang/test/CodeGen/unified-lto-pipeline-ps.c. Please see commit5b63ac5 for the details.

…ecking the different pipeline between full-lto and unified-lto.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@MaskRayMaskRayMaskRay left review comments

@ormrisormrisAwaiting requested review from ormris

@jmorsejmorseAwaiting requested review from jmorse

@wjristowwjristowAwaiting requested review from wjristow

@rlougherrlougherAwaiting requested review from rlougher

Assignees

@MaggieYingYiMaggieYingYi

Labels
clangClang issues not falling into any other category
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@MaggieYingYi@llvmbot@MaskRay

[8]ページ先頭

©2009-2025 Movatter.jp