Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,23 @@ function julia_sanitize(
bad = BasicBlock(fn, "bad")
position!(builder, entry)
inp, sval = collect(parameters(fn))
cmp = fcmp!(builder, LLVM.API.LLVMRealUNO, inp, inp)
cmp = nothing
@show value_type(inp), isa(value_type(inp), LLVM.ArrayType)

if isa(value_type(inp), LLVM.ArrayType)
nelem = length(value_type(inp))
for i in 1:nelem
e0 = extract_value!(builder, inp, i - 1)
cmp0 = fcmp!(builder, LLVM.API.LLVMRealUNO, e0, e0)
if cmp == nothing
cmp = cmp0
else
cmp = or!(builder, cmp, cmp0)
end
end
else
cmp = fcmp!(builder, LLVM.API.LLVMRealUNO, inp, inp)
end

br!(builder, cmp, bad, good)

Expand All @@ -1459,6 +1475,17 @@ function julia_sanitize(
unreachable!(builder)
dispose(builder)
end
if LLVM.API.LLVMVerifyFunction(fn, LLVM.API.LLVMReturnStatusAction) != 0
msg = sprint() do io
println(
io,
LLVM.API.LLVMVerifyFunction(fn, LLVM.API.LLVMPrintMessageAction),
)
println(io, string(fn))
println(io, "Broken julia.sanitize")
end
throw(LLVM.LLVMException(msg))
end
end
# val =
call!(B, FT, fn, LLVM.Value[val, globalstring_ptr!(B, stringv)])
Expand Down
1 change: 1 addition & 0 deletions test/integration/Comrade/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using LinearAlgebra

using Test

Enzyme.Compiler.CheckNan[] = true

const ComradePATH = joinpath(dirname(pathof(Comrade)), "..", "examples", "Data")
const dataurl = "https://de.cyverse.org/anon-files/iplant/home/shared/commons_repo/curated/EHTC_M87pol2017_Nov2023/hops_data/April11/SR2_M87_2017_101_lo_hops_ALMArot.uvfits"
Expand Down
Loading