mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-24 08:24:33 +00:00
Recommit r236670: [opaque pointer type] Pass explicit pointer type through GEP constant folding""
Clang regressions were caused by more stringent assertion checking introduced by this change. Small fix needed to clang has been committed in r236751. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236752 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -564,7 +564,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const DataLayout &DL) {
|
||||
if (Val >= NewGlobals.size()) Val = 0; // Out of bound array access.
|
||||
|
||||
Value *NewPtr = NewGlobals[Val];
|
||||
Type *NewTy = NewGlobals[Val]->getType();
|
||||
Type *NewTy = NewGlobals[Val]->getValueType();
|
||||
|
||||
// Form a shorter GEP if needed.
|
||||
if (GEP->getNumOperands() > 3) {
|
||||
@ -575,7 +575,6 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const DataLayout &DL) {
|
||||
Idxs.push_back(CE->getOperand(i));
|
||||
NewPtr =
|
||||
ConstantExpr::getGetElementPtr(NewTy, cast<Constant>(NewPtr), Idxs);
|
||||
NewTy = GetElementPtrInst::getIndexedType(NewTy, Idxs);
|
||||
} else {
|
||||
GetElementPtrInst *GEPI = cast<GetElementPtrInst>(GEP);
|
||||
SmallVector<Value*, 8> Idxs;
|
||||
@ -583,8 +582,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV, const DataLayout &DL) {
|
||||
for (unsigned i = 3, e = GEPI->getNumOperands(); i != e; ++i)
|
||||
Idxs.push_back(GEPI->getOperand(i));
|
||||
NewPtr = GetElementPtrInst::Create(
|
||||
NewPtr->getType()->getPointerElementType(), NewPtr, Idxs,
|
||||
GEPI->getName() + "." + Twine(Val), GEPI);
|
||||
NewTy, NewPtr, Idxs, GEPI->getName() + "." + Twine(Val), GEPI);
|
||||
}
|
||||
}
|
||||
GEP->replaceAllUsesWith(NewPtr);
|
||||
|
Reference in New Issue
Block a user