Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACCEPT_PERMIT doesn't allow optimization of loops with loop exits #35

Open
billzorn opened this issue Feb 10, 2015 · 0 comments
Open

ACCEPT_PERMIT doesn't allow optimization of loops with loop exits #35

billzorn opened this issue Feb 10, 2015 · 0 comments
Labels

Comments

@billzorn
Copy link

In the example, neither loop can be perforated, despite the annotations. Is this expected?

On a related note, it would be very helpful if accept told you where the loop exit was, the same way it tells you what line an assignment to a precise value or an impure function call is.

#include <assert.h>
#include <enerc.h>

int main() {

  APPROX int x_approx = 0;

  for (int i = 0; i < 1000; ++i) {
    assert(x_approx <= 2000); // ACCEPT_PERMIT
    x_approx += 1;
  }

  for (int i = 0; i < 1000; ++i) {
    if (i > 557) // ACCEPT_PERMIT
      break; // ACCEPT_PERMIT
    x_approx += 1;
  }

  return ENDORSE(x_approx);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant