[llvm] [llvm][CMake] Remove -fno-lifetime-dse (PR #173322)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 22 17:01:26 PST 2025
https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/173322
Now that #24952 has been fixed by #170575, we no longer need to specify
-fno-lifetime-dse when building with gcc.
>From 185223398b0921ac9247221b13744e036a771034 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Tue, 23 Dec 2025 00:57:56 +0000
Subject: [PATCH] [llvm][CMake] Remove -fno-lifetime-dse
Now that #24952 has been fixed by #170575, we no longer need to specify
-fno-lifetime-dse when building with gcc.
---
llvm/cmake/modules/HandleLLVMOptions.cmake | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 2d78626d953c9..182c4a7074a30 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -713,16 +713,6 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
append("-Werror=unguarded-availability-new" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
-if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND LLVM_ENABLE_LTO)
- # LLVM data structures like llvm::User and llvm::MDNode rely on
- # the value of object storage persisting beyond the lifetime of the
- # object (#24952). This is not standard compliant and causes a runtime
- # crash if LLVM is built with GCC and LTO enabled (#57740). Until
- # these bugs are fixed, we need to disable dead store eliminations
- # based on object lifetime.
- append("-fno-lifetime-dse" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
-endif ()
-
# Modules enablement for GCC-compatible compilers:
if ( LLVM_COMPILER_IS_GCC_COMPATIBLE AND LLVM_ENABLE_MODULES )
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
More information about the llvm-commits
mailing list