Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Nov 29, 2024
1 parent 714e39a commit 96388f9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/errors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@ function julia_error(
B::LLVM.API.LLVMBuilderRef,
)::LLVM.API.LLVMValueRef
msg = Base.unsafe_string(cstr)
julia_error(msg, val, errtype, data, data2, B)
end

function julia_error(
msg::String,
val::LLVM.API.LLVMValueRef,
errtype::API.ErrorType,
data::Ptr{Cvoid},
data2::LLVM.API.LLVMValueRef,
B::LLVM.API.LLVMBuilderRef,
)::LLVM.API.LLVMValueRef
bt = nothing
ir = nothing
if val != C_NULL
Expand Down
9 changes: 7 additions & 2 deletions src/rules/typeunstablerules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1535,8 +1535,13 @@ end
end
origops = collect(operands(orig))
width = get_width(gutils)
if !is_constant_value(gutils, origops[1])
shadowin = invert_pointer(gutils, origops[1], B)
if !is_constant_value(gutils, origops[1]) || !get_runtime_activity(gutils)
shadowin = if !is_constant_value(gutils, origops[1])
invert_pointer(gutils, origops[1], B)
else
estr = "Mismatched activity for: " * string(orig) * " const input " *string(origops[1]) * ", differentiable return"
LLVM.Value(julia_error(estr, orig.ref, API.ET_MixedActivityError, gutils.ref, origops[1].ref, B.ref))
end
if width == 1
args = LLVM.Value[
shadowin
Expand Down

0 comments on commit 96388f9

Please sign in to comment.