[llvm-commits] [llvm] r171600 - /llvm/trunk/include/llvm/ADT/DenseMap.h
NAKAMURA Takumi
geek4civic at gmail.com
Fri Jan 4 21:14:23 PST 2013
Author: chapuni
Date: Fri Jan 4 23:14:23 2013
New Revision: 171600
URL: http://llvm.org/viewvc/llvm-project?rev=171600&view=rev
Log:
DenseMap: Appease -fstrict-aliasing on g++-4.4.
With DenseMapInfo<Enum>, it is miscompiled on g++-4.4.
static inline Enum getEmptyKey() { return Enum(<arbitrary int/unsigned value>); }
isEauql(getEmptyKey(), ...)
The compiler mis-assumes the return value is not aliased to Enum.
Modified:
llvm/trunk/include/llvm/ADT/DenseMap.h
Modified: llvm/trunk/include/llvm/ADT/DenseMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=171600&r1=171599&r2=171600&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseMap.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseMap.h Fri Jan 4 23:14:23 2013
@@ -430,7 +430,8 @@
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;
More information about the llvm-commits
mailing list