summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/BDCE.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/BDCE.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/BDCE.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/BDCE.cpp b/llvm/lib/Transforms/Scalar/BDCE.cpp
index afe0cd13e22..e5a7ad6388d 100644
--- a/llvm/lib/Transforms/Scalar/BDCE.cpp
+++ b/llvm/lib/Transforms/Scalar/BDCE.cpp
@@ -277,13 +277,17 @@ bool BDCE::runOnFunction(Function& F) {
if (!isAlwaysLive(&I))
continue;
+ DEBUG(dbgs() << "BDCE: Root: " << I);
// For integer-valued instructions, set up an initial empty set of alive
// bits and add the instruction to the work list. For other instructions
// add their operands to the work list (for integer values operands, mark
// all bits as live).
if (IntegerType *IT = dyn_cast<IntegerType>(I.getType())) {
- AliveBits[&I] = APInt(IT->getBitWidth(), 0);
- Worklist.push_back(&I);
+ if (!AliveBits.count(&I)) {
+ AliveBits[&I] = APInt(IT->getBitWidth(), 0);
+ Worklist.push_back(&I);
+ }
+
continue;
}
@@ -388,7 +392,6 @@ bool BDCE::runOnFunction(Function& F) {
if (isAlwaysLive(&I))
continue;
- DEBUG(dbgs() << "BDCE: Removing: " << I << " (unused)\n");
Worklist.push_back(&I);
I.dropAllReferences();
Changed = true;
OpenPOWER on IntegriCloud