https://github.com/ilovepi updated 
https://github.com/llvm/llvm-project/pull/121820

>From 2035ab40f01fd10b91f48be9c921039fa12805c4 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulki...@google.com>
Date: Mon, 6 Jan 2025 11:15:42 -0800
Subject: [PATCH 1/4] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20to=20main=20this=20commit=20is=20based=20on?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.6-beta.1

[skip ci]
---
 libunwind/src/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index e7ea57734cca97..72dd3f5bca9960 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -20,7 +20,7 @@ set(LIBUNWIND_C_SOURCES
     )
 set_source_files_properties(${LIBUNWIND_C_SOURCES}
                             PROPERTIES
-                              COMPILE_FLAGS "-std=c99")
+                              COMPILE_FLAGS "-std=c99 -fexceptions")
 
 set(LIBUNWIND_ASM_SOURCES
     UnwindRegistersRestore.S

>From 2987f0889fef9ffc92bfcad57f91cb60007e8a23 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulki...@google.com>
Date: Tue, 7 Jan 2025 14:59:31 -0800
Subject: [PATCH 2/4] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20introduced=20through=20rebase?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.6-beta.1

[skip ci]
---
 libunwind/src/CMakeLists.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index 72dd3f5bca9960..602c99fe237b8e 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -20,6 +20,11 @@ set(LIBUNWIND_C_SOURCES
     )
 set_source_files_properties(${LIBUNWIND_C_SOURCES}
                             PROPERTIES
+                              # We need to set `-fexceptions` here so that key
+                              # unwinding functions, like
+                              # _UNWIND_RaiseExcpetion, are not marked as
+                              # `nounwind`, which breaks LTO builds of
+                              # libunwind.  See #56825 and #120657 for context.
                               COMPILE_FLAGS "-std=c99 -fexceptions")
 
 set(LIBUNWIND_ASM_SOURCES

>From 05bdf845b574b8808dc41d8217b34e5dcc33c0cb Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulki...@google.com>
Date: Fri, 10 Jan 2025 12:57:24 -0800
Subject: [PATCH 3/4] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20introduced=20through=20rebase?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.6-beta.1

[skip ci]
---
 .../lib/rtsan/tests/rtsan_test_functional.cpp       | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_functional.cpp 
b/compiler-rt/lib/rtsan/tests/rtsan_test_functional.cpp
index ef11b71f167e1b..40c4f3b129129d 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_functional.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_functional.cpp
@@ -145,13 +145,24 @@ TEST(TestRtsan, LaunchingAThreadDiesWhenRealtime) {
 
 namespace {
 void InvokeStdFunction(std::function<void()> &&function) { function(); }
+
+template <typename T>
+void HideMemoryFromCompiler(T* memory) {
+  // Pass the pointer to an empty assembly block as an input, and inform
+  // the compiler that memory is read to and possibly modified. This should not
+  // be architecture specific, since the asm block is empty.
+  __asm__ __volatile__("" ::"r"(memory) : "memory");
+}
 } // namespace
 
 TEST(TestRtsan, CopyingALambdaWithLargeCaptureDiesWhenRealtime) {
   std::array<float, 16> lots_of_data;
   auto LargeLambda = [lots_of_data]() mutable {
-    // Stop everything getting optimised out
     lots_of_data[3] = 0.25f;
+    // In LTO builds, this lambda can be optimized away, since the compiler can
+    // see through the memory accesses after inlining across TUs. Ensure it can
+    // no longer reason about the memory access, so that won't happen.
+    HideMemoryFromCompiler(&lots_of_data[3]);
     EXPECT_EQ(16u, lots_of_data.size());
     EXPECT_EQ(0.25f, lots_of_data[3]);
   };

>From ec836854ddb687efcc03bd82f640b3ef3b52601f Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulki...@google.com>
Date: Fri, 10 Jan 2025 13:04:25 -0800
Subject: [PATCH 4/4] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20ch?=
 =?UTF-8?q?anges=20introduced=20through=20rebase?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.6-beta.1

[skip ci]
---
 compiler-rt/lib/rtsan/tests/rtsan_test_functional.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/compiler-rt/lib/rtsan/tests/rtsan_test_functional.cpp 
b/compiler-rt/lib/rtsan/tests/rtsan_test_functional.cpp
index 40c4f3b129129d..e05d7ae78b5d99 100644
--- a/compiler-rt/lib/rtsan/tests/rtsan_test_functional.cpp
+++ b/compiler-rt/lib/rtsan/tests/rtsan_test_functional.cpp
@@ -146,8 +146,7 @@ TEST(TestRtsan, LaunchingAThreadDiesWhenRealtime) {
 namespace {
 void InvokeStdFunction(std::function<void()> &&function) { function(); }
 
-template <typename T>
-void HideMemoryFromCompiler(T* memory) {
+template <typename T> void HideMemoryFromCompiler(T *memory) {
   // Pass the pointer to an empty assembly block as an input, and inform
   // the compiler that memory is read to and possibly modified. This should not
   // be architecture specific, since the asm block is empty.

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to