[llvm-commits] [llvm] r126982 - /llvm/trunk/lib/Transforms/Utils/Local.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Thu Mar 3 18:48:56 PST 2011


Author: stoklund
Date: Thu Mar  3 20:48:56 2011
New Revision: 126982

URL: http://llvm.org/viewvc/llvm-project?rev=126982&view=rev
Log:
DenseMap<uintptr_t,...> doesn't allow all values as keys.

Avoid colliding with the sentinels, hopefully unbreaking
llvm-gcc-x86_64-linux-selfhost.

Modified:
    llvm/trunk/lib/Transforms/Utils/Local.cpp

Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=126982&r1=126981&r2=126982&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Thu Mar  3 20:48:56 2011
@@ -632,6 +632,8 @@
       Hash ^= reinterpret_cast<uintptr_t>(static_cast<Value *>(*I));
       Hash = (Hash << 7) | (Hash >> (sizeof(uintptr_t) * CHAR_BIT - 7));
     }
+    // Avoid colliding with the DenseMap sentinels ~0 and ~0-1.
+    Hash >>= 1;
     // If we've never seen this hash value before, it's a unique PHI.
     std::pair<DenseMap<uintptr_t, PHINode *>::iterator, bool> Pair =
       HashMap.insert(std::make_pair(Hash, PN));





More information about the llvm-commits mailing list