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

Inefficient codegen for unimported constructors from other modules #11997

Closed
simonster opened this issue Jul 3, 2015 · 0 comments
Closed

Inefficient codegen for unimported constructors from other modules #11997

simonster opened this issue Jul 3, 2015 · 0 comments
Assignees
Labels
kind:regression Regression in behavior compared to a previous version performance Must go faster

Comments

@simonster
Copy link
Member

I'm not sure if I should combine this with #10194, but the situation here is worse (we're using jl_apply_generic when we should just do this inline), and also a regression. On 8ad0c1c:

julia> module MyMod
       immutable Constructor; end
       end;

julia> f() = MyMod.Constructor();

julia> @code_llvm f()

define void @julia_f_21577() {
top:
  %0 = alloca [3 x %jl_value_t*], align 8
  %.sub = getelementptr inbounds [3 x %jl_value_t*]* %0, i64 0, i64 0
  %1 = getelementptr [3 x %jl_value_t*]* %0, i64 0, i64 2
  store %jl_value_t* inttoptr (i64 2 to %jl_value_t*), %jl_value_t** %.sub, align 8
  %2 = load %jl_value_t*** @jl_pgcstack, align 8
  %3 = getelementptr [3 x %jl_value_t*]* %0, i64 0, i64 1
  %.c = bitcast %jl_value_t** %2 to %jl_value_t*
  store %jl_value_t* %.c, %jl_value_t** %3, align 8
  store %jl_value_t** %.sub, %jl_value_t*** @jl_pgcstack, align 8
  store %jl_value_t* null, %jl_value_t** %1, align 8
  %4 = load %jl_value_t** inttoptr (i64 4661211688 to %jl_value_t**), align 8
  %5 = icmp eq %jl_value_t* %4, null
  br i1 %5, label %err, label %ok

err:                                              ; preds = %top
  call void @jl_undefined_var_error(%jl_value_t* inttoptr (i64 13212143952 to %jl_value_t*))
  unreachable

ok:                                               ; preds = %top
  store %jl_value_t* %4, %jl_value_t** %1, align 8
  %6 = call %jl_value_t* @jl_apply_generic(%jl_value_t* inttoptr (i64 4628914896 to %jl_value_t*), %jl_value_t** %1, i32 1)
  %7 = load %jl_value_t** %3, align 8
  %8 = getelementptr inbounds %jl_value_t* %7, i64 0, i32 0
  store %jl_value_t** %8, %jl_value_t*** @jl_pgcstack, align 8
  ret void
}

On 0.3:

julia> @code_llvm f()

define %jl_value_t* @julia_f_20275() {
top:
  ret %jl_value_t* inttoptr (i64 140463055669032 to %jl_value_t*), !dbg !682
}
@simonster simonster added performance Must go faster kind:regression Regression in behavior compared to a previous version labels Jul 3, 2015
@JeffBezanson JeffBezanson self-assigned this Jul 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:regression Regression in behavior compared to a previous version performance Must go faster
Projects
None yet
Development

No branches or pull requests

2 participants