[cmake] Disable GCC lifetime DSE
authorXi Ruoyao <xry111@xry111.site>
Sun, 14 May 2023 02:42:45 +0000 (03:42 +0100)
committerSam James <sam@gentoo.org>
Mon, 15 May 2023 03:34:51 +0000 (04:34 +0100)
commit47f5c54f997a59bb2c65abe6b8b811f6e7553456
treec54a18b1bf80d3a6e5e00512f91ec880395d01ef
parentbf76a6e44723b73940ca81c3b17077225b3c4118
[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.

The previous test issues are fixed by 626849c71e85d546a004cc91866beab610222194.

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