Skip to content

Commit

Permalink
Unreachable dce workaround (#972)
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses authored Jul 31, 2023
1 parent 6692fad commit b35703b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9100,6 +9100,14 @@ function GPUCompiler.codegen(output::Symbol, job::CompilerJob{<:EnzymeTarget};
toremove = []
# Inline the wrapper
for f in functions(mod)
for b in blocks(f)
term = terminator(b)
if isa(term, LLVM.UnreachableInst)
b = IRBuilder()
position!(b, term)
emit_error(b, term, "Enzyme: The original primal code hits this error condition, thus differentiating it does not make sense")
end
end
if !any(map(k->kind(k)==kind(EnumAttribute("alwaysinline")), collect(function_attributes(f))))
continue
end
Expand Down

0 comments on commit b35703b

Please sign in to comment.