mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-03-02 22:32:08 +00:00
Don't print spurious linking warnings about methods that are never used.
Cleanup ExprTypeConvert a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1141 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e4f4d8c3ec
commit
277b4e4a9b
lib/Transforms
@ -403,12 +403,11 @@ void ConvertUsersType(Value *V, Value *NewVal, ValueMapCache &VMC) {
|
||||
// loops. Note that we cannot use DCE because DCE won't remove a store
|
||||
// instruction, for example.
|
||||
//
|
||||
BasicBlock::iterator It = find(BB->begin(), BB->end(), I);
|
||||
assert(It != BB->end() && "Instruction no longer in basic block??");
|
||||
#ifdef DEBUG_EXPR_CONVERT
|
||||
cerr << "DELETING: " << (void*)I << " " << I;
|
||||
#endif
|
||||
delete BB->getInstList().remove(It);
|
||||
BB->getInstList().remove(I);
|
||||
delete I;
|
||||
}
|
||||
}
|
||||
|
||||
@ -550,12 +549,11 @@ static void ConvertOperandToType(User *U, Value *OldVal, Value *NewVal,
|
||||
// loops. Note that we cannot use DCE because DCE won't remove a store
|
||||
// instruction, for example.
|
||||
//
|
||||
BasicBlock::iterator It = find(BIL.begin(), BIL.end(), I);
|
||||
assert(It != BIL.end() && "Instruction no longer in basic block??");
|
||||
#ifdef DEBUG_EXPR_CONVERT
|
||||
cerr << "DELETING: " << (void*)I << " " << I;
|
||||
#endif
|
||||
delete BIL.remove(It);
|
||||
BIL.remove(I);
|
||||
delete I;
|
||||
} else {
|
||||
for (Value::use_iterator UI = I->use_begin(), UE = I->use_end();
|
||||
UI != UE; ++UI)
|
||||
@ -575,15 +573,13 @@ ValueHandle::~ValueHandle() {
|
||||
// instruction, for example.
|
||||
//
|
||||
Instruction *I = cast<Instruction>(V);
|
||||
BasicBlock *BB = I->getParent();
|
||||
assert(BB && "Inst not in basic block!");
|
||||
assert(I->getParent() && "Inst not in basic block!");
|
||||
|
||||
BasicBlock::iterator It = find(BB->begin(), BB->end(), I);
|
||||
assert(It != BB->end() && "Instruction no longer in basic block??");
|
||||
#ifdef DEBUG_EXPR_CONVERT
|
||||
cerr << "VH DELETING: " << (void*)I << " " << I;
|
||||
#endif
|
||||
delete BB->getInstList().remove(It);
|
||||
I->getParent()->getInstList().remove(I);
|
||||
delete I;
|
||||
} else {
|
||||
#ifdef DEBUG_EXPR_CONVERT
|
||||
cerr << "VH RELEASING: " << Operands[0];
|
||||
|
@ -105,29 +105,38 @@ bool CleanupGCCOutput::PatchUpMethodReferences(Module *M) {
|
||||
for (map<string, vector<Method*> >::iterator I = Methods.begin(),
|
||||
E = Methods.end(); I != E; ++I) {
|
||||
vector<Method*> &Methods = I->second;
|
||||
if (Methods.size() > 1) { // Found a multiply defined method.
|
||||
Method *Implementation = 0; // Find the implementation
|
||||
Method *Concrete = 0;
|
||||
for (unsigned i = 0; i < Methods.size(); ++i) {
|
||||
// TODO: Ignore methods that are never USED! DCE them.
|
||||
// Remove their name. this should fix a majority of problems here.
|
||||
|
||||
if (!Methods[i]->isExternal()) { // Found an implementation
|
||||
assert(Implementation == 0 && "Multiple definitions of the same"
|
||||
" method. Case not handled yet!");
|
||||
Implementation = Methods[i];
|
||||
}
|
||||
|
||||
if (!Methods[i]->getMethodType()->isVarArg() ||
|
||||
Methods[i]->getMethodType()->getParamTypes().size()) {
|
||||
if (Concrete) { // Found two different methods types. Can't choose
|
||||
Concrete = 0;
|
||||
break;
|
||||
}
|
||||
Concrete = Methods[i];
|
||||
Method *Implementation = 0; // Find the implementation
|
||||
Method *Concrete = 0;
|
||||
for (unsigned i = 0; i < Methods.size(); ) {
|
||||
if (!Methods[i]->isExternal()) { // Found an implementation
|
||||
assert(Implementation == 0 && "Multiple definitions of the same"
|
||||
" method. Case not handled yet!");
|
||||
Implementation = Methods[i];
|
||||
} else {
|
||||
// Ignore methods that are never used so they don't cause spurious
|
||||
// warnings... here we will actually DCE the function so that it isn't
|
||||
// used later.
|
||||
//
|
||||
if (Methods[i]->use_size() == 0) {
|
||||
M->getMethodList().remove(Methods[i]);
|
||||
delete Methods[i];
|
||||
Methods.erase(Methods.begin()+i);
|
||||
Changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (Methods[i] && (!Methods[i]->getMethodType()->isVarArg() ||
|
||||
Methods[i]->getMethodType()->getParamTypes().size())) {
|
||||
if (Concrete) { // Found two different methods types. Can't choose
|
||||
Concrete = 0;
|
||||
break;
|
||||
}
|
||||
Concrete = Methods[i];
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
if (Methods.size() > 1) { // Found a multiply defined method.
|
||||
// We should find exactly one non-vararg method definition, which is
|
||||
// probably the implementation. Change all of the method definitions
|
||||
// and uses to use it instead.
|
||||
|
Loading…
x
Reference in New Issue
Block a user