-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
[LLVM] Fix CodeGenLLVM::LinkParameters #8213
Conversation
kparzysz-quic
commented
Jun 8, 2021
- Generate valid LLVM IR.
- Set proper alignment on the constant variables.
- Generate valid LLVM IR. - Set proper alignment on the constant variables.
@kparzysz-quic : could you please describe what was the issue? And possibly scenario to reproduce the issue. Thanks! |
The generated LLVM IR was not valid: for example it had bitcasts between pointer and array types. |
Thanks for your response. Will it be possible for you to share one small snippets which will show LLVM IR before your change where the issue lies, and after your fix the resulting LLVM IR where the issue is resolved. TIA! |
If you use LLVM with assertions enabled, it will simply not allow you to create such a bitcast: attempt to do so will trigger an assertion. |
This is the assertion that I'm getting without this patch:
|
The above assertion is because the program tried to get a pointer to
|
Thanks a lot @kparzysz-quic for clarification 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for fixing this, @kparzysz-quic ! is it possible to add a unit test to demonstrate the incorrect usage?
The test |
I think I know what's going on: if you use LLVM that was compiled without assertions, it may not crash at the time of generating the LLVM IR. I guess that the generated LLVM IR ends up working correctly, at least in this case. I use LLVM with built-in assertions, so for me it crashes. I don't know if there is a reliable way to make the current code fail without using assertions in LLVM. |
@kparzysz-quic yeah i think you're right--we get LLVM from APT in the docker container, which i doubt has |
I've been using the entire clang toolchain built with assertions (the Release+Assertions build) in my daily work and I don't find it too slow. Frankly, I'm not sure if I could tell whether I'm running Release or Release+Assertions without some known references or comparing them side by side. I wouldn't be concerned at all about using such a build for CI. The slowness issue would definitely come up with a Debug build, which AFAIR is unoptimized. |
What else needs to be done for this PR? |
ok, just wanted to understand those points. it seems like we should modify our LLVM install to build with assertions on in at least one version in one container. that doesn't have to block this PR, though. could you just clarify your answer to the one question about GEP and we can merge? |
thanks @kparzysz-quic , the PR is now merged |
- Generate valid LLVM IR. - Set proper alignment on the constant variables.
- Generate valid LLVM IR. - Set proper alignment on the constant variables.