Mesa (master): meson: Disable GCC's dead store elimination for memory zeroing custom new
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu May 21 10:55:35 UTC 2020
Module: Mesa
Branch: master
Commit: 5500a2b7fc558217bbd4c2a966ab6fcadaed8b3b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5500a2b7fc558217bbd4c2a966ab6fcadaed8b3b
Author: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Date: Tue May 19 20:35:49 2020 +0300
meson: Disable GCC's dead store elimination for memory zeroing custom new
Some classes use custom new operator which zeroes memory, however gcc does
aggressive dead-store elimination which threats all writes to the memory
before the constructor as "dead stores".
For now we disable this optimization.
The new operators in question are declared via:
DECLARE_RZALLOC_CXX_OPERATORS
DECLARE_LINEAR_ZALLOC_CXX_OPERATORS
The issue was found with lto builds, however there is no guarantee that
it didn't happen with ordinary ones.
CC: <mesa-stable at lists.freedesktop.org>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2977
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/1358
Signed-off-by: Danylo Piliaiev <danylo.piliaiev at globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5104>
---
meson.build | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/meson.build b/meson.build
index 1a207842c55..3d4ea165c99 100644
--- a/meson.build
+++ b/meson.build
@@ -980,6 +980,11 @@ else
'-fno-math-errno',
'-fno-trapping-math',
'-Qunused-arguments',
+ # Some classes use custom new operator which zeroes memory, however
+ # gcc does aggressive dead-store elimination which threats all writes
+ # to the memory before the constructor as "dead stores".
+ # For now we disable this optimization.
+ '-flifetime-dse=1',
]
# MinGW chokes on format specifiers and I can't get it all working
if not (cc.get_id() == 'gcc' and host_machine.system() == 'windows')
More information about the mesa-commit
mailing list