This is an archive of the discontinued LLVM Phabricator instance.

Verifier: Add checks for associated metadata
ClosedPublic

Authored by arsenm on Jan 9 2023, 12:19 PM.

Details

Summary

Also add missing assembler test for the valid cases.

Diff Detail

Event Timeline

arsenm created this revision.Jan 9 2023, 12:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2023, 12:19 PM
arsenm requested review of this revision.Jan 9 2023, 12:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 9 2023, 12:19 PM
Herald added a subscriber: wdng. · View Herald Transcript
eugenis accepted this revision.Jan 17 2023, 2:20 PM

LGTM with a comment

llvm/lib/IR/Verifier.cpp
665

It looks like the !{null} case will print both "must have a global value" and "must be ValueAsMetadata". We probably want just the first one.

This revision is now accepted and ready to land.Jan 17 2023, 2:20 PM
arsenm added inline comments.Jan 18 2023, 4:57 PM
llvm/lib/IR/Verifier.cpp
665

Looking at the test, it doesn't actually hit this one. I'm not actually sure how to construct a not-ValueAsMetadata that would reach here with text IR

arsenm added inline comments.Jan 18 2023, 5:01 PM
llvm/lib/IR/Verifier.cpp
665

Oh, I can just use a string here

Before submitting I noticed the test added in 9aff829f78331ef3718bf73ea81d319c91730808 is failing on the reference to self. The test looks like a mistake to me. The commit message suggests this could have been anything. I also don't understand the test, since it's linking a single IR file (Is it missing an input?)

llvm/lib/IR/Verifier.cpp
665

I couldn't come up with a test where this happened. We also tend to emit every verifier error possible

arsenm updated this revision to Diff 490495.Jan 19 2023, 6:33 AM

Fix linker test that had a global associate to itself, add more comprehensive link test

arsenm requested review of this revision.Jan 19 2023, 6:33 AM
eugenis accepted this revision.Jan 19 2023, 11:17 AM

LGTM, thank you!

This revision is now accepted and ready to land.Jan 19 2023, 11:17 AM