Skip to content

Commit 6ac6312

Browse files
authored
[LLVM] Only enable -fno-lifetime-dse in LTO mode (#131381)
Summary: Always passing this option is problematic since it is not supported by `clang.` this leads to conflicts when using extra CMake tools like `compile-commands` or `include-what-you-use`. This mainly works around a bug that showed up during the LTO build. Theoretically this can show up without LTO, but it's likely to work. This can be removed once #24952 is resolved.
1 parent 78f74f6 commit 6ac6312

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
688688
append("-Werror=unguarded-availability-new" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
689689
endif()
690690

691-
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
691+
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND LLVM_ENABLE_LTO)
692692
# LLVM data structures like llvm::User and llvm::MDNode rely on
693693
# the value of object storage persisting beyond the lifetime of the
694694
# object (#24952). This is not standard compliant and causes a runtime

0 commit comments

Comments
 (0)