From: NAKAMURA Takumi Date: Sat, 5 Jan 2013 05:14:23 +0000 (+0000) Subject: DenseMap: Appease -fstrict-aliasing on g++-4.4. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=5d295b41a3f4194778b6bc01a828b2115bd3a3f1;p=oota-llvm.git DenseMap: Appease -fstrict-aliasing on g++-4.4. With DenseMapInfo, it is miscompiled on g++-4.4. static inline Enum getEmptyKey() { return Enum(); } isEauql(getEmptyKey(), ...) The compiler mis-assumes the return value is not aliased to Enum. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171600 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h index 8607fb7e9cc..4a2d13786f2 100644 --- a/include/llvm/ADT/DenseMap.h +++ b/include/llvm/ADT/DenseMap.h @@ -430,7 +430,8 @@ private: incrementNumEntries(); // If we are writing over a tombstone, remember this. - if (!KeyInfoT::isEqual(TheBucket->first, getEmptyKey())) + const KeyT EmptyKey = getEmptyKey(); + if (!KeyInfoT::isEqual(TheBucket->first, EmptyKey)) decrementNumTombstones(); return TheBucket;