aokblast wrote:

Example:

```
double h(double v) { return v * v; }

double g(double x) {
  double s = 0;
  for (int i = 0; i < 3; i++) {
    double y = h(x);   // the call
    s = s + y;
  }
  return s;
}
```
Without reset in reverse mode:
iteration 3 -> dy = 1, dx += 2, iteration 2 -> dy = 1 + 1 = 2, dx += 4, 
iteration 1 -> dy = 3, dx += 6 => total dx = 12
With  reset:
iteration 3 -> dy = 1, dx += 2, iteration 2 -> dy = 1 , dx += 2, iteration 1 -> 
dy = 1, dx += 2 => total dx = 6 (correct)

https://github.com/llvm/llvm-project/pull/242180
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to