mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 22:24:07 +00:00
Previously, all operands to Constant were themselves constant.
In the new world order, BlockAddress can have a BasicBlock operand. This doesn't permute much, because if you have a ConstantExpr (or anything more specific than Constant) we still know the operand has to be a Constant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85375 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -112,11 +112,11 @@ static bool OnlyUsedBy(Value *V, Value *Usr) {
|
||||
|
||||
static void RemoveDeadConstant(Constant *C) {
|
||||
assert(C->use_empty() && "Constant is not dead!");
|
||||
SmallPtrSet<Constant *, 4> Operands;
|
||||
SmallPtrSet<Constant*, 4> Operands;
|
||||
for (unsigned i = 0, e = C->getNumOperands(); i != e; ++i)
|
||||
if (isa<DerivedType>(C->getOperand(i)->getType()) &&
|
||||
OnlyUsedBy(C->getOperand(i), C))
|
||||
Operands.insert(C->getOperand(i));
|
||||
Operands.insert(cast<Constant>(C->getOperand(i)));
|
||||
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(C)) {
|
||||
if (!GV->hasLocalLinkage()) return; // Don't delete non static globals.
|
||||
GV->eraseFromParent();
|
||||
@ -126,7 +126,7 @@ static void RemoveDeadConstant(Constant *C) {
|
||||
C->destroyConstant();
|
||||
|
||||
// If the constant referenced anything, see if we can delete it as well.
|
||||
for (SmallPtrSet<Constant *, 4>::iterator OI = Operands.begin(),
|
||||
for (SmallPtrSet<Constant*, 4>::iterator OI = Operands.begin(),
|
||||
OE = Operands.end(); OI != OE; ++OI)
|
||||
RemoveDeadConstant(*OI);
|
||||
}
|
||||
@ -305,8 +305,7 @@ bool StripDebugDeclare::runOnModule(Module &M) {
|
||||
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(C)) {
|
||||
if (GV->hasLocalLinkage())
|
||||
RemoveDeadConstant(GV);
|
||||
}
|
||||
else
|
||||
} else
|
||||
RemoveDeadConstant(C);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user