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:
@ -2015,14 +2015,16 @@ Constant *ConstantExpr::getSelect(Constant *C, Constant *V1, Constant *V2,
|
||||
Constant *ConstantExpr::getGetElementPtr(Type *Ty, Constant *C,
|
||||
ArrayRef<Value *> Idxs, bool InBounds,
|
||||
Type *OnlyIfReducedTy) {
|
||||
if (Constant *FC = ConstantFoldGetElementPtr(C, InBounds, Idxs))
|
||||
return FC; // Fold a few common cases.
|
||||
|
||||
if (!Ty)
|
||||
Ty = cast<PointerType>(C->getType()->getScalarType())->getElementType();
|
||||
else
|
||||
assert(Ty ==
|
||||
cast<PointerType>(C->getType()->getScalarType())->getElementType());
|
||||
assert(
|
||||
Ty ==
|
||||
cast<PointerType>(C->getType()->getScalarType())->getContainedType(0u));
|
||||
|
||||
if (Constant *FC = ConstantFoldGetElementPtr(Ty, C, InBounds, Idxs))
|
||||
return FC; // Fold a few common cases.
|
||||
|
||||
// Get the result type of the getelementptr!
|
||||
Type *DestTy = GetElementPtrInst::getIndexedType(Ty, Idxs);
|
||||
assert(DestTy && "GEP indices invalid!");
|
||||
|
Reference in New Issue
Block a user