aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2015-02-13 04:14:05 +0000
committerChandler Carruth <chandlerc@gmail.com>2015-02-13 04:14:05 +0000
commit06d537cdd68d8b3ece5862be1e0097b8113d390c (patch)
treec1b3c49d0079eed52f056c1d8f0678ec525319e2
parent82cb30f10cf0849b876e6722e0a2305c91855239 (diff)
downloadllvm-06d537cdd68d8b3ece5862be1e0097b8113d390c.zip
llvm-06d537cdd68d8b3ece5862be1e0097b8113d390c.tar.gz
llvm-06d537cdd68d8b3ece5862be1e0097b8113d390c.tar.bz2
[unroll] Directly query for dead instructions.
In the unroll analyzer, it is checking each user to see if that user will become dead. However, it first checked if that user was missing from the simplified values map, and then if was also missing from the dead instructions set. We add everything from the simplified values map to the dead instructions set, so the first step is completely subsumed by the second. Moreover, the first step requires *inserting* something into the simplified value map which isn't what we want at all. This also replaces a dyn_cast with a cast as an instruction cannot be used by a non-instruction. llvm-svn: 229057
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
index 37851ba..4c57c92 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp
@@ -543,13 +543,12 @@ public:
if (DeadInstructions.count(I))
continue;
bool AllUsersFolded = true;
- for (User *U : I->users()) {
- Instruction *UI = dyn_cast<Instruction>(U);
- if (!SimplifiedValues[UI] && !DeadInstructions.count(UI)) {
+ for (User *U : I->users())
+ if (!DeadInstructions.count(cast<Instruction>(U))) {
AllUsersFolded = false;
break;
}
- }
+
if (AllUsersFolded) {
NumberOfOptimizedInstructions += TTI.getUserCost(I);
DeadInstructions.insert(I);