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

why does inlining introduce a variable here? #6713

Closed
JeffBezanson opened this issue May 1, 2014 · 5 comments
Closed

why does inlining introduce a variable here? #6713

JeffBezanson opened this issue May 1, 2014 · 5 comments

Comments

@JeffBezanson
Copy link
Member

julia> code_typed(!=,((),()))
1-element Array{Any,1}:
 :($(Expr(:lambda, {:x,:y}, {{:_var0},{{:x,(),0},{:y,(),0},{:_var0,Bool,18}},{}}, :(begin  # operators.jl, line 27:
        _var0 = x::() == y::()::Bool
        return box(Bool,not_int(_var0::Bool))::Bool
    end::Bool))))

This seems pretty unnecessary. cc @vtjnash

@vtjnash
Copy link
Member

vtjnash commented May 2, 2014

i guess since == is not effect_free, it might be pessimistic and move it into an argument. I'm not sure why though

@JeffBezanson
Copy link
Member Author

Yeah that's pretty weird. There is only one occurrence. This is almost the simplest case possible.

@vtjnash
Copy link
Member

vtjnash commented May 3, 2014

box(XXX, ...) is not effect_free when XXX is a symbol. effect_free in inference.jl::1873 needs to return true if XXX is a symbol representing a global immutable constant (which unfortunately doesn't actually help here because Bool is mutable, but it is perhaps a step in the right direction)

@vtjnash
Copy link
Member

vtjnash commented Mar 25, 2016

not a bug

@vtjnash vtjnash closed this as completed Mar 25, 2016
@vtjnash
Copy link
Member

vtjnash commented Mar 25, 2016

julia> code_typed(!=, Tuple{Tuple{},Tuple{}})
1-element Array{Any,1}:
 LambdaInfo for !=
:(begin  # operators.jl, line 27:
        GenSym(0) = (_2::Tuple{} == _3::Tuple{})::Bool # bool.jl, line 16:
        return (Base.box)(Base.Bool,(Base.not_int)(GenSym(0)))
    end::Bool)

julia> code_llvm(!=, Tuple{Tuple{},Tuple{}})

define i1 @"julia_!=_32319"() {
top:
  %0 = call i1 @"julia_==_32320"()
  %1 = xor i1 %0, true
  ret i1 %1
}

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