[llvm-commits] CVS: llvm/lib/VMCore/SymbolTable.cpp
Chris Lattner
lattner at cs.uiuc.edu
Sun Dec 15 10:43:01 PST 2002
Changes in directory llvm/lib/VMCore:
SymbolTable.cpp updated: 1.27 -> 1.28
---
Log message:
Fix bug: Assembler/2002-12-15-GlobalResolve.ll
---
Diffs of the changes:
Index: llvm/lib/VMCore/SymbolTable.cpp
diff -u llvm/lib/VMCore/SymbolTable.cpp:1.27 llvm/lib/VMCore/SymbolTable.cpp:1.28
--- llvm/lib/VMCore/SymbolTable.cpp:1.27 Sun Dec 15 10:20:23 2002
+++ llvm/lib/VMCore/SymbolTable.cpp Sun Dec 15 10:41:52 2002
@@ -229,17 +229,18 @@
// 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 @@
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 "
More information about the llvm-commits
mailing list