@@ -562,7 +562,7 @@ class PullbackCloner::Implementation final
562
562
// /
563
563
// / This method first tries to find an existing entry in the adjoint buffer
564
564
// / mapping. If no entry exists, creates a zero adjoint buffer.
565
- SILValue & getAdjointBuffer (SILBasicBlock *origBB, SILValue originalValue) {
565
+ SILValue getAdjointBuffer (SILBasicBlock *origBB, SILValue originalValue) {
566
566
assert (getTangentValueCategory (originalValue) == SILValueCategory::Address);
567
567
assert (originalValue->getFunction () == &getOriginal ());
568
568
auto insertion = bufferMap.try_emplace ({origBB, originalValue}, SILValue ());
@@ -1470,7 +1470,7 @@ class PullbackCloner::Implementation final
1470
1470
// / Adjoint: adj[x] += load adj[y]; adj[y] = 0
1471
1471
void visitStoreOperation (SILBasicBlock *bb, SILLocation loc, SILValue origSrc,
1472
1472
SILValue origDest) {
1473
- auto & adjBuf = getAdjointBuffer (bb, origDest);
1473
+ auto adjBuf = getAdjointBuffer (bb, origDest);
1474
1474
switch (getTangentValueCategory (origSrc)) {
1475
1475
case SILValueCategory::Object: {
1476
1476
auto adjVal = builder.emitLoadValueOperation (
@@ -1502,7 +1502,7 @@ class PullbackCloner::Implementation final
1502
1502
// / Adjoint: adj[x] += adj[y]; adj[y] = 0
1503
1503
void visitCopyAddrInst (CopyAddrInst *cai) {
1504
1504
auto *bb = cai->getParent ();
1505
- auto & adjDest = getAdjointBuffer (bb, cai->getDest ());
1505
+ auto adjDest = getAdjointBuffer (bb, cai->getDest ());
1506
1506
auto destType = remapType (adjDest->getType ());
1507
1507
addToAdjointBuffer (bb, cai->getSrc (), adjDest, cai->getLoc ());
1508
1508
builder.emitDestroyAddrAndFold (cai->getLoc (), adjDest);
@@ -1521,7 +1521,7 @@ class PullbackCloner::Implementation final
1521
1521
break ;
1522
1522
}
1523
1523
case SILValueCategory::Address: {
1524
- auto & adjDest = getAdjointBuffer (bb, cvi);
1524
+ auto adjDest = getAdjointBuffer (bb, cvi);
1525
1525
auto destType = remapType (adjDest->getType ());
1526
1526
addToAdjointBuffer (bb, cvi->getOperand (), adjDest, cvi->getLoc ());
1527
1527
builder.emitDestroyAddrAndFold (cvi->getLoc (), adjDest);
@@ -1543,7 +1543,7 @@ class PullbackCloner::Implementation final
1543
1543
break ;
1544
1544
}
1545
1545
case SILValueCategory::Address: {
1546
- auto & adjDest = getAdjointBuffer (bb, bbi);
1546
+ auto adjDest = getAdjointBuffer (bb, bbi);
1547
1547
auto destType = remapType (adjDest->getType ());
1548
1548
addToAdjointBuffer (bb, bbi->getOperand (), adjDest, bbi->getLoc ());
1549
1549
builder.emitDestroyAddrAndFold (bbi->getLoc (), adjDest);
@@ -1582,8 +1582,8 @@ class PullbackCloner::Implementation final
1582
1582
void visitUnconditionalCheckedCastAddrInst (
1583
1583
UnconditionalCheckedCastAddrInst *uccai) {
1584
1584
auto *bb = uccai->getParent ();
1585
- auto & adjDest = getAdjointBuffer (bb, uccai->getDest ());
1586
- auto & adjSrc = getAdjointBuffer (bb, uccai->getSrc ());
1585
+ auto adjDest = getAdjointBuffer (bb, uccai->getDest ());
1586
+ auto adjSrc = getAdjointBuffer (bb, uccai->getSrc ());
1587
1587
auto destType = remapType (adjDest->getType ());
1588
1588
auto castBuf = builder.createAllocStack (uccai->getLoc (), adjSrc->getType ());
1589
1589
builder.createUnconditionalCheckedCastAddr (
@@ -1612,7 +1612,7 @@ class PullbackCloner::Implementation final
1612
1612
break ;
1613
1613
}
1614
1614
case SILValueCategory::Address: {
1615
- auto & adjDest = getAdjointBuffer (bb, urci);
1615
+ auto adjDest = getAdjointBuffer (bb, urci);
1616
1616
auto destType = remapType (adjDest->getType ());
1617
1617
addToAdjointBuffer (bb, urci->getOperand (), adjDest, urci->getLoc ());
1618
1618
builder.emitDestroyAddrAndFold (urci->getLoc (), adjDest);
@@ -1639,7 +1639,7 @@ class PullbackCloner::Implementation final
1639
1639
break ;
1640
1640
}
1641
1641
case SILValueCategory::Address: {
1642
- auto & adjDest = getAdjointBuffer (bb, ui);
1642
+ auto adjDest = getAdjointBuffer (bb, ui);
1643
1643
auto destType = remapType (adjDest->getType ());
1644
1644
addToAdjointBuffer (bb, ui->getOperand (), adjDest, ui->getLoc ());
1645
1645
builder.emitDestroyAddrAndFold (ui->getLoc (), adjDest);
0 commit comments