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

Unoptimized code_typed differs if function is defined twice on nightly #52796

Closed
Zentrik opened this issue Jan 8, 2024 · 1 comment
Closed

Comments

@Zentrik
Copy link
Member

Zentrik commented Jan 8, 2024

julia> f(x) = Int(x)
f (generic function with 1 method)

julia> code_typed(f, (Int,); optimize=false)
1-element Vector{Any}:
 CodeInfo(
1%1 = Main.Int::Core.Const(Int64)
│   %2 = (%1)(x)::Int64
└──      return %2
) => Int64

julia> f(x) = Int(x)
f (generic function with 1 method)

julia> code_typed(f, (Int,); optimize=false)
1-element Vector{Any}:
 CodeInfo(
1%1 = Main.Int(x)::Int64
└──      return %1
) => Int64

Previous Julia versions seem to always return the second result.

julia> versioninfo()
Julia Version 1.11.0-DEV.1226
Commit 1d3dd859ff8 (2024-01-07 22:06 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × AMD Ryzen 7 1700 Eight-Core Processor
  WORD_SIZE: 64
  LLVM: libLLVM-15.0.7 (ORCJIT, znver1)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)

Not sure if this is considered a bug or not.

@vtjnash
Copy link
Member

vtjnash commented Jan 8, 2024

It is code_lowered that is different, and, no, optimizations are not considered a bug

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

No branches or pull requests

2 participants