aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2004-07-17 23:50:57 +0000
committerReid Spencer <rspencer@reidspencer.com>2004-07-17 23:50:57 +0000
commit00dc4796132933e76fe2b834ca087e42621c175a (patch)
tree39eb97e5d44572c7d634154db3de4293a29e5ecc /lib
parentbb9051531c29bf425c78b88dd96aba601e00656d (diff)
downloadexternal_llvm-00dc4796132933e76fe2b834ca087e42621c175a.zip
external_llvm-00dc4796132933e76fe2b834ca087e42621c175a.tar.gz
external_llvm-00dc4796132933e76fe2b834ca087e42621c175a.tar.bz2
bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage - Correct isa<Constant> for GlobalValue subclass git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14930 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Linker/LinkModules.cpp11
-rw-r--r--lib/VMCore/Linker.cpp11
2 files changed, 8 insertions, 14 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index b241d9e..4cd852c 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -307,10 +307,8 @@ static Value *RemapOperand(const Value *In,
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 @@ static bool LinkAppendingVars(Module *M,
// 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);
diff --git a/lib/VMCore/Linker.cpp b/lib/VMCore/Linker.cpp
index b241d9e..4cd852c 100644
--- a/lib/VMCore/Linker.cpp
+++ b/lib/VMCore/Linker.cpp
@@ -307,10 +307,8 @@ static Value *RemapOperand(const Value *In,
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 @@ static bool LinkAppendingVars(Module *M,
// 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);