Skip to content

const-prop regression for Float^Int #45949

@albheim

Description

@albheim

Mentioned this in #45656 as well as a little discussion on discord.

It seems like when doing exponentiation with Float^Int as literals, the compiler used to precalculate that in 1.7, but in 1.8 it does not do that anymore (except for some small values).

So an example that is around 5 times slower in 1.8.0-rc1 compared to 1.7.3 for me is

function f(x)
    A = 2.0^34
    A * x
end

where for 1.7.3 the llvm is simply

julia> @code_llvm debuginfo=:none f(2.0)
define double @julia_f_914(double %0) #0 {
top:
  %1 = fmul double %0, 0x4210000000000000
  ret double %1
}

and for 1.8.0-rc1

define double @julia_f_1270(double %0) #0 {
top:
  %1 = call double @j_pow_body_1272(double 2.000000e+00, i64 signext 34) #0
  %2 = fmul double %1, %0
  ret double %2
}

The changes seems to have been made since it made the calculation faster, but I feel like it should hopefully work to have it both fast and have the compiler able to precalculate on literals?

Metadata

Metadata

Assignees

Labels

performanceMust go fasterregressionRegression in behavior compared to a previous version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions