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

Codegen issue with lto and panic=abort #39455

Closed
jrmuizel opened this issue Feb 2, 2017 · 6 comments
Closed

Codegen issue with lto and panic=abort #39455

jrmuizel opened this issue Feb 2, 2017 · 6 comments

Comments

@jrmuizel
Copy link
Contributor

jrmuizel commented Feb 2, 2017

I'm seeing what looks like a codegen/llvm issue in webrender/gecko.

It seems like we're dropping ApiMsg::AddRawFont after running the Err() case here:
https://github.com/servo/webrender/blob/456f87056e62f437f543f45cc4fbd713c26660e7/webrender/src/render_backend.rs#L346

Removing the LLVMRustMarkAllFunctionsNounwind pass from lto.rs avoids the problem.

I'm going to try to narrow it down more tomorrow. It'd be nice to do this with llvm's bugpoint tool but I'm not sure of how to use it to replicate this issue.

@jrmuizel
Copy link
Contributor Author

jrmuizel commented Feb 2, 2017

It looks like it's the interaction between LLVMRustMarkAllFunctionsNounwind and createCFGSimplificationPass() https://github.com/rust-lang/llvm/blob/ceb177eeefa7d67ca29230d2e7e8584f97d4fdad/lib/Transforms/IPO/PassManagerBuilder.cpp#L761

@jrmuizel
Copy link
Contributor Author

jrmuizel commented Feb 3, 2017

Now that I can produce that is largely the same except for LLVMRustMarkAllFunctionsNounwind and CFGSimplification I'm going to try reproducing the problem in rr again and see if I can figure out where the control flow diverges. Hopefully that will give a better picture of what's going wrong.

@jrmuizel
Copy link
Contributor Author

jrmuizel commented Feb 3, 2017

So I ran the two replays side by side. I noticed a divergence where the broken one was writing to stack location that looks to be used a type tag (the bad value causes the crash) and the working one is not writing to that same location. The writing happens around rust/src/libstd/sync/mpsc/shared.rs:251 which feels a bit weird.

Given the manifestation of the bug it feels like the problem could be happening during actual backend code-gen and not during ir optimization.

@jrmuizel
Copy link
Contributor Author

jrmuizel commented Feb 4, 2017

Further investigation and a good guess revealed that is triggered during stack coloring. i.e. setting -no-stack-coloring makes the problem go away. My guess is that there's something going wrong with the lifetime annotations. Either wrong from the beginning or going wrong during CGFSimplication.

@jrmuizel
Copy link
Contributor Author

jrmuizel commented Feb 7, 2017

It looks like MachineFrameInfo::print will be valuable in getting information on what's going on here. I'll try to get that today.

@jrmuizel
Copy link
Contributor Author

This was fixed by #38669

@jrmuizel jrmuizel reopened this Apr 18, 2017
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