ponyc icon indicating copy to clipboard operation
ponyc copied to clipboard

Make the `verify` pass on by default

Open SeanTAllen opened this issue 3 years ago • 4 comments

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.

SeanTAllen avatar Feb 23 '22 03:02 SeanTAllen

Two of our runner tests currently fail verification. We'll need to fix those (and other errors that might be hidden by those failures) before this is merged.

SeanTAllen avatar Feb 23 '22 03:02 SeanTAllen

Suggested change to make verification failure more friendly and make people aware that they can turn it off if they run into an error:

diff --git a/src/libponyc/codegen/genopt.cc b/src/libponyc/codegen/genopt.cc
index 970e43fc..0761075d 100644
--- a/src/libponyc/codegen/genopt.cc
+++ b/src/libponyc/codegen/genopt.cc
@@ -1446,6 +1446,8 @@ bool genopt(compile_t* c, bool pony_specific)
     if(LLVMVerifyModule(c->module, LLVMPrintMessageAction, &msg) != 0)
     {
       errorf(errors, NULL, "Module verification failed: %s", msg);
+      errorf_continue(errors, NULL,
+        "Please file an issue ticket. Use --noverify to bypass this error.");
       LLVMDisposeMessage(msg);
       return false;
     }

jemc avatar Feb 23 '22 15:02 jemc

@jemc added.

SeanTAllen avatar Feb 23 '22 15:02 SeanTAllen

This shouldnt be merged until we fix all the associated issues that cause CI to fail.

SeanTAllen avatar Feb 23 '22 15:02 SeanTAllen

I've rebased this against main. I assume it will still fail CI, but we can at least see where we are at with this.

SeanTAllen avatar Oct 05 '23 13:10 SeanTAllen

The only test failing (at least on the Linux build that I checked) is the full program test named with-return - it's getting the IR verification error that there is a "Terminator found in the middle of a basic block!".

We need to fix something about the interaction of an explicit return inside a with block. Should be fairly simple I think?

jemc avatar Oct 10 '23 17:10 jemc

We need to fix something about the interaction of an explicit return inside a with block. Should be fairly simple I think?

Well, maybe? the issue is, we wouldn't want both returns if they end up together, but a return from a with is perfectly fine the issue is that it is the last statement and our "no explicit return except early doesn't cover this"

SeanTAllen avatar Oct 10 '23 18:10 SeanTAllen

We are going to remove the with-return test for now as it is flawed. See #4464.

SeanTAllen avatar Oct 10 '23 18:10 SeanTAllen

This is looking good, but I don't want to merge yet. I want to get a release that solves #4454

SeanTAllen avatar Oct 16 '23 16:10 SeanTAllen