Type *T = J->getType();
if (T->isIntOrIntVectorTy())
AliveBits[J] = APInt::getAllOnesValue(T->getScalarSizeInBits());
+ else
+ Visited.insert(J);
Worklist.insert(J);
}
}
LLVM_DEBUG(dbgs() << "DemandedBits: Visiting: " << *UserI);
APInt AOut;
+ bool InputIsKnownDead = false;
if (UserI->getType()->isIntOrIntVectorTy()) {
AOut = AliveBits[UserI];
LLVM_DEBUG(dbgs() << " Alive Out: 0x"
<< Twine::utohexstr(AOut.getLimitedValue()));
+
+ // If all bits of the output are dead, then all bits of the input
+ // are also dead.
+ InputIsKnownDead = !AOut && !isAlwaysLive(UserI);
}
LLVM_DEBUG(dbgs() << "\n");
- if (!UserI->getType()->isIntOrIntVectorTy())
- Visited.insert(UserI);
-
KnownBits Known, Known2;
bool KnownBitsComputed = false;
// Compute the set of alive bits for each operand. These are anded into the
if (T->isIntOrIntVectorTy()) {
unsigned BitWidth = T->getScalarSizeInBits();
APInt AB = APInt::getAllOnesValue(BitWidth);
- if (UserI->getType()->isIntOrIntVectorTy() && !AOut &&
- !isAlwaysLive(UserI)) {
- // If all bits of the output are dead, then all bits of the input
- // are also dead.
+ if (InputIsKnownDead) {
AB = APInt(BitWidth, 0);
} else {
// Bits of each operand that are used to compute alive bits of the
Worklist.insert(I);
}
}
- } else if (I && !Visited.count(I)) {
+ } else if (I && Visited.insert(I).second) {
Worklist.insert(I);
}
}