diff --git a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp index c7b88d3c48a69..2c2400d9dd7a8 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollAndJam.cpp @@ -139,11 +139,9 @@ static bool processHeaderPhiOperands(BasicBlock *Header, BasicBlock *Latch, SmallPtrSet VisitedInstr; std::function ProcessInstr = [&](Instruction *I) { - if (VisitedInstr.count(I)) + if (!VisitedInstr.insert(I).second) return true; - VisitedInstr.insert(I); - if (AftBlocks.count(I->getParent())) for (auto &U : I->operands()) if (Instruction *II = dyn_cast(U))