[llvm] r344027 - [ADT] Force the alignment of the `data` field of `IntervalMap`
Aleksandr Urakov via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 9 01:50:50 PDT 2018
Author: aleksandr.urakov
Date: Tue Oct 9 01:50:50 2018
New Revision: 344027
URL: http://llvm.org/viewvc/llvm-project?rev=344027&view=rev
Log:
[ADT] Force the alignment of the `data` field of `IntervalMap`
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
Modified:
llvm/trunk/include/llvm/ADT/IntervalMap.h
Modified: llvm/trunk/include/llvm/ADT/IntervalMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/IntervalMap.h?rev=344027&r1=344026&r2=344027&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/IntervalMap.h (original)
+++ llvm/trunk/include/llvm/ADT/IntervalMap.h Tue Oct 9 01:50:50 2018
@@ -964,6 +964,7 @@ public:
private:
// The root data is either a RootLeaf or a RootBranchData instance.
+ LLVM_ALIGNAS(RootLeaf) LLVM_ALIGNAS(RootBranchData)
AlignedCharArrayUnion<RootLeaf, RootBranchData> data;
// Tree height.
More information about the llvm-commits
mailing list