Uh oh!
There was an error while loading. Please reload this page.
[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.
ANSHUMAN87
commented
Jun 8, 2021
@kparzysz-quic : could you please describe what was the issue? And possibly scenario to reproduce the issue. Thanks! |
kparzysz-quic
commented
Jun 8, 2021
The generated LLVM IR was not valid: for example it had bitcasts between pointer and array types. |
ANSHUMAN87
commented
Jun 8, 2021
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! |
kparzysz-quic
commented
Jun 8, 2021
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. |
kparzysz-quic
commented
Jun 8, 2021
This is the assertion that I'm getting without this patch: |
kparzysz-quic
commented
Jun 8, 2021
The above assertion is because the program tried to get a pointer to |
ANSHUMAN87
commented
Jun 8, 2021
Thanks a lot @kparzysz-quic for clarification 👍 |
areusch
left a comment
There was a problem hiding this comment.
thanks for fixing this, @kparzysz-quic ! is it possible to add a unit test to demonstrate the incorrect usage?
Uh oh!
There was an error while loading. Please reload this page.
kparzysz-quic
commented
Jun 8, 2021
The test |
kparzysz-quic
commented
Jun 8, 2021
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. |
areusch
commented
Jun 9, 2021
@kparzysz-quic yeah i think you're right--we get LLVM from APT in the docker container, which i doubt has |
kparzysz-quic
commented
Jun 9, 2021
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. |
kparzysz-quic
commented
Jun 10, 2021
What else needs to be done for this PR? |
areusch
commented
Jun 10, 2021
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? |
areusch
commented
Jun 10, 2021
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.