aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/SymbolTable.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-12-15 16:41:52 +0000
committerChris Lattner <sabre@nondot.org>2002-12-15 16:41:52 +0000
commit197ff79a8cd64d9eb059f0022e95ff74fceb8cf6 (patch)
tree15f9ff407c0876da6a004cb09230ae0afcb4c1a5 /lib/VMCore/SymbolTable.cpp
parent49f20c45ffb5aa459d2723961f2268875d39265c (diff)
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
Diffstat (limited to 'lib/VMCore/SymbolTable.cpp')
-rw-r--r--lib/VMCore/SymbolTable.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/VMCore/SymbolTable.cpp b/lib/VMCore/SymbolTable.cpp
index dab2645d29..70f23c286d 100644
--- a/lib/VMCore/SymbolTable.cpp
+++ b/lib/VMCore/SymbolTable.cpp
@@ -229,17 +229,18 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType,
// No action
} 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.
//
- Function *ExistM = dyn_cast<Function>(TI->second);
- Function *NewM = dyn_cast<Function>(V.second);
+ GlobalValue *ExistGV = dyn_cast<GlobalValue>(TI->second);
+ GlobalValue *NewGV = dyn_cast<GlobalValue>(V.second);
- if (ExistM && NewM && ExistM->isExternal() && NewM->isExternal()) {
- // Ok we have two external methods. Make all uses of the new one
- // use the old one...
+ if (ExistGV && NewGV && ExistGV->isExternal() && NewGV->isExternal()) {
+ // Ok we have two external global values. Make all uses of the new
+ // 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
// added to our symbol table. The problem is that if we call
@@ -254,12 +255,16 @@ void SymbolTable::refineAbstractType(const DerivedType *OldType,
InternallyInconsistent = true;
// Remove newM from the symtab
- NewM->setName("");
+ NewGV->setName("");
InternallyInconsistent = false;
- // Now we can remove this method from the module entirely...
- NewM->getParent()->getFunctionList().remove(NewM);
- delete NewM;
+ // Now we can remove this global from the module entirely...
+ Module *M = NewGV->getParent();
+ if (Function *F = dyn_cast<Function>(NewGV))
+ M->getFunctionList().remove(F);
+ else
+ M->getGlobalList().remove(cast<GlobalVariable>(NewGV));
+ delete NewGV;
} else {
assert(0 && "Two planes folded together with overlapping "