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;
}
if (isAlwaysLive(&I))
continue;
- DEBUG(dbgs() << "BDCE: Removing: " << I << " (unused)\n");
Worklist.push_back(&I);
I.dropAllReferences();
Changed = true;