- Notifications
You must be signed in to change notification settings - Fork14.5k
[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
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
@llvm/pr-subscribers-clang Author: Ying Yi (MaggieYingYi) ChangesFor 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:
Full diff:https://github.com/llvm/llvm-project/pull/148229.diff 2 Files Affected:
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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: