Skip to content

Commit a282ee6

Browse files
committed
[AutoDiff] NFC: silence unused variable warnings.
1 parent f27f1cd commit a282ee6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

include/swift/SILOptimizer/Utils/Differentiation/AdjointValue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class AdjointValue final {
148148
std::get<1>(elt).print(s);
149149
},
150150
[&s] { s << ", "; });
151-
} else if (auto tupleType = getType().getAs<TupleType>()) {
151+
} else if (getType().is<TupleType>()) {
152152
s << "Tuple>(";
153153
interleave(
154154
base->value.aggregate,

lib/SILOptimizer/Utils/Differentiation/PullbackEmitter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,14 +1676,14 @@ void PullbackEmitter::visitBeginBorrowInst(BeginBorrowInst *bbi) {
16761676
void PullbackEmitter::visitBeginAccessInst(BeginAccessInst *bai) {
16771677
// Check for non-differentiable writes.
16781678
if (bai->getAccessKind() == SILAccessKind::Modify) {
1679-
if (auto *gai = dyn_cast<GlobalAddrInst>(bai->getSource())) {
1679+
if (isa<GlobalAddrInst>(bai->getSource())) {
16801680
getContext().emitNondifferentiabilityError(
16811681
bai, getInvoker(),
16821682
diag::autodiff_cannot_differentiate_writes_to_global_variables);
16831683
errorOccurred = true;
16841684
return;
16851685
}
1686-
if (auto *pbi = dyn_cast<ProjectBoxInst>(bai->getSource())) {
1686+
if (isa<ProjectBoxInst>(bai->getSource())) {
16871687
getContext().emitNondifferentiabilityError(
16881688
bai, getInvoker(),
16891689
diag::autodiff_cannot_differentiate_writes_to_mutable_captures);
@@ -1904,7 +1904,7 @@ AdjointValue PullbackEmitter::accumulateAdjointsDirect(AdjointValue lhs,
19041904
SmallVector<AdjointValue, 8> newElements;
19051905
auto lhsTy = lhsVal->getType().getASTType();
19061906
auto lhsValCopy = builder.emitCopyValueOperation(loc, lhsVal);
1907-
if (auto *tupTy = lhsTy->getAs<TupleType>()) {
1907+
if (lhsTy->is<TupleType>()) {
19081908
auto elts = builder.createDestructureTuple(loc, lhsValCopy);
19091909
llvm::for_each(elts->getResults(),
19101910
[this](SILValue result) { recordTemporary(result); });
@@ -1913,7 +1913,7 @@ AdjointValue PullbackEmitter::accumulateAdjointsDirect(AdjointValue lhs,
19131913
newElements.push_back(accumulateAdjointsDirect(
19141914
makeConcreteAdjointValue(elts->getResult(i)), rhsElt, loc));
19151915
}
1916-
} else if (auto *structDecl = lhsTy->getStructOrBoundGenericStruct()) {
1916+
} else if (lhsTy->getStructOrBoundGenericStruct()) {
19171917
auto elts =
19181918
builder.createDestructureStruct(lhsVal.getLoc(), lhsValCopy);
19191919
llvm::for_each(elts->getResults(),

0 commit comments

Comments
 (0)