Skip to content

Commit

Permalink
Fix wrapped value used in chain rule (rust-lang#732)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgymnich authored Jul 16, 2022
1 parent 969ddce commit 8b8cd30
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions enzyme/Enzyme/GradientUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4248,8 +4248,9 @@ Value *GradientUtils::invertPointerM(Value *const oval, IRBuilder<> &BuilderM,
}
}
if (auto C = dyn_cast<Constant>(ip)) {
auto rule = [&](Value *ip) {
return ConstantExpr::getCast(arg->getOpcode(), C, arg->getType());
auto rule = [&arg](Value *ip) {
return ConstantExpr::getCast(arg->getOpcode(), cast<Constant>(ip),
arg->getType());
};

return applyChainRule(arg->getType(), bb, rule, ip);
Expand Down

0 comments on commit 8b8cd30

Please sign in to comment.