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: fix bad declaration of memcmp stdlib function signature #34792

Merged
merged 1 commit into from
Feb 19, 2020

Conversation

vtjnash
Copy link
Sponsor Member

@vtjnash vtjnash commented Feb 17, 2020

We were lying to LLVM, and it now catches that in the verifier. Stop
lying to LLVM so that it will again be happy to generate good code for
us (e.g. optimizing this to bcmp).

Aside: the code we emit for the failing test was quite bad. Also, it's worthwhile taking a look at how we handle a slight variation on the original test:

julia> struct LargeStruct
           x::NTuple{1024,Int8}
           LargeStruct() = new()
       end
julia> const large_struct = LargeStruct()
julia> @noinline create_large_struct() = Base.inferencebarrier(large_struct)
julia> function compare_large_struct(a)
           a = a::LargeStruct
           b = create_large_struct()::LargeStruct
           GC.gc() # compare with and without this barrier
           return a === b
       end
julia> code_llvm(compare_large_struct, Tuple{Any}, optimize=false)
julia> code_llvm(compare_large_struct, Tuple{Any}, optimize=true)

We were lying to LLVM, and it now catches that in the verifier. Stop
lying to LLVM so that it will again be happy to generate good code for
us (e.g. optimizing this to bcmp).
@JeffBezanson JeffBezanson merged commit d634f73 into master Feb 19, 2020
@JeffBezanson JeffBezanson deleted the jn/codegen-bad-memcmp branch February 19, 2020 18:43
KristofferC pushed a commit that referenced this pull request Feb 19, 2020
)

We were lying to LLVM, and it now catches that in the verifier. Stop
lying to LLVM so that it will again be happy to generate good code for
us (e.g. optimizing this to bcmp).

(cherry picked from commit d634f73)
@KristofferC KristofferC mentioned this pull request Feb 19, 2020
26 tasks
birm pushed a commit to birm/julia that referenced this pull request Feb 22, 2020
…iaLang#34792)

We were lying to LLVM, and it now catches that in the verifier. Stop
lying to LLVM so that it will again be happy to generate good code for
us (e.g. optimizing this to bcmp).
KristofferC pushed a commit that referenced this pull request Apr 11, 2020
)

We were lying to LLVM, and it now catches that in the verifier. Stop
lying to LLVM so that it will again be happy to generate good code for
us (e.g. optimizing this to bcmp).
BioTurboNick pushed a commit to BioTurboNick/julia that referenced this pull request Apr 13, 2020
…iaLang#34792)

We were lying to LLVM, and it now catches that in the verifier. Stop
lying to LLVM so that it will again be happy to generate good code for
us (e.g. optimizing this to bcmp).

(cherry picked from commit d634f73)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants