Chromium Code Reviews
DescriptionSubzero: Fix floating-point constant pooling.
This fixes a regression likely introduced in d2cb4361c732dcddc98659415f37be45982e20c3 .
The problem is that by using the default std::unordered_map comparison predicate std::equal_to, we get incorrect behavior when the key is float or double:
1. 0.0 and -0.0 appear equal, so they share a constant pool entry even though the bit patterns are different. This is a correctness bug.
2. Each instance of NaN gets a separate constant pool entry, because NaN != NaN by C equality rules. This is a performance bug. (This problem doesn't show up with the native bitcode reader, because constants are already unique-ified in the PNaCl bitcode file.)
The solution is to use memcmp for floating-point key types.
Also, the abi-atomics.ll test is disabled for the MINIMAL build, to fix an oversight from a previous CL.
BUG= none
R=jfb@chromium.org
Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=5bfe21578536c437ef17052038c5d85eaf1bd484
Patch Set 1 #
Total comments: 7
Patch Set 2 : Improve key comparison for unordered_map #Patch Set 3 : Simplification #
Total comments: 2
Patch Set 4 : Add a comment on use of default std::hash #
Messages
Total messages: 8 (1 generated)
|
|||||||||||||||||||||||||||||||||||||