[llvm] 41fe98a - [TableGen] Use MapVector to remove non-determinism
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 25 00:16:23 PST 2024
Author: Wang Pengcheng
Date: 2024-01-25T16:16:19+08:00
New Revision: 41fe98a6e7e5cdcab4a4e9e0d09339231f480c01
URL: https://github.com/llvm/llvm-project/commit/41fe98a6e7e5cdcab4a4e9e0d09339231f480c01
DIFF: https://github.com/llvm/llvm-project/commit/41fe98a6e7e5cdcab4a4e9e0d09339231f480c01.diff
LOG: [TableGen] Use MapVector to remove non-determinism
This fixes found non-determinism when `LLVM_REVERSE_ITERATION`
option is `ON`.
Fixes #79420.
Reviewers: ilovepi, MaskRay
Reviewed By: MaskRay
Pull Request: https://github.com/llvm/llvm-project/pull/79411
Added:
Modified:
llvm/test/TableGen/address-space-patfrags.td
llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/test/TableGen/address-space-patfrags.td b/llvm/test/TableGen/address-space-patfrags.td
index 4aec6ea7e0eae8..46050a70720fbe 100644
--- a/llvm/test/TableGen/address-space-patfrags.td
+++ b/llvm/test/TableGen/address-space-patfrags.td
@@ -46,7 +46,7 @@ def inst_d : Instruction {
let InOperandList = (ins GPR32:$src0, GPR32:$src1);
}
-// SDAG: case 1: {
+// SDAG: case 0: {
// SDAG-NEXT: // Predicate_pat_frag_b
// SDAG-NEXT: // Predicate_truncstorei16_addrspace
// SDAG-NEXT: SDNode *N = Node;
@@ -69,7 +69,7 @@ def : Pat <
>;
-// SDAG: case 6: {
+// SDAG: case 4: {
// SDAG: // Predicate_pat_frag_a
// SDAG-NEXT: SDNode *N = Node;
// SDAG-NEXT: (void)N;
diff --git a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
index 455183987b7b27..50156d34528c15 100644
--- a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
@@ -57,7 +57,8 @@ class MatcherTableEmitter {
// We de-duplicate the predicates by code string, and use this map to track
// all the patterns with "identical" predicates.
- StringMap<TinyPtrVector<TreePattern *>> NodePredicatesByCodeToRun;
+ MapVector<std::string, TinyPtrVector<TreePattern *>, StringMap<unsigned>>
+ NodePredicatesByCodeToRun;
std::vector<std::string> PatternPredicates;
More information about the llvm-commits
mailing list