This is an archive of the discontinued LLVM Phabricator instance.

[OpenMP][NFC] Reduce instantiation time with different data structure
ClosedPublic

Authored by jdoerfert on Mar 13 2020, 5:41 PM.

Diff Detail

Event Timeline

jdoerfert created this revision.Mar 13 2020, 5:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2020, 5:41 PM

Tests pass fine, @rnk, let me know if this solves the issue you saw.

rnk added a comment.Mar 14 2020, 8:54 AM

Thanks, yes, this is what I had in mind.

llvm/include/llvm/Frontend/OpenMP/OMPContext.h
49

LLVM doesn't use the all uppercase naming style for enums, I'd use something like Count, Num, or Max.

One technique you could use to avoid the sentinel enum is to make an alias for the last enum, as is done for builtin types here:
https://github.com/llvm/llvm-project/blob/master/clang/include/clang/AST/Type.h#L2514
Then you won't have to handle NUM_PROPERTIES below, and you would use TraitProperty::Max + 1 for the BitVector.

152

This is the same instantiation, so we don't get any savings unless the same technique is applied here. I started by trying to change this type, but it was challenging, so I raised the issue to see if you'd be OK with it.

llvm/lib/Frontend/OpenMP/OMPContext.cpp
132

Worth fixing this formatting nit

Addressed comments

rnk accepted this revision.Mar 16 2020, 8:54 AM

lgtm, as long as you are OK with the casts as the code author.

llvm/lib/Frontend/OpenMP/OMPContext.cpp
130–132

I expected BitVector to expose an API to do this without iterating the bits individually, but I can't find one. test seems close, but not quite right. Oh well.

This revision is now accepted and ready to land.Mar 16 2020, 8:54 AM
This revision was automatically updated to reflect the committed changes.