Skip to content

Commit

Permalink
Remove check for nonRealType before calling synthesizeLiteral
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristin22 committed Sep 2, 2024
1 parent 2a8655e commit df2617d
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions lib/Differentiator/BaseForwardModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1071,8 +1071,6 @@ StmtDiff BaseForwardModeVisitor::VisitDeclRefExpr(const DeclRefExpr* DRE) {
if (clonedDRE->getType()->isPointerType())
return StmtDiff(clonedDRE, nullptr);
QualType literalTy = utils::GetValueType(clonedDRE->getType());
if (!literalTy->isRealType())
literalTy = m_Context.IntTy;
return StmtDiff(clonedDRE, ConstantFolder::synthesizeLiteral(
literalTy, m_Context, /*val=*/0));
}
Expand Down Expand Up @@ -1379,8 +1377,6 @@ StmtDiff BaseForwardModeVisitor::VisitUnaryOperator(const UnaryOperator* UnOp) {
return StmtDiff(op, BuildOp(opKind, dx));
QualType literalTy =
utils::GetValueType(UnOp->getSubExpr()->getType()->getPointeeType());
if (!literalTy->isRealType())
literalTy = m_Context.IntTy;
return StmtDiff(
op, ConstantFolder::synthesizeLiteral(literalTy, m_Context, /*val=*/0));
} else if (opKind == UnaryOperatorKind::UO_AddrOf) {
Expand Down

0 comments on commit df2617d

Please sign in to comment.