Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SCCP] fix non-determinism #105758

Merged
merged 3 commits into from
Aug 23, 2024
Merged

Conversation

fmayer
Copy link
Contributor

@fmayer fmayer commented Aug 23, 2024

the visit order depended on hashing because we iterated over a
SmallPtrSet

Created using spr 1.3.4
@llvmbot
Copy link
Member

llvmbot commented Aug 23, 2024

@llvm/pr-subscribers-backend-x86
@llvm/pr-subscribers-function-specialization

@llvm/pr-subscribers-llvm-transforms

Author: Florian Mayer (fmayer)

Changes

the visit order depended on hashing because we iterated over a
SmallPtrSet


Full diff: https://github.com/llvm/llvm-project/pull/105758.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/Utils/SCCPSolver.cpp (+2-1)
diff --git a/llvm/lib/Transforms/Utils/SCCPSolver.cpp b/llvm/lib/Transforms/Utils/SCCPSolver.cpp
index 40f0f04c323ddc..670d88ac7cf8fa 100644
--- a/llvm/lib/Transforms/Utils/SCCPSolver.cpp
+++ b/llvm/lib/Transforms/Utils/SCCPSolver.cpp
@@ -13,6 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Transforms/Utils/SCCPSolver.h"
+#include "llvm/ADT/SetVector.h"
 #include "llvm/Analysis/ConstantFolding.h"
 #include "llvm/Analysis/InstructionSimplify.h"
 #include "llvm/Analysis/ValueLattice.h"
@@ -418,7 +419,7 @@ class SCCPInstVisitor : public InstVisitor<SCCPInstVisitor> {
 
   DenseMap<Function *, std::unique_ptr<PredicateInfo>> FnPredicateInfo;
 
-  DenseMap<Value *, SmallPtrSet<User *, 2>> AdditionalUsers;
+  DenseMap<Value *, SmallSetVector<User *, 2>> AdditionalUsers;
 
   LLVMContext &Ctx;
 

@fmayer fmayer requested a review from nikic August 23, 2024 00:54
Created using spr 1.3.4
Copy link
Contributor

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Created using spr 1.3.4
@fmayer
Copy link
Contributor Author

fmayer commented Aug 23, 2024

presubmit failure seems like an infra issue, is happening on all recent PRs.

@fmayer fmayer merged commit aec3ec0 into main Aug 23, 2024
6 of 8 checks passed
@fmayer fmayer deleted the users/fmayer/spr/sccp-fix-non-determinism branch August 23, 2024 16:45
cjdb pushed a commit to cjdb/llvm-project that referenced this pull request Aug 23, 2024
the visit order depended on hashing because we iterated over a
SmallPtrSet
5chmidti pushed a commit that referenced this pull request Aug 24, 2024
the visit order depended on hashing because we iterated over a
SmallPtrSet
dmpolukhin pushed a commit to dmpolukhin/llvm-project that referenced this pull request Sep 2, 2024
the visit order depended on hashing because we iterated over a
SmallPtrSet
fmayer added a commit to fmayer/llvm-project that referenced this pull request Sep 13, 2024
the visit order depended on hashing because we iterated over a
SmallPtrSet

Ordering of codegen of one test changed, but is equivalent

Reviewers: nikic

Reviewed By: nikic

Pull Request: llvm#105758
jroelofs pushed a commit to swiftlang/llvm-project that referenced this pull request Oct 29, 2024
the visit order depended on hashing because we iterated over a
SmallPtrSet

(cherry picked from commit aec3ec0)
jroelofs pushed a commit to swiftlang/llvm-project that referenced this pull request Oct 30, 2024
the visit order depended on hashing because we iterated over a
SmallPtrSet

(cherry picked from commit aec3ec0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants