diff --git a/llvm/include/llvm/Transforms/Scalar/Float2Int.h b/llvm/include/llvm/Transforms/Scalar/Float2Int.h --- 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" @@ -30,20 +31,19 @@ bool runImpl(Function &F, const DominatorTree &DT); private: - void findRoots(Function &F, const DominatorTree &DT, - SmallPtrSet &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 &Roots); + void walkBackwards(); void walkForwards(); bool validateAndTransform(); Value *convert(Instruction *I, Type *ToTy); void cleanup(); MapVector SeenInsts; - SmallPtrSet Roots; + SmallSetVector Roots; EquivalenceClasses ECs; MapVector ConvertedInsts; LLVMContext *Ctx; diff --git a/llvm/lib/Transforms/Scalar/Float2Int.cpp b/llvm/lib/Transforms/Scalar/Float2Int.cpp --- a/llvm/lib/Transforms/Scalar/Float2Int.cpp +++ b/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 &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 &Roots) { +void Float2IntPass::walkBackwards() { std::deque 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();