diff --git a/lib/Differentiator/ReverseModeVisitor.cpp b/lib/Differentiator/ReverseModeVisitor.cpp index 4dbc973e3..b4c085230 100644 --- a/lib/Differentiator/ReverseModeVisitor.cpp +++ b/lib/Differentiator/ReverseModeVisitor.cpp @@ -754,6 +754,8 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context, OnlyReturn=true; else OnlyReturn=false; + }else{ + OnlyReturn=true; } } if (m_ExternalSource) diff --git a/test/Hessian/BuiltinDerivatives.C b/test/Hessian/BuiltinDerivatives.C index ff7e9cec2..400047ffd 100644 --- a/test/Hessian/BuiltinDerivatives.C +++ b/test/Hessian/BuiltinDerivatives.C @@ -123,8 +123,6 @@ float f2(float x) { // CHECK-NEXT: _t2 = x; // CHECK-NEXT: _t3 = ::std::exp(_t2); // CHECK-NEXT: _t1 = d_x; -// CHECK-NEXT: goto _label0; -// CHECK-NEXT: _label0: // CHECK-NEXT: { // CHECK-NEXT: float _r0 = _d_y.value * clad::custom_derivatives{{(::std)?}}::exp_pushforward(_t0, 1.F).pushforward; // CHECK-NEXT: * _d_x += _r0; @@ -145,8 +143,6 @@ float f2(float x) { // CHECK-NEXT: _t0 = x; // CHECK-NEXT: _t1 = _d_x0; // CHECK-NEXT: ValueAndPushforward _t00 = clad::custom_derivatives{{(::std)?}}::exp_pushforward(_t0, _t1); -// CHECK-NEXT: goto _label0; -// CHECK-NEXT: _label0: // CHECK-NEXT: _d__t0.pushforward += 1; // CHECK-NEXT: { // CHECK-NEXT: float _grad0 = 0.F; @@ -183,8 +179,6 @@ float f3(float x) { // CHECK-NEXT: _t2 = x; // CHECK-NEXT: _t3 = (1. / _t2); // CHECK-NEXT: _t1 = d_x; -// CHECK-NEXT: goto _label0; -// CHECK-NEXT: _label0: // CHECK-NEXT: { // CHECK-NEXT: float _r0 = _d_y.value * clad::custom_derivatives{{(::std)?}}::log_pushforward(_t0, 1.F).pushforward; // CHECK-NEXT: * _d_x += _r0; @@ -206,8 +200,6 @@ float f3(float x) { // CHECK-NEXT: _t0 = x; // CHECK-NEXT: _t1 = _d_x0; // CHECK-NEXT: ValueAndPushforward _t00 = clad::custom_derivatives{{(::std)?}}::log_pushforward(_t0, _t1); -// CHECK-NEXT: goto _label0; -// CHECK-NEXT: _label0: // CHECK-NEXT: _d__t0.pushforward += 1; // CHECK-NEXT: { // CHECK-NEXT: float _grad0 = 0.F; @@ -275,8 +267,6 @@ float f4(float x) { // CHECK-NEXT: _t8 = d_exponent; // CHECK-NEXT: derivative += _t14 * _t8; // CHECK-NEXT: } -// CHECK-NEXT: goto _label0; -// CHECK-NEXT: _label0: // CHECK-NEXT: { // CHECK-NEXT: _d_val += _d_y.value; // CHECK-NEXT: _d_derivative += _d_y.pushforward; @@ -335,8 +325,6 @@ float f4(float x) { // CHECK-NEXT: _t0 = x; // CHECK-NEXT: _t1 = _d_x0; // CHECK-NEXT: ValueAndPushforward _t00 = clad::custom_derivatives{{(::std)?}}::pow_pushforward(_t0, 4.F, _t1, 0.F); -// CHECK-NEXT: goto _label0; -// CHECK-NEXT: _label0: // CHECK-NEXT: _d__t0.pushforward += 1; // CHECK-NEXT: { // CHECK-NEXT: float _grad0 = 0.F; @@ -377,8 +365,6 @@ float f5(float x) { // CHECK-NEXT: _t0 = x; // CHECK-NEXT: _t1 = _d_x0; // CHECK-NEXT: ValueAndPushforward _t00 = clad::custom_derivatives{{(::std)?}}::pow_pushforward(2.F, _t0, 0.F, _t1); -// CHECK-NEXT: goto _label0; -// CHECK-NEXT: _label0: // CHECK-NEXT: _d__t0.pushforward += 1; // CHECK-NEXT: { // CHECK-NEXT: float _grad0 = 0.F; @@ -426,8 +412,6 @@ float f6(float x, float y) { // CHECK-NEXT: _t2 = _d_x0; // CHECK-NEXT: _t3 = _d_y0; // CHECK-NEXT: ValueAndPushforward _t00 = clad::custom_derivatives{{(::std)?}}::pow_pushforward(_t0, _t1, _t2, _t3); -// CHECK-NEXT: goto _label0; -// CHECK-NEXT: _label0: // CHECK-NEXT: _d__t0.pushforward += 1; // CHECK-NEXT: { // CHECK-NEXT: float _grad0 = 0.F; @@ -468,8 +452,6 @@ float f6(float x, float y) { // CHECK-NEXT: _t2 = _d_x0; // CHECK-NEXT: _t3 = _d_y0; // CHECK-NEXT: ValueAndPushforward _t00 = clad::custom_derivatives{{(::std)?}}::pow_pushforward(_t0, _t1, _t2, _t3); -// CHECK-NEXT: goto _label0; -// CHECK-NEXT: _label0: // CHECK-NEXT: _d__t0.pushforward += 1; // CHECK-NEXT: { // CHECK-NEXT: float _grad0 = 0.F; diff --git a/test/Hessian/Hessians.C b/test/Hessian/Hessians.C index 49a497f7f..04e0572a6 100644 --- a/test/Hessian/Hessians.C +++ b/test/Hessian/Hessians.C @@ -155,8 +155,6 @@ void f_cubed_add1_darg1_grad(double a, double b, clad::array_ref _d_a, c //CHECK-NEXT: _t13 = b; //CHECK-NEXT: _t20 = _t10; //CHECK-NEXT: _t19 = _d_b0; -//CHECK-NEXT: goto _label0; -//CHECK-NEXT: _label0: //CHECK-NEXT: { //CHECK-NEXT: double _r4 = 1 * _t4; //CHECK-NEXT: double _r5 = _r4 * _t5; diff --git a/test/Hessian/NestedFunctionCalls.C b/test/Hessian/NestedFunctionCalls.C index 37c04d9b0..87981f5ea 100644 --- a/test/Hessian/NestedFunctionCalls.C +++ b/test/Hessian/NestedFunctionCalls.C @@ -148,8 +148,6 @@ double f2(double x, double y){ // CHECK-NEXT: clad::ValueAndPushforward _t00 = f_pushforward(_t0, _t1, _t2, _t3); // CHECK-NEXT: double _d_ans = _t00.pushforward; // CHECK-NEXT: double ans = _t00.value; -// CHECK-NEXT: goto _label0; -// CHECK-NEXT: _label0: // CHECK-NEXT: _d__d_ans += 1; // CHECK-NEXT: _d__t0.value += _d_ans0; // CHECK-NEXT: _d__t0.pushforward += _d__d_ans; diff --git a/test/Hessian/Pointers.C b/test/Hessian/Pointers.C index f15d68776..140855452 100644 --- a/test/Hessian/Pointers.C +++ b/test/Hessian/Pointers.C @@ -58,8 +58,6 @@ double nonMemFn(double i, double j) { // CHECK-NEXT: _t0 = j; // CHECK-NEXT: _t3 = i; // CHECK-NEXT: _t2 = _d_j0; -// CHECK-NEXT: goto _label0; -// CHECK-NEXT: _label0: // CHECK-NEXT: { // CHECK-NEXT: double _r0 = 1 * _t0; // CHECK-NEXT: _d__d_i += _r0;