This is an archive of the discontinued LLVM Phabricator instance.

isDereferenceablePointer: look through gc.relocate calls
ClosedPublic

Authored by artagnon on Feb 5 2015, 6:07 PM.

Details

Summary

A pointer dereferenceable before a gc.relocate should be dereferenceable
after a gc.relocate, because the gc might not kick in, making the
gc.relocate a noop in some cases (and hence the invariant should hold in
all cases).

Diff Detail

Event Timeline

artagnon updated this revision to Diff 19453.Feb 5 2015, 6:07 PM
artagnon retitled this revision from to isDereferenceablePointer: look through gc.relocate calls.
artagnon updated this object.
artagnon edited the test plan for this revision. (Show Details)
artagnon added a reviewer: reames.
artagnon added a subscriber: Unknown Object (MLST).
reames edited edge metadata.Feb 9 2015, 11:36 AM

While your reasoning in the opening comment is faulty, the actual code LGTM.

You can't reason only about what happens when GC doesn't trigger to infer a property of the potentially relocated value. You need to reason about what happens in both cases: relocation and non-relocation.

Side note (mostly for my own later reference): I could see a theoretically GC like thing which changed dereferenceability on collection, but no practical collector I know of does so. As such, I don't see a point in controlling this via a flag at this time.

This revision was automatically updated to reflect the committed changes.