[PATCH] D150505: [cmake] Disable GCC lifetime DSE
Xi Ruoyao via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 13 11:08:01 PDT 2023
xry111 updated this revision to Diff 521934.
xry111 edited the summary of this revision.
xry111 added a comment.
Update comment and commit message to fix grammar errors according to suggestion from @nikic.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150505/new/
https://reviews.llvm.org/D150505
Files:
llvm/cmake/modules/HandleLLVMOptions.cmake
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -594,6 +594,16 @@
add_flag_if_supported("-Werror=unguarded-availability-new" WERROR_UNGUARDED_AVAILABILITY_NEW)
endif( LLVM_COMPILER_IS_GCC_COMPATIBLE OR CMAKE_CXX_COMPILER_ID MATCHES "XL" )
+if ( LLVM_COMPILER_IS_GCC_COMPATIBLE )
+ # 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.
+ add_flag_if_supported("-fno-lifetime-dse" CMAKE_CXX_FLAGS)
+endif ( LLVM_COMPILER_IS_GCC_COMPATIBLE )
+
# Modules enablement for GCC-compatible compilers:
if ( LLVM_COMPILER_IS_GCC_COMPATIBLE AND LLVM_ENABLE_MODULES )
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150505.521934.patch
Type: text/x-patch
Size: 1116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230513/5caac252/attachment.bin>
More information about the llvm-commits
mailing list