Skip to content
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

Building with -O2 -g leads to ICEs/crashes (inliner produces invalid debug info) #998

Closed
dnadlinger opened this issue Jul 12, 2015 · 0 comments

Comments

@dnadlinger
Copy link
Member

(I'm just entering this as an issue to keep track of it should it pop up again in the future.)

As can be seen e.g. in the output of https://travis-ci.org/ldc-developers/ldc/builds/66778227, at least with LLVM 3.6 having debug info and -O2 or -O3 enabled at the same time leads to crashes. This happens with many non-trivial D programs, not just with druntime/Phobos. I traced this down to an issue in the inliner. More specifically, it does not update the debug info of the inlined instructions from the callee if the call site in the caller does not have any debug info: https://github.com/llvm-mirror/llvm/blob/19ade095e8c3ea61f84b71074433309f0c7c7b3b/lib/Transforms/Utils/InlineFunction.cpp#L850. This leads to an assertion in the backend because it expects the scope part to refer to the current machine function.

I could not reproduce the issue in LLVM 3.7 so far, so I did not file an LLVM bug.

dnadlinger added a commit to dnadlinger/ldc that referenced this issue Jul 12, 2015
This is likely an LLVM bug: The code in InlineFunctions.cpp
only updates the source location metadata for the instructions
in the inlined callee when the call site has a source location
set. When the caller has no location metadata, the scope for
the inlined instructions thus still points to the DISubprogram
for the original callee. This then leads to an assertion during
codegen.

GitHub: Fixes ldc-developers#998.
dnadlinger added a commit to dnadlinger/ldc that referenced this issue Jul 12, 2015
This is likely an LLVM bug: The code in InlineFunctions.cpp
only updates the source location metadata for the instructions
in the inlined callee when the call site has a source location
set. When the caller has no location metadata, the scope for
the inlined instructions thus still points to the DISubprogram
for the original callee. This then leads to an assertion during
codegen.

GitHub: Fixes ldc-developers#998.
dnadlinger added a commit to dnadlinger/ldc that referenced this issue Jul 13, 2015
This is likely an LLVM bug: The code in InlineFunctions.cpp
only updates the source location metadata for the instructions
in the inlined callee when the call site has a source location
set. When the caller has no location metadata, the scope for
the inlined instructions thus still points to the DISubprogram
for the original callee. This then leads to an assertion during
codegen.

GitHub: Fixes ldc-developers#998.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant