[PATCH] D150930: [Driver] Accept and ignore -fno-lifetime-dse argument
Bruno De Fraine via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 16 06:45:40 PST 2023
brunodf added a comment.
Hi,
I found this review request and I just want to comment that I find it strange that it was rejected.
@MaskRay I understand that using a compile_commands.json configured for gcc with clang-based tools is not a supported use case, but still the clang driver was explicitly designed to emulate gcc: "The clang tool is the compiler driver and front-end, which is designed to be a drop-in replacement for the gcc command" and "The 'clang' driver is designed to work as closely to GCC as possible to maximize portability." are quotes from https://clang.llvm.org/get_started.html
In that regard, `clang_ignored_gcc_optimization_f_Group` is logical and it includes many options that you cite like `-falign-jumps=`, `-falign-loops=`, `-fmerge-constants`, `-fschedule-insns`, etc.
Sure, more projects support clang directly now, but I was not aware there is a change in this policy, or that there is a "stop" on adding more options (in that case, it would be consistent that the documentation is adapted to say that clang is only drop-in compatible with some historic version of gcc).
In my view, the main objection to "accept and ignore" a GCC option is when the option provides some guarantees that clang/LLVM cannot uphold. For example, ignoring `-fno-strict-aliasing` would be dangerous if you actually carry out type-based aliasing optimizations, because programs that compile with it likely contain violations of the strict aliasing rules. It seems that `-fno-lifetime-dse` similarly intends to allow violating a language rule. I'm not aware if clang/LLVM contains optimization that exploit this language rule (since the option appears in the context of the LLVM code base itself, and because compiling this code base with clang itself is well tested in many configurations, I suspect not), but if it does (now or in the future), ignoring this option is dangerous.
Regards,
Bruno
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150930/new/
https://reviews.llvm.org/D150930
More information about the cfe-commits
mailing list