Skip to content

Commit

Permalink
[TableGen] Use MapVector to remove non-determinism
Browse files Browse the repository at this point in the history
This fixes found non-determinism when `LLVM_REVERSE_ITERATION`
option is `ON`.

Fixes #79420.

Reviewers: ilovepi, MaskRay

Reviewed By: MaskRay

Pull Request: #79411
  • Loading branch information
wangpc-pp committed Jan 25, 2024
1 parent 2c49586 commit 41fe98a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions llvm/test/TableGen/address-space-patfrags.td
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 41fe98a

Please sign in to comment.