-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[LLVM] Automatically strip -fno-lifetime-dse
from compile_commands.json
#124623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ With the latest revision this PR passed the Python code formatter. |
LGTM, though I don't feel confident enough to accept. |
If I understand correctly, you are compiling LLVM with gcc, so the
Seems legitimate to me. I would want the file to accuratelty represent the command line the files were compiled with. |
…json Summary: This flag is always passed by LLVM to bypass some LTO related bug with GCC. The problem is that this is not supported by clang and shows up in the compile_commands.json file. That means it will always show at least one error complaining about this file. Since I already have a script to merge the runtimes stuff, just strip this out there for convenience. There was a discussion a long time ago about not adding this as a no-op flag to clang, so this is the next best thing.
I don't understand the issue, the
It sounds like you also end up with |
They're added by the LLVM build itself, you cannot turn them off. It was done in the past as a fix for some GNU LTO bug.
I suppose in my case I could just force building with system clang all the time instead, but it's annoying in general. |
I see, so if I understand correctly this has nothing to do with compilation database merging. Rather the issue is when we build with GCC, the LLVM build would set |
I believe that the past discussion is that we don't take as a ground to add an ignored option to clangDriver. clangDriver would become really messy if we add such GCC optimization specific options to Clang. Perhaps language servers could strict such -f options. Most don't change indexing or completion behaviors anyway. |
Just encountered the problem with |
Was there ever an issue to track the original bug that this flag works around? |
Ping. |
Ping |
1 similar comment
Ping |
@thesamesam Is it feasible to add -fno-lifetime-dse (currently for all GCC builds I don't think any developer uses GCC LTO for compile_commands.json. So preventing -fno-lifetime-dse for non-LTO gcc builds suffices. Then we don't need a change to this Python script. |
I would heavily prefer that solution. |
It's not ideal (as the issue could arise without LTO) but I'm fine with it as a compromise. It's also an easy thing for us to investigate if an issue pops up building with GCC again. |
Summary:
This flag is always passed by LLVM to bypass some LTO related bug with
GCC. The problem is that this is not supported by clang and shows up in
the compile_commands.json file. That means it will always show at least
one error complaining about this file. Since I already have a script to
merge the runtimes stuff, just strip this out there for convenience.
There was a discussion a long time ago about not adding this as a no-op
flag to clang, so this is the next best thing.