This is an archive of the discontinued LLVM Phabricator instance.

Add -disable-verify flag to llvm-link.
ClosedPublic

Authored by nickwasmer on Mar 25 2021, 2:53 PM.

Details

Summary

This flag allows the developer to see the result of linking even if it fails the verifier, as a step in debugging cases where the linked module fails the verifier. Same as opt -disable-verify.

No test is introduced. I don't want to write a test that relies on any manner of producing an invalid output that is a bug that should be fixed, as then the test would break if a bug is fixed.

There's an alternative that I considered but did not implement. Unlike opt, llvm-link has many intermediate outputs as it links more files and runs the verifier on each one. We could instead have a flag that outputs a module and stop after running the verifier and seeing a failure. This would allow us to find issues closer to the source, but it also requires that the verifier not crash on the invalid input in question.

Diff Detail

Event Timeline

nickwasmer requested review of this revision.Mar 25 2021, 2:53 PM
nickwasmer created this revision.

Apply clang-format suggestion.

How about a test like llvm/test/LTO/X86/strip-debug-info.ll? Could something similar be done to test llvm-link?

How about a test like llvm/test/LTO/X86/strip-debug-info.ll? Could something similar be done to test llvm-link?

I wasn't quite able to get that trick to work. With llvm-link I just get a "warning: ignoring invalid debug info in <stdin>" whether the input is assembled by llvm-link or by llvm-as -disable-verify, or opt -disable-verify -disable-upgrade-debug-info (the .bc file is the same).

The case where it would behave differently is checked by a CHECK-ERR which is never set as any check-prefix. I also don't see any documentation or code in FileCheck that makes -ERR a special suffix like -LABEL and -DAG are.

Looking into the history, I think this test is no longer testing that -disable-verify works that way as of git commit a8b2ddbde453fab0db90be21b9a1ff961a7770e0 which removed the CHECK-ERR run.

tejohnson accepted this revision.Mar 29 2021, 2:14 PM

Ok thanks for trying. Someone should remove that orphaned CHECK-ERR in the other test - could you commit that as well?

lgtm

This revision is now accepted and ready to land.Mar 29 2021, 2:14 PM
This revision was landed with ongoing or failed builds.Mar 30 2021, 9:55 AM
This revision was automatically updated to reflect the committed changes.