summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2015-02-13 04:06:08 +0000
committerChandler Carruth <chandlerc@gmail.com>2015-02-13 04:06:08 +0000
commit82cb30f10cf0849b876e6722e0a2305c91855239 (patch)
tree40d9c05a8de0c7bd4fad54d96e5fb9736eccf27f
parentd9cb6203303e8aff32ed0e96c3cabf0e4e2ffb44 (diff)
downloadbcm5719-llvm-82cb30f10cf0849b876e6722e0a2305c91855239.tar.gz
bcm5719-llvm-82cb30f10cf0849b876e6722e0a2305c91855239.zip
[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
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
index d1daaa684ad..37851ba87da 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ b/llvm/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<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);
OpenPOWER on IntegriCloud