After llvm commit 1c3fcc8ae92ebfe9a9d1a21a288ad71ef7f98091
Author: Amy Kwan <amy.kw...@ibm.com>

    [libc++][NFC] Mark values in gdb pretty print comparison functions as live 
to prevent values being optimized out.

the following hot functions grew in size by more than 10% (but their benchmarks 
grew in size by less than 1%):
- 447.dealII,[.] contract<3>                                    grew in size by 
164%

Benchmark: 
Toolchain: Clang + Glibc + LLVM Linker
Version: all components were built from their latest release branch
Target: aarch64-linux-gnu
Compiler flags: -Oz
Hardware: APM Mustang 8x X-Gene1

This commit has regressed these CI configurations:
 - tcwg_bmk_llvm_apm/llvm-release-aarch64-spec2k6-Oz

First_bad build: 
https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-release-aarch64-spec2k6-Oz/6/artifact/artifacts/build-1c3fcc8ae92ebfe9a9d1a21a288ad71ef7f98091/
Last_good build: 
https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-release-aarch64-spec2k6-Oz/6/artifact/artifacts/build-c8905f1bb304f1cfe297312ae0dda9946cb27594/
Baseline build: 
https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-release-aarch64-spec2k6-Oz/6/artifact/artifacts/build-baseline/
Even more details: 
https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-release-aarch64-spec2k6-Oz/6/artifact/artifacts/

Reproduce builds:
<cut>
mkdir investigate-llvm-1c3fcc8ae92ebfe9a9d1a21a288ad71ef7f98091
cd investigate-llvm-1c3fcc8ae92ebfe9a9d1a21a288ad71ef7f98091

# Fetch scripts
git clone https://git.linaro.org/toolchain/jenkins-scripts

# Fetch manifests and test.sh script
mkdir -p artifacts/manifests
curl -o artifacts/manifests/build-baseline.sh 
https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-release-aarch64-spec2k6-Oz/6/artifact/artifacts/manifests/build-baseline.sh
 --fail
curl -o artifacts/manifests/build-parameters.sh 
https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-release-aarch64-spec2k6-Oz/6/artifact/artifacts/manifests/build-parameters.sh
 --fail
curl -o artifacts/test.sh 
https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-release-aarch64-spec2k6-Oz/6/artifact/artifacts/test.sh
 --fail
chmod +x artifacts/test.sh

# Reproduce the baseline build (build all pre-requisites)
./jenkins-scripts/tcwg_bmk-build.sh @@ artifacts/manifests/build-baseline.sh

# Save baseline build state (which is then restored in artifacts/test.sh)
mkdir -p ./bisect
rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ 
--exclude /llvm/ ./ ./bisect/baseline/

cd llvm

# Reproduce first_bad build
git checkout --detach 1c3fcc8ae92ebfe9a9d1a21a288ad71ef7f98091
../artifacts/test.sh

# Reproduce last_good build
git checkout --detach c8905f1bb304f1cfe297312ae0dda9946cb27594
../artifacts/test.sh

cd ..
</cut>

Full commit (up to 1000 lines):
<cut>
commit 1c3fcc8ae92ebfe9a9d1a21a288ad71ef7f98091
Author: Amy Kwan <amy.kw...@ibm.com>
Date:   Fri Sep 3 14:53:57 2021 -0400

    [libc++][NFC] Mark values in gdb pretty print comparison functions as live 
to prevent values being optimized out.
    
    It appears when testing LLVM 13 on Power, we run into failures with the
    `libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp` test case optimizing
    values out.
    
    Despite some the functions in the test already being marked with optnone,
    adding the `MarkAsLive()` calls inside of the pretty printer comparison 
functions
    resolves the issues of the values being optimized out.
    
    This patch aims to address https://llvm.org/PR51675.
    
    Differential Revision: https://reviews.llvm.org/D109204
    
    (cherry picked from commit 217c6d643124be312f4a99b203118744edb9d54c)
---
 libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp 
b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
index 2d8e9620089a..7c8d307d19fb 100644
--- a/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
+++ b/libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
@@ -92,24 +92,28 @@ void MarkAsLive(Type &&) {}
 template <typename TypeToPrint> void ComparePrettyPrintToChars(
     TypeToPrint value,
     const char *expectation) {
+  MarkAsLive(value);
   StopForDebugger(&value, &expectation);
 }
 
 template <typename TypeToPrint> void ComparePrettyPrintToRegex(
     TypeToPrint value,
     const char *expectation) {
+  MarkAsLive(value);
   StopForDebugger(&value, &expectation);
 }
 
 void CompareExpressionPrettyPrintToChars(
     std::string value,
     const char *expectation) {
+  MarkAsLive(value);
   StopForDebugger(&value, &expectation);
 }
 
 void CompareExpressionPrettyPrintToRegex(
     std::string value,
     const char *expectation) {
+  MarkAsLive(value);
   StopForDebugger(&value, &expectation);
 }
 
</cut>
_______________________________________________
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/linaro-toolchain

Reply via email to