mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-12 17:32:19 +00:00
Fix bug: Assembler/2002-12-15-GlobalResolve.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5039 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
49f20c45ff
commit
197ff79a8c
@ -229,17 +229,18 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType,
|
|||||||
// No action
|
// No action
|
||||||
|
|
||||||
} else if (TI != NewPlane.end()) {
|
} else if (TI != NewPlane.end()) {
|
||||||
// The only thing we are allowing for now is two method prototypes being
|
// The only thing we are allowing for now is two external global values
|
||||||
// folded into one.
|
// folded into one.
|
||||||
//
|
//
|
||||||
Function *ExistM = dyn_cast<Function>(TI->second);
|
GlobalValue *ExistGV = dyn_cast<GlobalValue>(TI->second);
|
||||||
Function *NewM = dyn_cast<Function>(V.second);
|
GlobalValue *NewGV = dyn_cast<GlobalValue>(V.second);
|
||||||
|
|
||||||
if (ExistM && NewM && ExistM->isExternal() && NewM->isExternal()) {
|
if (ExistGV && NewGV && ExistGV->isExternal() && NewGV->isExternal()) {
|
||||||
// Ok we have two external methods. Make all uses of the new one
|
// Ok we have two external global values. Make all uses of the new
|
||||||
// use the old one...
|
// one use the old one...
|
||||||
//
|
//
|
||||||
NewM->replaceAllUsesWith(ExistM);
|
assert(ExistGV->use_empty() && "No uses allowed on untyped value!");
|
||||||
|
//NewGV->replaceAllUsesWith(ExistGV);
|
||||||
|
|
||||||
// Now we just convert it to an unnamed method... which won't get
|
// Now we just convert it to an unnamed method... which won't get
|
||||||
// added to our symbol table. The problem is that if we call
|
// added to our symbol table. The problem is that if we call
|
||||||
@ -254,12 +255,16 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType,
|
|||||||
InternallyInconsistent = true;
|
InternallyInconsistent = true;
|
||||||
|
|
||||||
// Remove newM from the symtab
|
// Remove newM from the symtab
|
||||||
NewM->setName("");
|
NewGV->setName("");
|
||||||
InternallyInconsistent = false;
|
InternallyInconsistent = false;
|
||||||
|
|
||||||
// Now we can remove this method from the module entirely...
|
// Now we can remove this global from the module entirely...
|
||||||
NewM->getParent()->getFunctionList().remove(NewM);
|
Module *M = NewGV->getParent();
|
||||||
delete NewM;
|
if (Function *F = dyn_cast<Function>(NewGV))
|
||||||
|
M->getFunctionList().remove(F);
|
||||||
|
else
|
||||||
|
M->getGlobalList().remove(cast<GlobalVariable>(NewGV));
|
||||||
|
delete NewGV;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
assert(0 && "Two planes folded together with overlapping "
|
assert(0 && "Two planes folded together with overlapping "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user