[llvm] fdf9bad - [Float2Int] Stop passing around a reference to the class member Roots. NFC
Bjorn Pettersson via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 16 06:24:39 PDT 2020
Author: Bjorn Pettersson
Date: 2020-04-16T15:24:13+02:00
New Revision: fdf9bad573c11760a4c83586bb48dbc3cd9d96c7
URL: https://github.com/llvm/llvm-project/commit/fdf9bad573c11760a4c83586bb48dbc3cd9d96c7
DIFF: https://github.com/llvm/llvm-project/commit/fdf9bad573c11760a4c83586bb48dbc3cd9d96c7.diff
LOG: [Float2Int] Stop passing around a reference to the class member Roots. NFC
The Float2IntPass got a class member called Roots, but Roots
was also passed around to member function as a reference. This
patch simply remove those references.
Added:
Modified:
llvm/include/llvm/Transforms/Scalar/Float2Int.h
llvm/lib/Transforms/Scalar/Float2Int.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Scalar/Float2Int.h b/llvm/include/llvm/Transforms/Scalar/Float2Int.h
index f04b98a19d82..d7f36456fc2b 100644
--- a/llvm/include/llvm/Transforms/Scalar/Float2Int.h
+++ b/llvm/include/llvm/Transforms/Scalar/Float2Int.h
@@ -30,13 +30,12 @@ class Float2IntPass : public PassInfoMixin<Float2IntPass> {
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);
diff --git a/llvm/lib/Transforms/Scalar/Float2Int.cpp b/llvm/lib/Transforms/Scalar/Float2Int.cpp
index 33b0712bfe49..83f4c402ed4d 100644
--- a/llvm/lib/Transforms/Scalar/Float2Int.cpp
+++ b/llvm/lib/Transforms/Scalar/Float2Int.cpp
@@ -120,8 +120,7 @@ static Instruction::BinaryOps mapBinOpcode(unsigned Opcode) {
// 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 @@ ConstantRange Float2IntPass::validateRange(ConstantRange R) {
// 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 @@ bool Float2IntPass::runImpl(Function &F, const DominatorTree &DT) {
Ctx = &F.getParent()->getContext();
- findRoots(F, DT, Roots);
+ findRoots(F, DT);
- walkBackwards(Roots);
+ walkBackwards();
walkForwards();
bool Modified = validateAndTransform();
More information about the llvm-commits
mailing list