From: Chandler Carruth Date: Fri, 13 Feb 2015 04:06:08 +0000 (+0000) Subject: [unroll] Replace a linear time check for no uses with a constant time X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=2640fd5bae01dfdb7d07178c0a71cdbf8a519db6;hp=6a1227657333bf6a38924cda18d4b3bc677fc560;p=oota-llvm.git [unroll] Replace a linear time check for no uses with a constant time check. Also hoist this into the enqueue process as it is faster even than testing the worklist set, we should just directly filter these out much like we filter out constants and such. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229056 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/LoopUnrollPass.cpp b/lib/Transforms/Scalar/LoopUnrollPass.cpp index d1daaa684ad..37851ba87da 100644 --- a/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -519,7 +519,8 @@ public: auto EnqueueOperands = [&](Instruction &I) { for (auto *Op : I.operand_values()) if (auto *OpI = dyn_cast(Op)) - Worklist.insert(OpI); + if (!OpI->use_empty()) + Worklist.insert(OpI); }; // Start by initializing worklist with simplified instructions. @@ -541,8 +542,6 @@ public: continue; if (DeadInstructions.count(I)) continue; - if (I->getNumUses() == 0) - continue; bool AllUsersFolded = true; for (User *U : I->users()) { Instruction *UI = dyn_cast(U);