This is an archive of the discontinued LLVM Phabricator instance.

Add TinyPtrVector support for general pointer-like things.
ClosedPublic

Authored by atrick on Aug 5 2019, 11:33 AM.

Details

Summary

In particular, make TinyPtrVector<PtrIntPair<T *, 1>> work. Remove all
unnecessary assumptions that the element type has a formal "null"
representation. The important property to maintain is that
default-constructed element type has the same internal representation
as the default-constructed PointerUnion (all zero bits).

Remove the incorrect recursive behavior from
PointerUnion::isNull. This was never generally correct because it only
recursed over the first type parameter. With variadic templates it's
completely unnecessary.

Diff Detail

Event Timeline

atrick created this revision.Aug 5 2019, 11:33 AM

@rsmith, you were the last developer to make salient changes here. Since you're already familiar, any chance you can review this? If not, I'll broadcast a plea.

dexonsmith accepted this revision.Aug 19 2019, 9:21 AM

LGTM, with a minor suggestion inline.

llvm/include/llvm/ADT/TinyPtrVector.h
350–351

I think this can still be else if; no need for the extra nesting.

This revision is now accepted and ready to land.Aug 19 2019, 9:21 AM
atrick updated this revision to Diff 216281.EditedAug 20 2019, 4:00 PM

I removed the extra if-block that I accidentally created.
I added a cast to fix a type mismatch that I meant to include in the last patch.

     assert(
-        get<First>() == this->Val.getPointer() &&
+        PointerLikeTypeTraits<First>::getAsVoidPointer(get<First>())
+        == this->Val.getPointer() &&

For the record, I see two failures after updating LLVM
Failing Tests (2):

LLVM :: CodeGen/PowerPC/aix-xcoff-basic.ll
LLVM :: CodeGen/PowerPC/aix-xcoff-common.ll

But they occur with or without these changes.

atrick closed this revision.Oct 7 2019, 6:22 PM

I forgot to link the commit message back to this review.
Closing with commit 861b371e1386b6ac1069c9aa3050f7074fb64516