Skip to content

Commit

Permalink
[ADT] Force the alignment of the data field of IntervalMap
Browse files Browse the repository at this point in the history
Summary:
This patch forces the alignment of the `data` field of `IntervalMap`.
It is because x86 MSVC doesn't apply automatically
(without `__declspec(align(...))`) alignments more than 4 bytes,
even if `alignof` has returned so. Consider the example:

https://godbolt.org/z/zIPa_G

Here `alignof` for both `S0` and `S1` returns `8`, but only `S1` is really
aligned on x86. The explanation of this behavior is here:

https://docs.microsoft.com/en-us/cpp/build/conflicts-with-the-x86-compiler

Reviewers: bkramer, stoklund, hans, rnk

Reviewed By: rnk

Subscribers: dexonsmith, llvm-commits

Differential Revision: https://reviews.llvm.org/D52613

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344027 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Aleksandr Urakov committed Oct 9, 2018
1 parent 8cc4d7e commit 3659c41
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/llvm/ADT/IntervalMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,7 @@ class IntervalMap {

private:
// The root data is either a RootLeaf or a RootBranchData instance.
LLVM_ALIGNAS(RootLeaf) LLVM_ALIGNAS(RootBranchData)
AlignedCharArrayUnion<RootLeaf, RootBranchData> data;

// Tree height.
Expand Down

0 comments on commit 3659c41

Please sign in to comment.