Skip to content

Commit 8b8cd30

Browse files
authored
Fix wrapped value used in chain rule (rust-lang#732)
1 parent 969ddce commit 8b8cd30

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

enzyme/Enzyme/GradientUtils.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4248,8 +4248,9 @@ Value *GradientUtils::invertPointerM(Value *const oval, IRBuilder<> &BuilderM,
42484248
}
42494249
}
42504250
if (auto C = dyn_cast<Constant>(ip)) {
4251-
auto rule = [&](Value *ip) {
4252-
return ConstantExpr::getCast(arg->getOpcode(), C, arg->getType());
4251+
auto rule = [&arg](Value *ip) {
4252+
return ConstantExpr::getCast(arg->getOpcode(), cast<Constant>(ip),
4253+
arg->getType());
42534254
};
42544255

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

0 commit comments

Comments
 (0)