[PATCH] D155789: [Support] Implement LLVM_ENABLE_REVERSE_ITERATION for StringMap

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 20 00:25:45 PDT 2023


MaskRay created this revision.
MaskRay added reviewers: dblaikie, erikdesjardins, JDevlieghere, lhames, serge-sans-paille, jhenderson.
Herald added subscribers: hoy, wlei, wenlei, kerbowa, delcypher, hiraditya, jvesely.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added subscribers: llvm-commits, wangpc.
Herald added a project: LLVM.

ProgrammersManual.html says

> StringMap iteration order, however, is not guaranteed to be deterministic, so any uses which require that should instead use a std::map.

This patch makes -DLLVM_ENABLE_REVERSE_ITERATION=on reverse StringMap
iteration order (actually reversing stored elements) to catch
violations. Similar to D35043 <https://reviews.llvm.org/D35043> for DenseMap.
This should help change the hash function (e.g., D155781 <https://reviews.llvm.org/D155781>).

With a lot of fixes, there are still still violations. This patch
implements the "reverse_iteration" feature to skip such tests.
Eventually we should remove this feature.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155789

Files:
  llvm/lib/Support/StringMap.cpp
  llvm/test/CMakeLists.txt
  llvm/test/CodeGen/MIR/AMDGPU/virtreg-uses-unallocatable-class.mir
  llvm/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s
  llvm/test/TableGen/GlobalISelCombinerMatchTableEmitter/pattern-parsing.td
  llvm/test/lit.site.cfg.py.in
  llvm/test/tools/llvm-profdata/suppl-instr-with-sample.test
  llvm/utils/lit/lit/llvm/config.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155789.542334.patch
Type: text/x-patch
Size: 4454 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230720/17734e6b/attachment.bin>


More information about the llvm-commits mailing list