[PATCH] D52613: [ADT] Change the `IntervalMap` alignment assert for x86 MSVC
Aleksandr Urakov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 27 07:47:48 PDT 2018
aleksandr.urakov created this revision.
aleksandr.urakov added reviewers: Eugene.Zelenko, bkramer, stoklund.
Herald added subscribers: llvm-commits, dexonsmith.
This patch adds the different alignment assert for the x86 MSVC case. 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
Repository:
rL LLVM
https://reviews.llvm.org/D52613
Files:
include/llvm/ADT/IntervalMap.h
Index: include/llvm/ADT/IntervalMap.h
===================================================================
--- include/llvm/ADT/IntervalMap.h
+++ include/llvm/ADT/IntervalMap.h
@@ -1040,8 +1040,13 @@
public:
explicit IntervalMap(Allocator &a) : height(0), rootSize(0), allocator(a) {
+#if defined(_WIN32) && !defined(_WIN64)
+ assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1) & 3) == 0 &&
+ "Insufficient alignment");
+#else
assert((uintptr_t(data.buffer) & (alignof(RootLeaf) - 1)) == 0 &&
"Insufficient alignment");
+#endif
new(&rootLeaf()) RootLeaf();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52613.167316.patch
Type: text/x-patch
Size: 610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180927/551627c1/attachment.bin>
More information about the llvm-commits
mailing list