This is an archive of the discontinued LLVM Phabricator instance.

[ADT] IntervalMap: use AlignedCharArray.
ClosedPublic

Authored by friss on Mar 11 2015, 2:45 PM.

Details

Summary

Currently IntervalMap would assert when used with keys bigger than host
pointers. This patch uses the AlignedCharArray functionality to overcome
that limitation.

The patch looks trivial enough, but the comment I'm removing was pretty
explicit about not supporting keys with bigger alignment than pointers,
thus I'm wondering if I'm not missing something.

Diff Detail

Event Timeline

friss updated this revision to Diff 21770.Mar 11 2015, 2:45 PM
friss retitled this revision from to [ADT] IntervalMap: use AlignedCharArray..
friss added a reviewer: dblaikie.
friss updated this object.
friss added a subscriber: Unknown Object (MLST).
dblaikie added inline comments.Mar 12 2015, 9:55 AM
include/llvm/ADT/IntervalMap.h
970

Like llvm::Optional you could probably use AlignedCharArrayUnion to save you having to pull out the alignment and size explicitly?

AlignedCharArrayUnion<RootLeaf, RootBranchData> should give you something with sufficient size and alignment for either type, if I'm not mistaken

friss updated this revision to Diff 21857.Mar 12 2015, 11:20 AM

Use AlignedCharArrayUnion, which also means we can get rid of the RootDataSize enum.

dblaikie accepted this revision.Mar 12 2015, 11:23 AM
dblaikie edited edge metadata.

Looks good - thanks!

This revision is now accepted and ready to land.Mar 12 2015, 11:23 AM
This revision was automatically updated to reflect the committed changes.