Page MenuHomePhabricator

[deref] Handle byval/byref/sret/inalloc/preallocated arguments for deref-at-point semantics
ClosedPublic

Authored by reames on Wed, Mar 24, 5:05 PM.

Details

Summary

All of these are scoped allocations which remain dereferenceable during the lifetime of the callee.

Diff Detail

Event Timeline

reames created this revision.Wed, Mar 24, 5:05 PM
reames requested review of this revision.Wed, Mar 24, 5:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptWed, Mar 24, 5:05 PM
nikic added a subscriber: nikic.Thu, Mar 25, 1:38 AM
nikic added inline comments.
llvm/lib/IR/Value.cpp
747

Why is the check for a sized type necessary? For an unsized type there would be no dereferenceable bytes, but I don't think it's something that really affects canBeFreed itself?

reames added inline comments.Thu, Mar 25, 7:51 AM
llvm/lib/IR/Value.cpp
747

I don't know. It seemed like enough of a cornercase to preserve the conservative handling from elsewhere. I'm happy to remove it if you are confident doing so is correct.

nikic added inline comments.Thu, Mar 25, 10:15 AM
llvm/lib/IR/Value.cpp
747

The check in the getPointerDereferenceableBytes() implementation is present because we're querying the actual type size there, which is going to assert for unsized types. I'm reasonably sure that we don't need the check here.

reames updated this revision to Diff 333420.Thu, Mar 25, 2:00 PM

address review comment

nikic accepted this revision.Thu, Mar 25, 2:17 PM

LGTM

llvm/lib/IR/Value.cpp
745

This is probably going to warn due to unused variable. hasPointeeInMemoryValueAttr() is the equivalent boolean query.

This revision is now accepted and ready to land.Thu, Mar 25, 2:17 PM
This revision was landed with ongoing or failed builds.Thu, Mar 25, 2:48 PM
This revision was automatically updated to reflect the committed changes.