[cmake] Disable GCC lifetime DSE
authorSam James <sam@gentoo.org>
Sat, 13 May 2023 19:34:05 +0000 (20:34 +0100)
committerSam James <sam@gentoo.org>
Sat, 13 May 2023 19:34:05 +0000 (20:34 +0100)
commit94f7c961c78d8fdbc05898cfbbf88094de45c1ad
treeff64d5cfde96704a8bcde6ae0b3d5e0e58dc8592
parent76b2915fdbbba18693c9aabda419768f41106f31
[cmake] Disable GCC lifetime DSE

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 issues are fixed, we need to disable dead store eliminations
eliminations based on object lifetime.

Bug: https://github.com/llvm/llvm-project/issues/24952
Bug: https://github.com/llvm/llvm-project/issues/57740
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106943
Reviewed By: MaskRay, thesamesam, nikic

Differential Revision: https://reviews.llvm.org/D150505
llvm/cmake/modules/HandleLLVMOptions.cmake