[PATCH] D74534: [Float2Int] Make iteration over Roots deterministic
Bjorn Pettersson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 10 18:19:42 PDT 2020
bjope updated this revision to Diff 256725.
bjope added a comment.
Herald added a subscriber: hiraditya.
Removed the need for D74533 <https://reviews.llvm.org/D74533> as pre-commit, by removing the passing of
the Roots member variable as argument to member functions.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74534/new/
https://reviews.llvm.org/D74534
Files:
llvm/include/llvm/Transforms/Scalar/Float2Int.h
llvm/lib/Transforms/Scalar/Float2Int.cpp
Index: llvm/lib/Transforms/Scalar/Float2Int.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/Float2Int.cpp
+++ llvm/lib/Transforms/Scalar/Float2Int.cpp
@@ -120,8 +120,7 @@
// Find the roots - instructions that convert from the FP domain to
// integer domain.
-void Float2IntPass::findRoots(Function &F, const DominatorTree &DT,
- SmallPtrSet<Instruction*,8> &Roots) {
+void Float2IntPass::findRoots(Function &F, const DominatorTree &DT) {
for (BasicBlock &BB : F) {
// Unreachable code can take on strange forms that we are not prepared to
// handle. For example, an instruction may have itself as an operand.
@@ -184,7 +183,7 @@
// Breadth-first walk of the use-def graph; determine the set of nodes
// we care about and eagerly determine if some of them are poisonous.
-void Float2IntPass::walkBackwards(const SmallPtrSetImpl<Instruction*> &Roots) {
+void Float2IntPass::walkBackwards() {
std::deque<Instruction*> Worklist(Roots.begin(), Roots.end());
while (!Worklist.empty()) {
Instruction *I = Worklist.back();
@@ -525,9 +524,9 @@
Ctx = &F.getParent()->getContext();
- findRoots(F, DT, Roots);
+ findRoots(F, DT);
- walkBackwards(Roots);
+ walkBackwards();
walkForwards();
bool Modified = validateAndTransform();
Index: llvm/include/llvm/Transforms/Scalar/Float2Int.h
===================================================================
--- llvm/include/llvm/Transforms/Scalar/Float2Int.h
+++ 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"
@@ -30,20 +31,19 @@
bool runImpl(Function &F, const DominatorTree &DT);
private:
- void findRoots(Function &F, const DominatorTree &DT,
- SmallPtrSet<Instruction *, 8> &Roots);
+ void findRoots(Function &F, const DominatorTree &DT);
void seen(Instruction *I, ConstantRange R);
ConstantRange badRange();
ConstantRange unknownRange();
ConstantRange validateRange(ConstantRange R);
- void walkBackwards(const SmallPtrSetImpl<Instruction *> &Roots);
+ void walkBackwards();
void walkForwards();
bool validateAndTransform();
Value *convert(Instruction *I, Type *ToTy);
void cleanup();
MapVector<Instruction *, ConstantRange> SeenInsts;
- SmallPtrSet<Instruction *, 8> Roots;
+ SmallSetVector<Instruction *, 8> Roots;
EquivalenceClasses<Instruction *> ECs;
MapVector<Instruction *, Value *> ConvertedInsts;
LLVMContext *Ctx;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74534.256725.patch
Type: text/x-patch
Size: 2694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200411/ebea76b4/attachment.bin>
More information about the llvm-commits
mailing list