[PATCH] D74533: [Float2Int] Use a type alias for the RootSet. NFC
Bjorn Pettersson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 13 01:55:12 PST 2020
bjope created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
Use a type alias for the RootSet declaration in Float2IntPass.
This is just a minor refactoring in case we want to change the
type in the future (e.g. to something with deterministic iteration
order).
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D74533
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
@@ -121,7 +121,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) {
+ RootSet &Roots) {
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 +184,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(const RootSet &Roots) {
std::deque<Instruction*> Worklist(Roots.begin(), Roots.end());
while (!Worklist.empty()) {
Instruction *I = Worklist.back();
Index: llvm/include/llvm/Transforms/Scalar/Float2Int.h
===================================================================
--- llvm/include/llvm/Transforms/Scalar/Float2Int.h
+++ llvm/include/llvm/Transforms/Scalar/Float2Int.h
@@ -30,20 +30,22 @@
bool runImpl(Function &F, const DominatorTree &DT);
private:
+ using RootSet = SmallPtrSet<Instruction *, 8>;
+
void findRoots(Function &F, const DominatorTree &DT,
- SmallPtrSet<Instruction *, 8> &Roots);
+ RootSet &Roots);
void seen(Instruction *I, ConstantRange R);
ConstantRange badRange();
ConstantRange unknownRange();
ConstantRange validateRange(ConstantRange R);
- void walkBackwards(const SmallPtrSetImpl<Instruction *> &Roots);
+ void walkBackwards(const RootSet &Roots);
void walkForwards();
bool validateAndTransform();
Value *convert(Instruction *I, Type *ToTy);
void cleanup();
MapVector<Instruction *, ConstantRange> SeenInsts;
- SmallPtrSet<Instruction *, 8> Roots;
+ RootSet Roots;
EquivalenceClasses<Instruction *> ECs;
MapVector<Instruction *, Value *> ConvertedInsts;
LLVMContext *Ctx;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74533.244361.patch
Type: text/x-patch
Size: 2264 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200213/814d5c6b/attachment.bin>
More information about the llvm-commits
mailing list