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: sizeof optimizations #24129

Merged
merged 1 commit into from
Jul 12, 2018
Merged

codegen: sizeof optimizations #24129

merged 1 commit into from
Jul 12, 2018

Conversation

vtjnash
Copy link
Member

@vtjnash vtjnash commented Oct 13, 2017

jl_datatype_size is rounded up to the allocation size, however, many allocations in llvm are instead shrink-wrapped to the actual size of the data

For loading data, this is perhaps overly conservative (valgrind might disagree, but dereferencing the trailing bytes should be inbounds as far as the page table is concerned), but for writing alloca slots, we may have been stomping on our stack before.

EDIT: I've effectively stolen this PR and repurposed it to apply more metadata attributes instead. The bugfixes I thought I was chasing before were due to an incorrect Type (which had an actual wrong size).

@ararslan ararslan added the compiler:codegen Generation of LLVM IR and native code label Oct 13, 2017
@ararslan ararslan requested a review from yuyichao October 13, 2017 19:40
@vtjnash vtjnash requested a review from vchuravy October 16, 2017 18:21
Like with Arguments attributes, the dereferenceable metadata on a Load
also requires knowing the eltype size of the loaded pointer.

Also add a few more attributes for known properties
and some other small code improvements.
@vtjnash vtjnash force-pushed the jn/codegen-sizeof branch from 05bc1b7 to fc5ee7a Compare July 10, 2018 18:40
@vtjnash vtjnash changed the title codegen: many sizeof computation fixes codegen: sizeof optimizations Jul 10, 2018
@vtjnash
Copy link
Member Author

vtjnash commented Jul 10, 2018

Repurposed this PR to provide LLVM more general sizeof and alignof optimization opportunities (extension of #27945).

@vtjnash
Copy link
Member Author

vtjnash commented Jul 10, 2018

@nanosoldier runbenchmarks(ALL, vs = ":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

@vtjnash vtjnash merged commit b0f531e into master Jul 12, 2018
@vtjnash vtjnash deleted the jn/codegen-sizeof branch July 12, 2018 15:33
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.

4 participants