[PATCH] D23636: [ADT] Allocate memory less often by increase inline storage
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 30 21:50:11 PDT 2016
sanjoy added a comment.
I'm not sure if this is the right approach -- I think it is better to avoid a change of this scale if possible.
Have you considered changing the access to `pVal` in APInt.cpp to go through an accessor that returns `&VAL[0]` if the bitwidth is <= 128? The union could be changed to:
union {
uint64_t LocalArray[2];
uint64_t VAL;
uint64_t *pVal;
};
to avoid breaking existing uses of `VAL`, and most of the existing code (except perhaps things like `AssignSlowCase`) should work as they do now. This approach will also easily generalize to a `LocalArray[N]`.
The downside of what I've suggested above is that the "fast path" for some of the two-word operations will not be visible but a) they may not actually matter, and b) we can change them one by one as needed.
https://reviews.llvm.org/D23636
More information about the llvm-commits
mailing list