[llvm-commits] CVS: llvm/lib/VMCore/Linker.cpp
LLVM
llvm at cs.uiuc.edu
Sat Jul 17 16:51:07 PDT 2004
Changes in directory llvm/lib/VMCore:
Linker.cpp updated: 1.73 -> 1.74
---
Log message:
bug 122: http://llvm.cs.uiuc.edu/PR122 :
- Replace ConstantPointerRef usage with GlobalValue usage
- Correct isa<Constant> for GlobalValue subclass
---
Diffs of the changes: (+4 -7)
Index: llvm/lib/VMCore/Linker.cpp
diff -u llvm/lib/VMCore/Linker.cpp:1.73 llvm/lib/VMCore/Linker.cpp:1.74
--- llvm/lib/VMCore/Linker.cpp:1.73 Sun Jul 4 06:52:49 2004
+++ llvm/lib/VMCore/Linker.cpp Sat Jul 17 18:50:57 2004
@@ -307,10 +307,8 @@
Result = ConstantStruct::get(cast<StructType>(CPS->getType()), Operands);
} else if (isa<ConstantPointerNull>(CPV)) {
Result = const_cast<Constant*>(CPV);
- } else if (const ConstantPointerRef *CPR =
- dyn_cast<ConstantPointerRef>(CPV)) {
- Value *V = RemapOperand(CPR->getValue(), LocalMap, GlobalMap);
- Result = ConstantPointerRef::get(cast<GlobalValue>(V));
+ } else if (isa<GlobalValue>(CPV)) {
+ Result = cast<Constant>(RemapOperand(CPV, LocalMap, GlobalMap));
} else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CPV)) {
if (CE->getOpcode() == Instruction::GetElementPtr) {
Value *Ptr = RemapOperand(CE->getOperand(0), LocalMap, GlobalMap);
@@ -834,9 +832,8 @@
// FIXME: This should rewrite simple/straight-forward uses such as
// getelementptr instructions to not use the Cast!
- ConstantPointerRef *NGCP = ConstantPointerRef::get(NG);
- G1->replaceAllUsesWith(ConstantExpr::getCast(NGCP, G1->getType()));
- G2->replaceAllUsesWith(ConstantExpr::getCast(NGCP, G2->getType()));
+ G1->replaceAllUsesWith(ConstantExpr::getCast(NG, G1->getType()));
+ G2->replaceAllUsesWith(ConstantExpr::getCast(NG, G2->getType()));
// Remove the two globals from the module now...
M->getGlobalList().erase(G1);
More information about the llvm-commits
mailing list