Skip to content

Commit

Permalink
Remove unnecessary jl_array_del_end zero-set used memset error (#1643)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Jul 15, 2024
1 parent f16795c commit 3de5f61
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/rules/llvmrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -974,16 +974,22 @@ function jl_array_del_end_rev(B, orig, gutils, tape)
end
args = LLVM.Value[anti, offset]

found, arty = abs_typeof(origops[1])
anti = shadowin
elSize = get_array_elsz(B, anti)
elSize = LLVM.zext!(B, elSize, LLVM.IntType(8*sizeof(Csize_t)))
elSize = if found
LLVM.ConstantInt(Csize_t(sizeof(eltype(arty))))
else
elSize = LLVM.zext!(B, get_array_elsz(B, anti), LLVM.IntType(8*sizeof(Csize_t)))
end
len = get_array_len(B, anti)

LLVM.call!(B, fty, delF, args)

length = LLVM.mul!(B, len, elSize)

GPUCompiler.@safe_warn "TODO reverse jl_array_del_end zero-set used memset rather than runtime type of $(abs_typeof(origops[1])) in $(string(origops[1]))"
if !found && !(eltype(arty) <: Base.IEEEFloat)
GPUCompiler.@safe_warn "TODO reverse jl_array_del_end zero-set used memset rather than runtime type of $((found, arty)) in $(string(origops[1]))"
end
toset = get_array_data(B, anti)
toset = gep!(B, i8, toset, LLVM.Value[length])
LLVM.memset!(B, toset, LLVM.ConstantInt(i8, 0, false), elSize, algn)
Expand Down

2 comments on commit 3de5f61

@wsmoses
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/111079

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.12.23 -m "<description of version>" 3de5f617c980c976f333ddbfa7a1e478f46fb4cb
git push origin v0.12.23

Please sign in to comment.