Skip to content

Commit

Permalink
Fix diffuse rooting (#1829)
Browse files Browse the repository at this point in the history
* add comment

* fix
  • Loading branch information
wsmoses authored Sep 15, 2024
1 parent afedaac commit 9ff4568
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/rules/customrules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,22 @@ end
if is_constant_value(gutils, orig) && is_constant_inst(gutils, orig) && !has_aug_fwd_rule(orig, gutils)
return (false, true)
end
non_rooting_use = false
fop = called_operand(orig)::LLVM.Function
for (i, v) in enumerate(operands(orig)[1:end-1])
if v == val
if !any(a->kind(a) == kind(StringAttribute("enzymejl_returnRoots")), collect(parameter_attributes(fop, i)))
non_rooting_use = true
break
end
end
end

# If the operand is just rooting, we don't need it and should override defaults
if !non_rooting_use
return (false, false)
end

# don't use default and always require the arg
return (true, false)
end

0 comments on commit 9ff4568

Please sign in to comment.