This is an archive of the discontinued LLVM Phabricator instance.

[cmake] Disable GCC lifetime DSE
AbandonedPublic

Authored by xry111 on May 14 2023, 5:05 AM.

Details

Summary

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 version (D150505) also exploited an issue in the
clang-tidy test suite. The test trivially-destructible.cpp is filtered
into a temporary file, and when clang-tidy operates on the file, the
compile_commands.json file in the build directory will be read and
the compiler options in it will be used. If LLVM is not built with Clang,
some of the options may be unsupported, causing a test failure. Fix
it by adding "-p %s" into the test command to force clang-tidy to
search the compiler option DB file in the source directory, where there
is none.

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

Diff Detail

Event Timeline

xry111 created this revision.May 14 2023, 5:05 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 14 2023, 5:05 AM
xry111 requested review of this revision.May 14 2023, 5:05 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMay 14 2023, 5:05 AM
xry111 edited the summary of this revision. (Show Details)May 14 2023, 5:07 AM
xbolva00 accepted this revision.May 14 2023, 5:22 AM
This revision is now accepted and ready to land.May 14 2023, 5:22 AM
MaskRay requested changes to this revision.May 14 2023, 12:02 PM

I think the correct fix for trivially-destructible.cpp is to append --. No -p or comment is needed.

This revision now requires changes to proceed.May 14 2023, 12:02 PM
xry111 abandoned this revision.May 14 2023, 8:23 PM