diff --git a/llvm/lib/Support/StringMap.cpp b/llvm/lib/Support/StringMap.cpp --- a/llvm/lib/Support/StringMap.cpp +++ b/llvm/lib/Support/StringMap.cpp @@ -12,6 +12,7 @@ #include "llvm/ADT/StringMap.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Support/ReverseIteration.h" #include "llvm/Support/xxhash.h" using namespace llvm; @@ -85,6 +86,8 @@ if (NumBuckets == 0) init(16); unsigned FullHashValue = xxHash64(Name); + if (shouldReverseIterate()) + FullHashValue = ~FullHashValue; unsigned BucketNo = FullHashValue & (NumBuckets - 1); unsigned *HashTable = getHashTable(TheTable, NumBuckets); @@ -140,6 +143,8 @@ if (NumBuckets == 0) return -1; // Really empty table? unsigned FullHashValue = xxHash64(Key); + if (shouldReverseIterate()) + FullHashValue = ~FullHashValue; unsigned BucketNo = FullHashValue & (NumBuckets - 1); unsigned *HashTable = getHashTable(TheTable, NumBuckets); diff --git a/llvm/test/CMakeLists.txt b/llvm/test/CMakeLists.txt --- a/llvm/test/CMakeLists.txt +++ b/llvm/test/CMakeLists.txt @@ -22,6 +22,7 @@ LLVM_INLINER_MODEL_AUTOGENERATED LLVM_RAEVICT_MODEL_AUTOGENERATED LLVM_ENABLE_EXPENSIVE_CHECKS + LLVM_ENABLE_REVERSE_ITERATION LLVM_INCLUDE_DXIL_TESTS LLVM_TOOL_LLVM_DRIVER_BUILD ) diff --git a/llvm/test/CodeGen/MIR/AMDGPU/virtreg-uses-unallocatable-class.mir b/llvm/test/CodeGen/MIR/AMDGPU/virtreg-uses-unallocatable-class.mir --- a/llvm/test/CodeGen/MIR/AMDGPU/virtreg-uses-unallocatable-class.mir +++ b/llvm/test/CodeGen/MIR/AMDGPU/virtreg-uses-unallocatable-class.mir @@ -1,3 +1,4 @@ +# UNSUPPORTED: reverse_iteration # RUN: not llc -mtriple=amdgcn-- -mcpu=gfx900 -run-pass=none -o - %s 2>&1 | FileCheck %s # Check a diagnostic is emitted if non-allocatable classes are used diff --git a/llvm/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s b/llvm/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s --- a/llvm/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s +++ b/llvm/test/ExecutionEngine/RuntimeDyld/ARM/MachO_ARM_PIC_relocations.s @@ -1,3 +1,4 @@ +# UNSUPPORTED: reverse_iteration # RUN: rm -rf %t && mkdir -p %t # RUN: llvm-mc -triple=armv7s-apple-ios7.0.0 -filetype=obj -o %t/foo.o %s # RUN: llvm-rtdyld -triple=armv7s-apple-ios7.0.0 -verify -check=%s %t/foo.o diff --git a/llvm/test/TableGen/GlobalISelCombinerMatchTableEmitter/pattern-parsing.td b/llvm/test/TableGen/GlobalISelCombinerMatchTableEmitter/pattern-parsing.td --- a/llvm/test/TableGen/GlobalISelCombinerMatchTableEmitter/pattern-parsing.td +++ b/llvm/test/TableGen/GlobalISelCombinerMatchTableEmitter/pattern-parsing.td @@ -1,3 +1,4 @@ +// UNSUPPORTED: reverse_iteration // RUN: llvm-tblgen -I %p/../../../include -gen-global-isel-combiner-matchtable \ // RUN: -gicombiner-stop-after-parse -combiners=MyCombiner %s | \ // RUN: FileCheck %s diff --git a/llvm/test/lit.site.cfg.py.in b/llvm/test/lit.site.cfg.py.in --- a/llvm/test/lit.site.cfg.py.in +++ b/llvm/test/lit.site.cfg.py.in @@ -58,6 +58,7 @@ config.llvm_inliner_model_autogenerated = @LLVM_INLINER_MODEL_AUTOGENERATED@ config.llvm_raevict_model_autogenerated = @LLVM_RAEVICT_MODEL_AUTOGENERATED@ config.expensive_checks = @LLVM_ENABLE_EXPENSIVE_CHECKS@ +config.reverse_iteration = @LLVM_ENABLE_REVERSE_ITERATION@ config.dxil_tests = @LLVM_INCLUDE_DXIL_TESTS@ config.have_llvm_driver = @LLVM_TOOL_LLVM_DRIVER_BUILD@ diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py --- a/llvm/utils/lit/lit/llvm/config.py +++ b/llvm/utils/lit/lit/llvm/config.py @@ -120,6 +120,9 @@ if have_zstd: features.add("zstd") + if getattr(config, "reverse_iteration", None): + features.add("reverse_iteration") + # Check if we should run long running tests. long_tests = lit_config.params.get("run_long_tests", None) if lit.util.pythonize_bool(long_tests):