This is an archive of the discontinued LLVM Phabricator instance.

Use LLVM's DenseSet insteead of unordered_set.
ClosedPublic

Authored by ruiu on Feb 13 2018, 1:21 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

ruiu created this revision.Feb 13 2018, 1:21 PM
efriedma added inline comments.
lld/wasm/SymbolTable.cpp
37 ↗(On Diff #134106)

Don't you need a SetVector here?

ruiu added inline comments.Feb 13 2018, 1:39 PM
lld/wasm/SymbolTable.cpp
37 ↗(On Diff #134106)

Forgive my ignorance, but what's the difference between DenseSet and SetVector?

efriedma added inline comments.Feb 13 2018, 1:48 PM
lld/wasm/SymbolTable.cpp
37 ↗(On Diff #134106)

Iterating over a SetVector produces values in the order they were inserted; iterating over a DenseSet uses an arbitrary ordering. See http://llvm.org/docs/ProgrammersManual.html#llvm-adt-setvector-h .

ruiu added inline comments.Feb 13 2018, 1:49 PM
lld/wasm/SymbolTable.cpp
37 ↗(On Diff #134106)

Ah, thanks. This code is to produce error messages, so the order of the output of this code doesn't have to be deterministic, but it is still nice if it's deterministic. I'll make a change to use SetVector.

ruiu updated this revision to Diff 134112.Feb 13 2018, 2:12 PM
  • use SetVector instead of DenseMap
sbc100 accepted this revision.Feb 13 2018, 2:29 PM
This revision is now accepted and ready to land.Feb 13 2018, 2:29 PM
This revision was automatically updated to reflect the committed changes.