mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
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
This commit is contained in:
parent
bb9051531c
commit
00dc479613
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user