[llvm] 4e7e414 - [Float2Int] Make iteration over Roots deterministic
Bjorn Pettersson via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 17 12:40:53 PDT 2020
Author: Bjorn Pettersson
Date: 2020-04-17T21:40:12+02:00
New Revision: 4e7e414ec943b264e5104c797b2f4a7af5151f71
URL: https://github.com/llvm/llvm-project/commit/4e7e414ec943b264e5104c797b2f4a7af5151f71
DIFF: https://github.com/llvm/llvm-project/commit/4e7e414ec943b264e5104c797b2f4a7af5151f71.diff
LOG: [Float2Int] Make iteration over Roots deterministic
Summary:
Use a SmallSetVector instead of a SmallPtrSet when collecting
and storing Roots.
The iteration order for a SmallPtrSet is not deterministic,
so in the past the order of items inserted in the WorkList
inside walkBackwards has been non-deterministic. This patch
intends to make the order of rewrites done in Float2Int
deterministic by changing the container for the Roots set.
The semantics result of the transformation should not be
any different afaict. But at least naming of IR variables
(when outputting the result as an ll file) should be more
stable now.
Reviewers: craig.topper, spatel, cameron.mcinally
Reviewed By: spatel
Subscribers: mgrang, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74534
Added:
Modified:
llvm/include/llvm/Transforms/Scalar/Float2Int.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Scalar/Float2Int.h b/llvm/include/llvm/Transforms/Scalar/Float2Int.h
index d7f36456fc2b..5fb47af6f795 100644
--- a/llvm/include/llvm/Transforms/Scalar/Float2Int.h
+++ b/llvm/include/llvm/Transforms/Scalar/Float2Int.h
@@ -16,6 +16,7 @@
#include "llvm/ADT/EquivalenceClasses.h"
#include "llvm/ADT/MapVector.h"
+#include "llvm/ADT/SetVector.h"
#include "llvm/IR/ConstantRange.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
@@ -42,7 +43,7 @@ class Float2IntPass : public PassInfoMixin<Float2IntPass> {
void cleanup();
MapVector<Instruction *, ConstantRange> SeenInsts;
- SmallPtrSet<Instruction *, 8> Roots;
+ SmallSetVector<Instruction *, 8> Roots;
EquivalenceClasses<Instruction *> ECs;
MapVector<Instruction *, Value *> ConvertedInsts;
LLVMContext *Ctx;
More information about the llvm-commits
mailing list