forked from OSchip/llvm-project
[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. llvm-svn: 229056
This commit is contained in:
parent
d9cb620330
commit
82cb30f10c
|
@ -519,7 +519,8 @@ public:
|
|||
auto EnqueueOperands = [&](Instruction &I) {
|
||||
for (auto *Op : I.operand_values())
|
||||
if (auto *OpI = dyn_cast<Instruction>(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<Instruction>(U);
|
||||
|
|
Loading…
Reference in New Issue