[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
This commit is contained in:
Chandler Carruth 2015-02-13 04:06:08 +00:00
parent 6a12276573
commit 2640fd5bae

View File

@ -519,6 +519,7 @@ public:
auto EnqueueOperands = [&](Instruction &I) {
for (auto *Op : I.operand_values())
if (auto *OpI = dyn_cast<Instruction>(Op))
if (!OpI->use_empty())
Worklist.insert(OpI);
};
@ -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<Instruction>(U);