Skip to content

Commit

Permalink
Revert changes and fix codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Andriychuk committed Oct 14, 2024
1 parent 42e79eb commit 3a9521a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
7 changes: 3 additions & 4 deletions lib/Differentiator/ActivityAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,6 @@ bool VariedAnalyzer::VisitCallExpr(CallExpr* CE) {

bool VariedAnalyzer::VisitDeclStmt(DeclStmt* DS) {
for (Decl* D : DS->decls()) {
if (!isa<VarDecl>(D))
continue;
if (Expr* init = cast<VarDecl>(D)->getInit()) {
m_Varied = false;
TraverseStmt(init);
Expand All @@ -162,9 +160,10 @@ bool VariedAnalyzer::VisitUnaryOperator(UnaryOperator* UnOp) {

bool VariedAnalyzer::VisitDeclRefExpr(DeclRefExpr* DRE) {
auto* VD = dyn_cast<VarDecl>(DRE->getDecl());
if (!VD)
if (!VD) {
llvm::errs() << "\nHAHHAHHAHAHAHAHAHA";
return true;

}
if (isVaried(VD))
m_Varied = true;

Expand Down
4 changes: 3 additions & 1 deletion lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,9 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
}

StmtDiff ReverseModeVisitor::VisitIntegerLiteral(const IntegerLiteral* IL) {
return StmtDiff(Clone(IL));
auto* Constant0 =
ConstantFolder::synthesizeLiteral(m_Context.IntTy, m_Context, 0);
return StmtDiff(Clone(IL), Constant0);
}

StmtDiff ReverseModeVisitor::VisitFloatingLiteral(const FloatingLiteral* FL) {
Expand Down
6 changes: 3 additions & 3 deletions test/Gradient/FunctionCalls.C
Original file line number Diff line number Diff line change
Expand Up @@ -441,14 +441,14 @@ double do_nothing(double* u, double* v, double* w) {
return u[0];
}

// CHECK: void do_nothing_pullback(double *u, double *v, double *w, double _d_y, double *_d_u, double *_d_v);
// CHECK: void do_nothing_pullback(double *u, double *v, double *w, double _d_y, double *_d_u, double *_d_v, double *_d_w);

double fn12(double x, double y) {
return do_nothing(&x, nullptr, 0);
}

// CHECK: void fn12_grad(double x, double y, double *_d_x, double *_d_y) {
// CHECK-NEXT: do_nothing_pullback(&x, nullptr, 0, 1, &*_d_x, nullptr);
// CHECK-NEXT: do_nothing_pullback(&x, nullptr, 0, 1, &*_d_x, nullptr, 0);
// CHECK-NEXT: }

double multiply(double* a, double* b) {
Expand Down Expand Up @@ -998,7 +998,7 @@ double sq_defined_later(double x) {
// CHECK-NEXT: *_d_b += _d_y;
// CHECK-NEXT: }

// CHECK: void do_nothing_pullback(double *u, double *v, double *w, double _d_y, double *_d_u, double *_d_v) {
// CHECK: void do_nothing_pullback(double *u, double *v, double *w, double _d_y, double *_d_u, double *_d_v, double *_d_w) {
// CHECK-NEXT: _d_u[0] += _d_y;
// CHECK-NEXT: }

Expand Down

0 comments on commit 3a9521a

Please sign in to comment.