[llvm-commits] [llvm] r171600 - /llvm/trunk/include/llvm/ADT/DenseMap.h
Chandler Carruth
chandlerc at google.com
Fri Jan 4 21:38:32 PST 2013
On Fri, Jan 4, 2013 at 9:14 PM, NAKAMURA Takumi <geek4civic at gmail.com>wrote:
> 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.
>
This doesn't make a lot of sense to me.
Aliasing has to do with pointers and references. The return value is a
value, and can't alias anything....
Not sure what is actually happening though.
>
> 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;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130104/c8817fc8/attachment.html>
More information about the llvm-commits
mailing list