[llvm] [TableGen] Use MapVector to remove non-determinism (PR #79411)
Wang Pengcheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 24 23:14:31 PST 2024
https://github.com/wangpc-pp created https://github.com/llvm/llvm-project/pull/79411
This fixes found non-determinism when `LLVM_REVERSE_ITERATION`
option is `ON`.
>From b819d7c52a2bb5347719dc483eba6c77c7db9e55 Mon Sep 17 00:00:00 2001
From: wangpc <wangpengcheng.pp at bytedance.com>
Date: Thu, 25 Jan 2024 15:14:20 +0800
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.4
---
llvm/test/TableGen/address-space-patfrags.td | 4 ++--
llvm/utils/TableGen/DAGISelMatcherEmitter.cpp | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
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