mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +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@14947 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
48dc46a512
commit
21cb67e16a
@ -175,13 +175,13 @@ private:
|
|||||||
hash_map<Value*, InstVal>::iterator I = ValueState.find(V);
|
hash_map<Value*, InstVal>::iterator I = ValueState.find(V);
|
||||||
if (I != ValueState.end()) return I->second; // Common case, in the map
|
if (I != ValueState.end()) return I->second; // Common case, in the map
|
||||||
|
|
||||||
if (Constant *CPV = dyn_cast<Constant>(V)) { // Constants are constant
|
if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
|
||||||
|
// The address of a global is a constant...
|
||||||
|
ValueState[V].markConstant(GV);
|
||||||
|
} else if (Constant *CPV = dyn_cast<Constant>(V)) { // Constants are constant
|
||||||
ValueState[CPV].markConstant(CPV);
|
ValueState[CPV].markConstant(CPV);
|
||||||
} else if (isa<Argument>(V)) { // Arguments are overdefined
|
} else if (isa<Argument>(V)) { // Arguments are overdefined
|
||||||
ValueState[V].markOverdefined();
|
ValueState[V].markOverdefined();
|
||||||
} else if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
|
|
||||||
// The address of a global is a constant...
|
|
||||||
ValueState[V].markConstant(ConstantPointerRef::get(GV));
|
|
||||||
}
|
}
|
||||||
// All others are underdefined by default...
|
// All others are underdefined by default...
|
||||||
return ValueState[V];
|
return ValueState[V];
|
||||||
@ -784,9 +784,6 @@ void SCCP::visitLoadInst(LoadInst &I) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Ptr))
|
|
||||||
Ptr = CPR->getValue();
|
|
||||||
|
|
||||||
// Transform load (constant global) into the value loaded.
|
// Transform load (constant global) into the value loaded.
|
||||||
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Ptr))
|
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Ptr))
|
||||||
if (GV->isConstant() && !GV->isExternal()) {
|
if (GV->isConstant() && !GV->isExternal()) {
|
||||||
@ -797,9 +794,7 @@ void SCCP::visitLoadInst(LoadInst &I) {
|
|||||||
// Transform load (constantexpr_GEP global, 0, ...) into the value loaded.
|
// Transform load (constantexpr_GEP global, 0, ...) into the value loaded.
|
||||||
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ptr))
|
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ptr))
|
||||||
if (CE->getOpcode() == Instruction::GetElementPtr)
|
if (CE->getOpcode() == Instruction::GetElementPtr)
|
||||||
if (ConstantPointerRef *G
|
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(CE->getOperand(0)))
|
||||||
= dyn_cast<ConstantPointerRef>(CE->getOperand(0)))
|
|
||||||
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(G->getValue()))
|
|
||||||
if (GV->isConstant() && !GV->isExternal())
|
if (GV->isConstant() && !GV->isExternal())
|
||||||
if (Constant *V =
|
if (Constant *V =
|
||||||
GetGEPGlobalInitializer(GV->getInitializer(), CE)) {
|
GetGEPGlobalInitializer(GV->getInitializer(), CE)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user