@@ -184,6 +184,22 @@ function tfunc(::Val{Core.Intrinsics.mul_float}, @nospecialize(a::Union{Const, T
184184 return Incidence (builtin_math_tfunc (Core. Intrinsics. mul_float, a. typ, b. typ), rrow)
185185end
186186
187+ function tfunc (:: Val{Core.Intrinsics.copysign_float} , @nospecialize (a:: Union{Const, Type{Float64}, Incidence} ), @nospecialize (b:: Union{Const, Type{Float64}, Incidence} ))
188+ if a === Float64 || b === Float64
189+ return Float64
190+ end
191+ if isa (a, Const) && isa (b, Const)
192+ return builtin_math_tfunc (Core. Intrinsics. copysign_float, a, b)
193+ end
194+ rrow = _zero_row ()
195+ arow = isa (a, Incidence) ? a. row : _ZERO_ROW
196+ brow = isa (b, Incidence) ? b. row : _ZERO_ROW
197+ for i in Iterators. flatten ((rowvals (arow), rowvals (brow)))
198+ rrow[i] = nonlinear
199+ end
200+ return Incidence (builtin_math_tfunc (Core. Intrinsics. copysign_float, widenconst (a), widenconst (b)), rrow)
201+ end
202+
187203function tfunc (:: Val{Core.Intrinsics.div_float} , @nospecialize (a:: Union{Const, Type{Float64}, Incidence} ), @nospecialize (b:: Union{Const, Type{Float64}, Incidence} ))
188204 if isa (a, Const) && isa (b, Const)
189205 return builtin_math_tfunc (Core. Intrinsics. div_float, a, b)
@@ -258,18 +274,19 @@ is_any_incidence(@nospecialize args...) = any(@nospecialize(x)->isa(x, Incidence
258274 b = argtypes[2 ]
259275 if is_any_incidence (a, b)
260276 if (f == Core. Intrinsics. add_float || f == Core. Intrinsics. sub_float) ||
261- (f == Core. Intrinsics. mul_float || f == Core. Intrinsics. div_float)
277+ (f == Core. Intrinsics. mul_float || f == Core. Intrinsics. div_float) ||
278+ f == Core. Intrinsics. copysign_float
262279 return tfunc (Val (f), a, b)
263280 elseif f == Core. Intrinsics. lt_float
264- r = tmerge (typeinf_lattice (interp), argtypes[1 ], argtypes[2 ])
281+ r = Compiler . tmerge (Compiler . typeinf_lattice (interp), argtypes[1 ], argtypes[2 ])
265282 @assert isa (r, Incidence)
266- return Incidence (Bool, r. row, r . eps )
283+ return Incidence (Bool, r. row)
267284 elseif f === Core. getfield && isa (a, Incidence)
268285 a = argtypes[1 ]
269- fT = getfield_tfunc (typeinf_lattice (interp), widenconst (a), argtypes[2 ])
286+ fT = Compiler . getfield_tfunc (Compiler . typeinf_lattice (interp), widenconst (a), argtypes[2 ])
270287 fT === Union{} && return Union{}
271288 Base. issingletontype (fT) && return fT
272- return Incidence (fT, copy (a. row), copy (a . eps) )
289+ return Incidence (fT, copy (a. row))
273290 end
274291 end
275292 elseif length (argtypes) == 3
@@ -297,7 +314,19 @@ is_any_incidence(@nospecialize args...) = any(@nospecialize(x)->isa(x, Incidence
297314 return c
298315 end
299316 end
300- # TODO : tmergea
317+ rt = Compiler. tmerge (Compiler. typeinf_lattice (interp), b, c)
318+ if isa (rt, Incidence)
319+ if isa (a, Incidence)
320+ rrow = copy (rt. row)
321+ for i in rowvals (a. row)
322+ rrow[i] = nonlinear
323+ end
324+ rt = Incidence (rt. typ, rrow)
325+ else
326+ rt = widenconst (rt)
327+ end
328+ end
329+ return rt
301330 end
302331 end
303332 end
0 commit comments