mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
Don't use default address space arguments in GlobalOpt
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207019 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1170,10 +1170,13 @@ static Value *GetHeapSROAValue(Value *V, unsigned FieldNo,
|
|||||||
} else if (PHINode *PN = dyn_cast<PHINode>(V)) {
|
} else if (PHINode *PN = dyn_cast<PHINode>(V)) {
|
||||||
// PN's type is pointer to struct. Make a new PHI of pointer to struct
|
// PN's type is pointer to struct. Make a new PHI of pointer to struct
|
||||||
// field.
|
// field.
|
||||||
StructType *ST = cast<StructType>(PN->getType()->getPointerElementType());
|
|
||||||
|
|
||||||
|
PointerType *PTy = cast<PointerType>(PN->getType());
|
||||||
|
StructType *ST = cast<StructType>(PTy->getElementType());
|
||||||
|
|
||||||
|
unsigned AS = PTy->getAddressSpace();
|
||||||
PHINode *NewPN =
|
PHINode *NewPN =
|
||||||
PHINode::Create(PointerType::getUnqual(ST->getElementType(FieldNo)),
|
PHINode::Create(PointerType::get(ST->getElementType(FieldNo), AS),
|
||||||
PN->getNumIncomingValues(),
|
PN->getNumIncomingValues(),
|
||||||
PN->getName()+".f"+Twine(FieldNo), PN);
|
PN->getName()+".f"+Twine(FieldNo), PN);
|
||||||
Result = NewPN;
|
Result = NewPN;
|
||||||
@@ -1285,9 +1288,10 @@ static GlobalVariable *PerformHeapAllocSRoA(GlobalVariable *GV, CallInst *CI,
|
|||||||
std::vector<Value*> FieldGlobals;
|
std::vector<Value*> FieldGlobals;
|
||||||
std::vector<Value*> FieldMallocs;
|
std::vector<Value*> FieldMallocs;
|
||||||
|
|
||||||
|
unsigned AS = GV->getType()->getPointerAddressSpace();
|
||||||
for (unsigned FieldNo = 0, e = STy->getNumElements(); FieldNo != e;++FieldNo){
|
for (unsigned FieldNo = 0, e = STy->getNumElements(); FieldNo != e;++FieldNo){
|
||||||
Type *FieldTy = STy->getElementType(FieldNo);
|
Type *FieldTy = STy->getElementType(FieldNo);
|
||||||
PointerType *PFieldTy = PointerType::getUnqual(FieldTy);
|
PointerType *PFieldTy = PointerType::get(FieldTy, AS);
|
||||||
|
|
||||||
GlobalVariable *NGV =
|
GlobalVariable *NGV =
|
||||||
new GlobalVariable(*GV->getParent(),
|
new GlobalVariable(*GV->getParent(),
|
||||||
|
Reference in New Issue
Block a user