From dbc32e2aa72ed1a46c85160755820c471689dcc1 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Fri, 11 Mar 2022 19:13:58 +0100 Subject: [PATCH] [LoopUnswitch] Use SmallPtrSet instead of std::set. NFCI. --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp index 48ca8499bd20..94e975ccf050 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -76,7 +76,6 @@ #include #include #include -#include #include #include #include @@ -904,9 +903,9 @@ bool LoopUnswitch::processCurrentLoop() { /// If true, we return true and set ExitBB to the block we /// exit through. /// -static bool isTrivialLoopExitBlockHelper(Loop *L, BasicBlock *BB, - BasicBlock *&ExitBB, - std::set &Visited) { +static bool +isTrivialLoopExitBlockHelper(Loop *L, BasicBlock *BB, BasicBlock *&ExitBB, + SmallPtrSet &Visited) { if (!Visited.insert(BB).second) { // Already visited. Without more analysis, this could indicate an infinite // loop. @@ -940,7 +939,7 @@ static bool isTrivialLoopExitBlockHelper(Loop *L, BasicBlock *BB, /// the specified loop, and has no side-effects in the process. If so, return /// the block that is exited to, otherwise return null. static BasicBlock *isTrivialLoopExitBlock(Loop *L, BasicBlock *BB) { - std::set Visited; + SmallPtrSet Visited; Visited.insert(L->getHeader()); // Branches to header make infinite loops. BasicBlock *ExitBB = nullptr; if (isTrivialLoopExitBlockHelper(L, BB, ExitBB, Visited))