This is an archive of the discontinued LLVM Phabricator instance.

[OpaquePtr] Verify Opaque pointer in function parameter
ClosedPublic

Authored by zequanwu on Jun 15 2021, 10:01 AM.

Details

Summary

Verifying opaque pointer as function parameter when using with byval, byref,
inalloca, preallocated.

Diff Detail

Event Timeline

zequanwu created this revision.Jun 15 2021, 10:01 AM
zequanwu requested review of this revision.Jun 15 2021, 10:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 15 2021, 10:01 AM

can you add some negative tests for this? e.g. make sure you see the proper message for something like

call void @f(ptr inalloca(%somenotsizedtype) %a)

there are some negative verifier tests in llvm/test/Verifier, search RUN: not opt

llvm/lib/IR/Verifier.cpp
1869

we still need a Visited in the new code to account for recursive types

we can delete the checks below for isSized() and always use your new code, then only check that the pointee type and inalloca/etc type match for non-opaque pointers

aeubanks added inline comments.Jun 15 2021, 2:09 PM
llvm/lib/IR/Verifier.cpp
1869

we still should keep this check that for non-opaque pointers, the element type matches the attribute type, I only meant to make the check for sized common between opaque and non-opaque pointers (and we should keep all the tests that were deleted)

This revision is now accepted and ready to land.Jun 15 2021, 2:46 PM
This revision was landed with ongoing or failed builds.Jun 15 2021, 2:57 PM
This revision was automatically updated to reflect the committed changes.