julia
95e2deb2 - wip: inference: implement numeric interval analysis

Commit
2 years ago
wip: inference: implement numeric interval analysis This commit is an attempt to make the inference reason about numeric intervals. One of its goals is to fold out the following kind of case: ```julia julia> code_typed((Int32,)) do x # we know this condition never holds because `x::Int32` if x == typemax(Int) return nothing end return 0 end 1-element Vector{Any}: CodeInfo( 1 ─ nothing::Nothing └── return 0 ) => Int64 ``` It would eventually allow us to eliminate unnecessary branches and prove the `:nothrow`-ness of `::UInt32 >> ::Int32` for example (thus fixing #47835). There are many possible improvements, such as proving that we will never reach the `return nothing` case in the following example (i.e. by integrating with `Conditional`-lattice): ```julia julia> code_typed((Int,)) do x if x < 3 if x > 5 return nothing end end 0 end ``` This may come with some compilation performance cost. We should run the benchmark and try to minimize latency cost.
Author
Committer
Parents
Loading