Skip to content

Construct constant LLVMPtr correctly #38958

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

Merged
merged 1 commit into from
Dec 25, 2020
Merged

Construct constant LLVMPtr correctly #38958

merged 1 commit into from
Dec 25, 2020

Conversation

vchuravy
Copy link
Member

fixes #38864

Co-authored-by: Julian Samaroo <jpsamaroo@jpsamaroo.me>
@vchuravy vchuravy added backport 1.6 Change should be backported to release-1.6 compiler:codegen Generation of LLVM IR and native code labels Dec 21, 2020
@vtjnash
Copy link
Member

vtjnash commented Dec 21, 2020

I thought this was semantically invalid in LLVM IR to form an LLVMPtr from a constant / inttoptr / reinterpret / bitcast, as it has incorrect provenance (compiler optimization behaviors). For related reading, see the recent blog post: https://www.ralfj.de/blog/2020/12/14/provenance.html

@vchuravy
Copy link
Member Author

IIUC it is legal to use a constant/inttoptr to form a LLVMPtr, as an example see the discussion in http://llvm.org/devmtg/2018-04/slides/Lopes-Sbirlea-Pointers,%20Alias%20and%20ModRef%20Analyses.pdf that differentiates between physical and logical pointers.

@vtjnash
Copy link
Member

vtjnash commented Dec 23, 2020

Ah, okay, that makes sense. So it's legal to form it, and use in comparisons, you're just responsible for not dereferencing it, since it might be assumed no-alias with other memory.

@Keno Keno merged commit ec386bd into master Dec 25, 2020
@Keno Keno deleted the vc/llvm_ptr branch December 25, 2020 02:04
KristofferC pushed a commit that referenced this pull request Dec 27, 2020
Co-authored-by: Julian Samaroo <jpsamaroo@jpsamaroo.me>

Co-authored-by: Julian Samaroo <jpsamaroo@jpsamaroo.me>
(cherry picked from commit ec386bd)
@KristofferC KristofferC mentioned this pull request Dec 27, 2020
26 tasks
@KristofferC KristofferC removed the backport 1.6 Change should be backported to release-1.6 label Jan 6, 2021
staticfloat pushed a commit that referenced this pull request Jan 15, 2021
Co-authored-by: Julian Samaroo <jpsamaroo@jpsamaroo.me>

Co-authored-by: Julian Samaroo <jpsamaroo@jpsamaroo.me>
(cherry picked from commit ec386bd)
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
Co-authored-by: Julian Samaroo <jpsamaroo@jpsamaroo.me>

Co-authored-by: Julian Samaroo <jpsamaroo@jpsamaroo.me>
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
Co-authored-by: Julian Samaroo <jpsamaroo@jpsamaroo.me>

Co-authored-by: Julian Samaroo <jpsamaroo@jpsamaroo.me>
(cherry picked from commit ec386bd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:codegen Generation of LLVM IR and native code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assertion in constructing struct with null Core.LLVMPtr field
4 participants