Skip to content

Commit

Permalink
Make the verify pass on by default
Browse files Browse the repository at this point in the history
As we slowly move towards Pony 1.0.0, fixing issues in LLVM IR
generation is an important consideration. We've turned on
LLVM IR generation verification as a default in the compiler.

Hopefully this will generate reports for failures that are
currently hidden in the wild.
  • Loading branch information
SeanTAllen committed Feb 23, 2022
1 parent bdea439 commit eb0258f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .release-notes/always-verify-ir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Turn on `verify` pass by default

The `verify` compiler pass will check the LLVM IR generated for the program being compiled for errors. Previously, you had to turn verify on. It is now on by default and can be turned off using the new `--noverify` option.

We decided to turn on the pass for two reasons. The first is that it adds very little overhead to normal compilation times. The second is it will help generate error reports from Pony users for lurking bugs in our code generation.

The errors reported don't generally result in incorrect programs, but could under the right circumstance. We feel that turning on the reports will allow us to find and fix bugs quicker and help move us closer to Pony version 1.
9 changes: 6 additions & 3 deletions src/libponyc/options/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ enum
OPT_TRACE,
OPT_WIDTH,
OPT_IMMERR,
OPT_VERIFY,
OPT_NOVERIFY,
OPT_FILENAMES,
OPT_CHECKTREE,
OPT_EXTFUN,
Expand Down Expand Up @@ -99,7 +99,7 @@ static opt_arg_t std_args[] =
{"trace", 't', OPT_ARG_NONE, OPT_TRACE},
{"width", 'w', OPT_ARG_REQUIRED, OPT_WIDTH},
{"immerr", '\0', OPT_ARG_NONE, OPT_IMMERR},
{"verify", '\0', OPT_ARG_NONE, OPT_VERIFY},
{"noverify", '\0', OPT_ARG_NONE, OPT_NOVERIFY},
{"files", '\0', OPT_ARG_NONE, OPT_FILENAMES},
{"checktree", '\0', OPT_ARG_NONE, OPT_CHECKTREE},
{"extfun", '\0', OPT_ARG_NONE, OPT_EXTFUN},
Expand Down Expand Up @@ -271,6 +271,9 @@ ponyc_opt_process_t ponyc_opt_process(opt_state_t* s, pass_opt_t* opt,

bool wants_help = false;

// default to running verify pass. require it to be turned off.
opt->verify = true;

while((id = ponyint_opt_next(s)) != -1)
{
switch(id)
Expand Down Expand Up @@ -339,7 +342,7 @@ ponyc_opt_process_t ponyc_opt_process(opt_state_t* s, pass_opt_t* opt,
case OPT_TRACE: opt->parse_trace = true; break;
case OPT_WIDTH: opt->ast_print_width = atoi(s->arg_val); break;
case OPT_IMMERR: errors_set_immediate(opt->check.errors, true); break;
case OPT_VERIFY: opt->verify = true; break;
case OPT_NOVERIFY: opt->verify = false; break;
case OPT_EXTFUN: opt->extfun = true; break;
case OPT_FILENAMES: opt->print_filenames = true; break;
case OPT_CHECKTREE: opt->check_tree = true; break;
Expand Down

0 comments on commit eb0258f

Please sign in to comment.