[llvm] r344018 - [ADT] Change the `IntervalMap` alignment assert for x86 MSVC
Aleksandr Urakov via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 9 00:33:09 PDT 2018
Author: aleksandr.urakov
Date: Tue Oct 9 00:33:09 2018
New Revision: 344018
URL: http://llvm.org/viewvc/llvm-project?rev=344018&view=rev
Log:
[ADT] Change the `IntervalMap` alignment assert for x86 MSVC
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=344018&r1=344017&r2=344018&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/IntervalMap.h (original)
+++ llvm/trunk/include/llvm/ADT/IntervalMap.h Tue Oct 9 00:33:09 2018
@@ -964,7 +964,7 @@ public:
private:
// The root data is either a RootLeaf or a RootBranchData instance.
- AlignedCharArrayUnion<RootLeaf, RootBranchData> data;
+ LLVM_ALIGNAS(RootLeaf) AlignedCharArrayUnion<RootLeaf, RootBranchData> data;
// Tree height.
// 0: Leaves in root.
More information about the llvm-commits
mailing list