File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -3432,19 +3432,21 @@ Function *EnzymeLogic::CreatePrimalAndGradient(
3432
3432
replacedReturns[orig] = si;
3433
3433
}
3434
3434
3435
- if (dretAlloca && !gutils->isConstantValue (orig->getReturnValue ())) {
3436
- rb.CreateStore (gutils->invertPointerM (orig->getReturnValue (), rb),
3437
- dretAlloca);
3438
- }
3439
- if (key.retType == DIFFE_TYPE::OUT_DIFF) {
3435
+ if (key.retType == DIFFE_TYPE::DUP_ARG ||
3436
+ key.retType == DIFFE_TYPE::DUP_NONEED) {
3437
+ if (dretAlloca) {
3438
+ rb.CreateStore (gutils->invertPointerM (orig->getReturnValue (), rb),
3439
+ dretAlloca);
3440
+ }
3441
+ } else if (key.retType == DIFFE_TYPE::OUT_DIFF) {
3440
3442
assert (orig->getReturnValue ());
3441
3443
assert (differetval);
3442
3444
if (!gutils->isConstantValue (orig->getReturnValue ())) {
3443
3445
IRBuilder<> reverseB (gutils->reverseBlocks [BB].back ());
3444
3446
gutils->setDiffe (orig->getReturnValue (), differetval, reverseB);
3445
3447
}
3446
3448
} else {
3447
- assert (retAlloca == nullptr );
3449
+ assert (dretAlloca == nullptr );
3448
3450
}
3449
3451
3450
3452
rb.CreateBr (gutils->reverseBlocks [BB].front ());
You can’t perform that action at this time.
0 commit comments