Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: src/IceGlobalContext.cpp

Issue 1019233002: Subzero: Fix floating-point constant pooling. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/abi-atomics.ll » ('j') | tests_lit/llvm2ice_tests/abi-atomics.ll » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceGlobalContext.cpp
diff --git a/src/IceGlobalContext.cpp b/src/IceGlobalContext.cpp
index 6badc559aa9236b017ad9ad262d216812c0e25d4..76f9211ae22ae82378d35c3c7e97cb46d21e6a8b 100644
--- a/src/IceGlobalContext.cpp
+++ b/src/IceGlobalContext.cpp
@@ -65,7 +65,15 @@ public:
}
private:
- typedef std::unordered_map<KeyType, ValueType *> ContainerType;
+ struct compare {
+ bool operator()(const KeyType &Value1, const KeyType &Value2) const {
+ if (std::is_floating_point<KeyType>::value)
+ return !memcmp(&Value1, &Value2, sizeof(KeyType));
+ return std::equal_to<KeyType>()(Value1, Value2);
+ }
+ };
+ typedef std::unordered_map<KeyType, ValueType *, std::hash<KeyType>, compare>
+ ContainerType;
JF 2015/03/19 16:33:09 template<typename T> struct Compare { typename s
Jim Stichnoth 2015/03/19 18:07:04 Cool. I did it a slightly different way. It has
Jim Stichnoth 2015/03/19 19:57:49 Tweaked once more to combine integral types and Re
ContainerType Pool;
uint32_t NextPoolID;
};
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/abi-atomics.ll » ('j') | tests_lit/llvm2ice_tests/abi-atomics.ll » ('J')

Powered by Google App Engine
This is Rietveld 408576698