[llvm-branch-commits] [libcxx] 1c3fcc8 - [libc++][NFC] Mark values in gdb pretty print comparison functions as live to prevent values being optimized out.

Louis Dionne via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Sep 3 11:56:29 PDT 2021


Author: Amy Kwan
Date: 2021-09-03T14:56:19-04:00
New Revision: 1c3fcc8ae92ebfe9a9d1a21a288ad71ef7f98091

URL: https://github.com/llvm/llvm-project/commit/1c3fcc8ae92ebfe9a9d1a21a288ad71ef7f98091
DIFF: https://github.com/llvm/llvm-project/commit/1c3fcc8ae92ebfe9a9d1a21a288ad71ef7f98091.diff

LOG: [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)

Added: 
    

Modified: 
    libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp

Removed: 
    


################################################################################
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 2d8e9620089a4..7c8d307d19fb4 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);
 }
 


        


More information about the llvm-branch-commits mailing list