Index: lib/MC/ConstantPools.cpp =================================================================== --- lib/MC/ConstantPools.cpp +++ lib/MC/ConstantPools.cpp @@ -37,8 +37,12 @@ const MCExpr *ConstantPool::addEntry(const MCExpr *Value, MCContext &Context, unsigned Size, SMLoc Loc) { const MCConstantExpr *C = dyn_cast(Value); - if (C && CachedEntries.count(C->getValue())) - return CachedEntries[C->getValue()]; + + // Check if there is existing entry for the same constant. If so, reuse it. + auto Itr = C ? CachedEntries.find(C->getValue()) : CachedEntries.end(); + if (Itr != CachedEntries.end()) + return Itr->second; + MCSymbol *CPEntryLabel = Context.createTempSymbol(); Entries.push_back(ConstantPoolEntry(CPEntryLabel, Value, Size, Loc));