mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-23 22:00:10 +00:00
[OpaquePtr] Remove uses of CreateGEP() without element type
Remove uses of to-be-deprecated API. In cases where the correct element type was not immediately obvious to me, fall back to explicit getPointerElementType().
This commit is contained in:
parent
f95d26006e
commit
2c68ecccc9
@ -261,7 +261,8 @@ public:
|
||||
Address CreateConstByteGEP(Address Addr, CharUnits Offset,
|
||||
const llvm::Twine &Name = "") {
|
||||
assert(Addr.getElementType() == TypeCache.Int8Ty);
|
||||
return Address(CreateGEP(Addr.getPointer(), getSize(Offset), Name),
|
||||
return Address(CreateGEP(Addr.getElementType(), Addr.getPointer(),
|
||||
getSize(Offset), Name),
|
||||
Addr.getAlignment().alignmentAtOffset(Offset));
|
||||
}
|
||||
|
||||
|
@ -9358,7 +9358,8 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
|
||||
llvm::Value *Val = Builder.CreateCall(F, MemAddr);
|
||||
llvm::Value *ToRet;
|
||||
for (size_t i = 0; i < 8; i++) {
|
||||
llvm::Value *ValOffsetPtr = Builder.CreateGEP(ValPtr, Builder.getInt32(i));
|
||||
llvm::Value *ValOffsetPtr =
|
||||
Builder.CreateGEP(Int64Ty, ValPtr, Builder.getInt32(i));
|
||||
Address Addr(ValOffsetPtr, CharUnits::fromQuantity(8));
|
||||
ToRet = Builder.CreateStore(Builder.CreateExtractValue(Val, i), Addr);
|
||||
}
|
||||
@ -9369,7 +9370,8 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
|
||||
SmallVector<llvm::Value *, 9> Args;
|
||||
Args.push_back(MemAddr);
|
||||
for (size_t i = 0; i < 8; i++) {
|
||||
llvm::Value *ValOffsetPtr = Builder.CreateGEP(ValPtr, Builder.getInt32(i));
|
||||
llvm::Value *ValOffsetPtr =
|
||||
Builder.CreateGEP(Int64Ty, ValPtr, Builder.getInt32(i));
|
||||
Address Addr(ValOffsetPtr, CharUnits::fromQuantity(8));
|
||||
Args.push_back(Builder.CreateLoad(Addr));
|
||||
}
|
||||
@ -14948,7 +14950,7 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
|
||||
Ops[0] = Builder.CreateBitCast(Ops[0], Int8PtrTy);
|
||||
}else {
|
||||
Ops[1] = Builder.CreateBitCast(Ops[1], Int8PtrTy);
|
||||
Ops[0] = Builder.CreateGEP(Ops[1], Ops[0]);
|
||||
Ops[0] = Builder.CreateGEP(Int8Ty, Ops[1], Ops[0]);
|
||||
Ops.pop_back();
|
||||
}
|
||||
|
||||
@ -15016,7 +15018,7 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
|
||||
Ops[1] = Builder.CreateBitCast(Ops[1], Int8PtrTy);
|
||||
}else {
|
||||
Ops[2] = Builder.CreateBitCast(Ops[2], Int8PtrTy);
|
||||
Ops[1] = Builder.CreateGEP(Ops[2], Ops[1]);
|
||||
Ops[1] = Builder.CreateGEP(Int8Ty, Ops[2], Ops[1]);
|
||||
Ops.pop_back();
|
||||
}
|
||||
|
||||
@ -15556,10 +15558,10 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned BuiltinID,
|
||||
if (BuiltinID == PPC::BI__builtin_vsx_lxvp ||
|
||||
BuiltinID == PPC::BI__builtin_mma_lxvp) {
|
||||
Ops[1] = Builder.CreateBitCast(Ops[1], Int8PtrTy);
|
||||
Ops[0] = Builder.CreateGEP(Ops[1], Ops[0]);
|
||||
Ops[0] = Builder.CreateGEP(Int8Ty, Ops[1], Ops[0]);
|
||||
} else {
|
||||
Ops[2] = Builder.CreateBitCast(Ops[2], Int8PtrTy);
|
||||
Ops[1] = Builder.CreateGEP(Ops[2], Ops[1]);
|
||||
Ops[1] = Builder.CreateGEP(Int8Ty, Ops[2], Ops[1]);
|
||||
}
|
||||
Ops.pop_back();
|
||||
llvm::Function *F = CGM.getIntrinsic(ID);
|
||||
@ -15657,7 +15659,7 @@ Value *EmitAMDGPUWorkGroupSize(CodeGenFunction &CGF, unsigned Index) {
|
||||
auto *DP = EmitAMDGPUDispatchPtr(CGF);
|
||||
// Indexing the HSA kernel_dispatch_packet struct.
|
||||
auto *Offset = llvm::ConstantInt::get(CGF.Int32Ty, XOffset + Index * 2);
|
||||
auto *GEP = CGF.Builder.CreateGEP(DP, Offset);
|
||||
auto *GEP = CGF.Builder.CreateGEP(CGF.Int8Ty, DP, Offset);
|
||||
auto *DstTy =
|
||||
CGF.Int16Ty->getPointerTo(GEP->getType()->getPointerAddressSpace());
|
||||
auto *Cast = CGF.Builder.CreateBitCast(GEP, DstTy);
|
||||
@ -15677,7 +15679,7 @@ Value *EmitAMDGPUGridSize(CodeGenFunction &CGF, unsigned Index) {
|
||||
auto *DP = EmitAMDGPUDispatchPtr(CGF);
|
||||
// Indexing the HSA kernel_dispatch_packet struct.
|
||||
auto *Offset = llvm::ConstantInt::get(CGF.Int32Ty, XOffset + Index * 4);
|
||||
auto *GEP = CGF.Builder.CreateGEP(DP, Offset);
|
||||
auto *GEP = CGF.Builder.CreateGEP(CGF.Int8Ty, DP, Offset);
|
||||
auto *DstTy =
|
||||
CGF.Int32Ty->getPointerTo(GEP->getType()->getPointerAddressSpace());
|
||||
auto *Cast = CGF.Builder.CreateBitCast(GEP, DstTy);
|
||||
@ -17079,7 +17081,7 @@ CodeGenFunction::EmitNVPTXBuiltinExpr(unsigned BuiltinID, const CallExpr *E) {
|
||||
Builder.CreateAlignedStore(
|
||||
Builder.CreateBitCast(Builder.CreateExtractValue(Result, i),
|
||||
Dst.getElementType()),
|
||||
Builder.CreateGEP(Dst.getPointer(),
|
||||
Builder.CreateGEP(Dst.getElementType(), Dst.getPointer(),
|
||||
llvm::ConstantInt::get(IntTy, i)),
|
||||
CharUnits::fromQuantity(4));
|
||||
}
|
||||
@ -17222,7 +17224,8 @@ CodeGenFunction::EmitNVPTXBuiltinExpr(unsigned BuiltinID, const CallExpr *E) {
|
||||
for (unsigned i = 0; i < MI.NumEltsD; ++i)
|
||||
Builder.CreateAlignedStore(
|
||||
Builder.CreateBitCast(Builder.CreateExtractValue(Result, i), DType),
|
||||
Builder.CreateGEP(Dst.getPointer(), llvm::ConstantInt::get(IntTy, i)),
|
||||
Builder.CreateGEP(Dst.getElementType(), Dst.getPointer(),
|
||||
llvm::ConstantInt::get(IntTy, i)),
|
||||
CharUnits::fromQuantity(4));
|
||||
return Result;
|
||||
}
|
||||
@ -17306,7 +17309,7 @@ RValue CodeGenFunction::EmitBuiltinAlignTo(const CallExpr *E, bool AlignUp) {
|
||||
// can use an inbounds GEP to enable better optimization.
|
||||
Value *Base = EmitCastToVoidPtr(Args.Src);
|
||||
if (getLangOpts().isSignedOverflowDefined())
|
||||
Result = Builder.CreateGEP(Base, Difference, "aligned_result");
|
||||
Result = Builder.CreateGEP(Int8Ty, Base, Difference, "aligned_result");
|
||||
else
|
||||
Result = EmitCheckedInBoundsGEP(Base, Difference,
|
||||
/*SignedIndices=*/true,
|
||||
|
@ -1741,6 +1741,7 @@ namespace {
|
||||
llvm::ConstantInt::get(CGF.SizeTy, PoisonStart.getQuantity());
|
||||
|
||||
llvm::Value *OffsetPtr = CGF.Builder.CreateGEP(
|
||||
CGF.Int8Ty,
|
||||
CGF.Builder.CreateBitCast(CGF.LoadCXXThis(), CGF.Int8PtrTy),
|
||||
OffsetSizePtr);
|
||||
|
||||
|
@ -2588,7 +2588,8 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
|
||||
llvm::Value *numElts = CGF.getVLASize(vla).NumElts;
|
||||
if (!isInc) numElts = Builder.CreateNSWNeg(numElts, "vla.negsize");
|
||||
if (CGF.getLangOpts().isSignedOverflowDefined())
|
||||
value = Builder.CreateGEP(value, numElts, "vla.inc");
|
||||
value = Builder.CreateGEP(value->getType()->getPointerElementType(),
|
||||
value, numElts, "vla.inc");
|
||||
else
|
||||
value = CGF.EmitCheckedInBoundsGEP(
|
||||
value, numElts, /*SignedIndices=*/false, isSubtraction,
|
||||
@ -2600,7 +2601,7 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
|
||||
|
||||
value = CGF.EmitCastToVoidPtr(value);
|
||||
if (CGF.getLangOpts().isSignedOverflowDefined())
|
||||
value = Builder.CreateGEP(value, amt, "incdec.funcptr");
|
||||
value = Builder.CreateGEP(CGF.Int8Ty, value, amt, "incdec.funcptr");
|
||||
else
|
||||
value = CGF.EmitCheckedInBoundsGEP(value, amt, /*SignedIndices=*/false,
|
||||
isSubtraction, E->getExprLoc(),
|
||||
@ -2611,7 +2612,8 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
|
||||
} else {
|
||||
llvm::Value *amt = Builder.getInt32(amount);
|
||||
if (CGF.getLangOpts().isSignedOverflowDefined())
|
||||
value = Builder.CreateGEP(value, amt, "incdec.ptr");
|
||||
value = Builder.CreateGEP(value->getType()->getPointerElementType(),
|
||||
value, amt, "incdec.ptr");
|
||||
else
|
||||
value = CGF.EmitCheckedInBoundsGEP(value, amt, /*SignedIndices=*/false,
|
||||
isSubtraction, E->getExprLoc(),
|
||||
@ -2720,7 +2722,7 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
|
||||
llvm::ConstantInt::get(CGF.SizeTy, size.getQuantity());
|
||||
|
||||
if (CGF.getLangOpts().isSignedOverflowDefined())
|
||||
value = Builder.CreateGEP(value, sizeValue, "incdec.objptr");
|
||||
value = Builder.CreateGEP(CGF.Int8Ty, value, sizeValue, "incdec.objptr");
|
||||
else
|
||||
value = CGF.EmitCheckedInBoundsGEP(value, sizeValue,
|
||||
/*SignedIndices=*/false, isSubtraction,
|
||||
@ -3445,7 +3447,7 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF,
|
||||
index = CGF.Builder.CreateMul(index, objectSize);
|
||||
|
||||
Value *result = CGF.Builder.CreateBitCast(pointer, CGF.VoidPtrTy);
|
||||
result = CGF.Builder.CreateGEP(result, index, "add.ptr");
|
||||
result = CGF.Builder.CreateGEP(CGF.Int8Ty, result, index, "add.ptr");
|
||||
return CGF.Builder.CreateBitCast(result, pointer->getType());
|
||||
}
|
||||
|
||||
@ -3461,7 +3463,9 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF,
|
||||
// multiply. We suppress this if overflow is not undefined behavior.
|
||||
if (CGF.getLangOpts().isSignedOverflowDefined()) {
|
||||
index = CGF.Builder.CreateMul(index, numElements, "vla.index");
|
||||
pointer = CGF.Builder.CreateGEP(pointer, index, "add.ptr");
|
||||
pointer = CGF.Builder.CreateGEP(
|
||||
pointer->getType()->getPointerElementType(), pointer, index,
|
||||
"add.ptr");
|
||||
} else {
|
||||
index = CGF.Builder.CreateNSWMul(index, numElements, "vla.index");
|
||||
pointer =
|
||||
@ -3476,12 +3480,13 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF,
|
||||
// future proof.
|
||||
if (elementType->isVoidType() || elementType->isFunctionType()) {
|
||||
Value *result = CGF.EmitCastToVoidPtr(pointer);
|
||||
result = CGF.Builder.CreateGEP(result, index, "add.ptr");
|
||||
result = CGF.Builder.CreateGEP(CGF.Int8Ty, result, index, "add.ptr");
|
||||
return CGF.Builder.CreateBitCast(result, pointer->getType());
|
||||
}
|
||||
|
||||
if (CGF.getLangOpts().isSignedOverflowDefined())
|
||||
return CGF.Builder.CreateGEP(pointer, index, "add.ptr");
|
||||
return CGF.Builder.CreateGEP(
|
||||
pointer->getType()->getPointerElementType(), pointer, index, "add.ptr");
|
||||
|
||||
return CGF.EmitCheckedInBoundsGEP(pointer, index, isSigned, isSubtraction,
|
||||
op.E->getExprLoc(), "add.ptr");
|
||||
|
@ -1904,8 +1904,9 @@ void CodeGenFunction::EmitObjCForCollectionStmt(const ObjCForCollectionStmt &S){
|
||||
Builder.CreateLoad(StateItemsPtr, "stateitems");
|
||||
|
||||
// Fetch the value at the current index from the buffer.
|
||||
llvm::Value *CurrentItemPtr =
|
||||
Builder.CreateGEP(EnumStateItems, index, "currentitem.ptr");
|
||||
llvm::Value *CurrentItemPtr = Builder.CreateGEP(
|
||||
EnumStateItems->getType()->getPointerElementType(), EnumStateItems, index,
|
||||
"currentitem.ptr");
|
||||
llvm::Value *CurrentItem =
|
||||
Builder.CreateAlignedLoad(ObjCIdType, CurrentItemPtr, getPointerAlign());
|
||||
|
||||
|
@ -698,7 +698,8 @@ static void EmitOMPAggregateInit(CodeGenFunction &CGF, Address DestAddr,
|
||||
SrcBegin = SrcAddr.getPointer();
|
||||
llvm::Value *DestBegin = DestAddr.getPointer();
|
||||
// Cast from pointer to array type to pointer to single element.
|
||||
llvm::Value *DestEnd = CGF.Builder.CreateGEP(DestBegin, NumElements);
|
||||
llvm::Value *DestEnd =
|
||||
CGF.Builder.CreateGEP(DestAddr.getElementType(), DestBegin, NumElements);
|
||||
// The basic structure here is a while-do loop.
|
||||
llvm::BasicBlock *BodyBB = CGF.createBasicBlock("omp.arrayinit.body");
|
||||
llvm::BasicBlock *DoneBB = CGF.createBasicBlock("omp.arrayinit.done");
|
||||
@ -1012,13 +1013,14 @@ Address ReductionCodeGen::adjustPrivateAddress(CodeGenFunction &CGF, unsigned N,
|
||||
LValue BaseLValue =
|
||||
loadToBegin(CGF, OrigVD->getType(), SharedAddresses[N].first.getType(),
|
||||
OriginalBaseLValue);
|
||||
Address SharedAddr = SharedAddresses[N].first.getAddress(CGF);
|
||||
llvm::Value *Adjustment = CGF.Builder.CreatePtrDiff(
|
||||
BaseLValue.getPointer(CGF), SharedAddresses[N].first.getPointer(CGF));
|
||||
BaseLValue.getPointer(CGF), SharedAddr.getPointer());
|
||||
llvm::Value *PrivatePointer =
|
||||
CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
PrivateAddr.getPointer(),
|
||||
SharedAddresses[N].first.getAddress(CGF).getType());
|
||||
llvm::Value *Ptr = CGF.Builder.CreateGEP(PrivatePointer, Adjustment);
|
||||
PrivateAddr.getPointer(), SharedAddr.getType());
|
||||
llvm::Value *Ptr = CGF.Builder.CreateGEP(
|
||||
SharedAddr.getElementType(), PrivatePointer, Adjustment);
|
||||
return castToBase(CGF, OrigVD->getType(),
|
||||
SharedAddresses[N].first.getType(),
|
||||
OriginalBaseLValue.getAddress(CGF).getType(),
|
||||
@ -4474,7 +4476,8 @@ CGOpenMPRuntime::emitTaskInit(CodeGenFunction &CGF, SourceLocation Loc,
|
||||
std::tie(Addr, Size) = getPointerAndSize(CGF, E);
|
||||
llvm::Value *Idx = CGF.EmitLoadOfScalar(PosLVal, E->getExprLoc());
|
||||
LValue Base = CGF.MakeAddrLValue(
|
||||
Address(CGF.Builder.CreateGEP(AffinitiesArray.getPointer(), Idx),
|
||||
Address(CGF.Builder.CreateGEP(AffinitiesArray.getElementType(),
|
||||
AffinitiesArray.getPointer(), Idx),
|
||||
AffinitiesArray.getAlignment()),
|
||||
KmpTaskAffinityInfoTy);
|
||||
// affs[i].base_addr = &<Affinities[i].second>;
|
||||
@ -4641,7 +4644,7 @@ CGOpenMPRuntime::getDepobjElements(CodeGenFunction &CGF, LValue DepobjLVal,
|
||||
Base = CGF.MakeAddrLValue(Addr, KmpDependInfoTy, Base.getBaseInfo(),
|
||||
Base.getTBAAInfo());
|
||||
llvm::Value *DepObjAddr = CGF.Builder.CreateGEP(
|
||||
Addr.getPointer(),
|
||||
Addr.getElementType(), Addr.getPointer(),
|
||||
llvm::ConstantInt::get(CGF.IntPtrTy, -1, /*isSigned=*/true));
|
||||
LValue NumDepsBase = CGF.MakeAddrLValue(
|
||||
Address(DepObjAddr, Addr.getAlignment()), KmpDependInfoTy,
|
||||
@ -4681,7 +4684,8 @@ static void emitDependData(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
|
||||
LValue &PosLVal = *Pos.get<LValue *>();
|
||||
llvm::Value *Idx = CGF.EmitLoadOfScalar(PosLVal, E->getExprLoc());
|
||||
Base = CGF.MakeAddrLValue(
|
||||
Address(CGF.Builder.CreateGEP(DependenciesArray.getPointer(), Idx),
|
||||
Address(CGF.Builder.CreateGEP(DependenciesArray.getElementType(),
|
||||
DependenciesArray.getPointer(), Idx),
|
||||
DependenciesArray.getAlignment()),
|
||||
KmpDependInfoTy);
|
||||
}
|
||||
@ -4741,7 +4745,7 @@ emitDepobjElementsSizes(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
|
||||
Base = CGF.MakeAddrLValue(Addr, KmpDependInfoTy, Base.getBaseInfo(),
|
||||
Base.getTBAAInfo());
|
||||
llvm::Value *DepObjAddr = CGF.Builder.CreateGEP(
|
||||
Addr.getPointer(),
|
||||
Addr.getElementType(), Addr.getPointer(),
|
||||
llvm::ConstantInt::get(CGF.IntPtrTy, -1, /*isSigned=*/true));
|
||||
LValue NumDepsBase = CGF.MakeAddrLValue(
|
||||
Address(DepObjAddr, Addr.getAlignment()), KmpDependInfoTy,
|
||||
@ -4802,7 +4806,7 @@ static void emitDepobjElements(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
|
||||
|
||||
// Get number of elements in a single depobj.
|
||||
llvm::Value *DepObjAddr = CGF.Builder.CreateGEP(
|
||||
Addr.getPointer(),
|
||||
Addr.getElementType(), Addr.getPointer(),
|
||||
llvm::ConstantInt::get(CGF.IntPtrTy, -1, /*isSigned=*/true));
|
||||
LValue NumDepsBase = CGF.MakeAddrLValue(
|
||||
Address(DepObjAddr, Addr.getAlignment()), KmpDependInfoTy,
|
||||
@ -4819,7 +4823,8 @@ static void emitDepobjElements(CodeGenFunction &CGF, QualType &KmpDependInfoTy,
|
||||
CGF.Builder.CreateIntCast(NumDeps, CGF.SizeTy, /*isSigned=*/false));
|
||||
llvm::Value *Pos = CGF.EmitLoadOfScalar(PosLVal, E->getExprLoc());
|
||||
Address DepAddr =
|
||||
Address(CGF.Builder.CreateGEP(DependenciesArray.getPointer(), Pos),
|
||||
Address(CGF.Builder.CreateGEP(DependenciesArray.getElementType(),
|
||||
DependenciesArray.getPointer(), Pos),
|
||||
DependenciesArray.getAlignment());
|
||||
CGF.Builder.CreateMemCpy(DepAddr, Base.getAddress(CGF), Size);
|
||||
|
||||
@ -5047,7 +5052,7 @@ void CGOpenMPRuntime::emitDestroyClause(CodeGenFunction &CGF, LValue DepobjLVal,
|
||||
Address Addr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
Base.getAddress(CGF), CGF.ConvertTypeForMem(KmpDependInfoPtrTy));
|
||||
llvm::Value *DepObjAddr = CGF.Builder.CreateGEP(
|
||||
Addr.getPointer(),
|
||||
Addr.getElementType(), Addr.getPointer(),
|
||||
llvm::ConstantInt::get(CGF.IntPtrTy, -1, /*isSigned=*/true));
|
||||
DepObjAddr = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(DepObjAddr,
|
||||
CGF.VoidPtrTy);
|
||||
@ -5077,7 +5082,8 @@ void CGOpenMPRuntime::emitUpdateClause(CodeGenFunction &CGF, LValue DepobjLVal,
|
||||
|
||||
Address Begin = Base.getAddress(CGF);
|
||||
// Cast from pointer to array type to pointer to single element.
|
||||
llvm::Value *End = CGF.Builder.CreateGEP(Begin.getPointer(), NumDeps);
|
||||
llvm::Value *End = CGF.Builder.CreateGEP(
|
||||
Begin.getElementType(), Begin.getPointer(), NumDeps);
|
||||
// The basic structure here is a while-do loop.
|
||||
llvm::BasicBlock *BodyBB = CGF.createBasicBlock("omp.body");
|
||||
llvm::BasicBlock *DoneBB = CGF.createBasicBlock("omp.done");
|
||||
@ -5340,7 +5346,8 @@ static void EmitOMPAggregateReduction(
|
||||
llvm::Value *RHSBegin = RHSAddr.getPointer();
|
||||
llvm::Value *LHSBegin = LHSAddr.getPointer();
|
||||
// Cast from pointer to array type to pointer to single element.
|
||||
llvm::Value *LHSEnd = CGF.Builder.CreateGEP(LHSBegin, NumElements);
|
||||
llvm::Value *LHSEnd =
|
||||
CGF.Builder.CreateGEP(LHSAddr.getElementType(), LHSBegin, NumElements);
|
||||
// The basic structure here is a while-do loop.
|
||||
llvm::BasicBlock *BodyBB = CGF.createBasicBlock("omp.arraycpy.body");
|
||||
llvm::BasicBlock *DoneBB = CGF.createBasicBlock("omp.arraycpy.done");
|
||||
@ -9747,7 +9754,8 @@ void CGOpenMPRuntime::emitUserDefinedMapper(const OMPDeclareMapperDecl *D,
|
||||
Size, MapperCGF.Builder.getInt64(ElementSize.getQuantity()));
|
||||
llvm::Value *PtrBegin = MapperCGF.Builder.CreateBitCast(
|
||||
BeginIn, CGM.getTypes().ConvertTypeForMem(PtrTy));
|
||||
llvm::Value *PtrEnd = MapperCGF.Builder.CreateGEP(PtrBegin, Size);
|
||||
llvm::Value *PtrEnd = MapperCGF.Builder.CreateGEP(
|
||||
PtrBegin->getType()->getPointerElementType(), PtrBegin, Size);
|
||||
llvm::Value *MapType = MapperCGF.EmitLoadOfScalar(
|
||||
MapperCGF.GetAddrOfLocalVar(&TypeArg), /*Volatile=*/false,
|
||||
C.getPointerType(Int64Ty), Loc);
|
||||
|
@ -2215,7 +2215,8 @@ static llvm::Value *emitInterWarpCopyFunction(CodeGenModule &CGM,
|
||||
Address ElemPtr = Address(ElemPtrPtr, Align);
|
||||
ElemPtr = Bld.CreateElementBitCast(ElemPtr, CopyType);
|
||||
if (NumIters > 1) {
|
||||
ElemPtr = Address(Bld.CreateGEP(ElemPtr.getPointer(), Cnt),
|
||||
ElemPtr = Address(Bld.CreateGEP(ElemPtr.getElementType(),
|
||||
ElemPtr.getPointer(), Cnt),
|
||||
ElemPtr.getAlignment());
|
||||
}
|
||||
|
||||
@ -2284,7 +2285,8 @@ static llvm::Value *emitInterWarpCopyFunction(CodeGenModule &CGM,
|
||||
Address TargetElemPtr = Address(TargetElemPtrVal, Align);
|
||||
TargetElemPtr = Bld.CreateElementBitCast(TargetElemPtr, CopyType);
|
||||
if (NumIters > 1) {
|
||||
TargetElemPtr = Address(Bld.CreateGEP(TargetElemPtr.getPointer(), Cnt),
|
||||
TargetElemPtr = Address(Bld.CreateGEP(TargetElemPtr.getElementType(),
|
||||
TargetElemPtr.getPointer(), Cnt),
|
||||
TargetElemPtr.getAlignment());
|
||||
}
|
||||
|
||||
|
@ -850,7 +850,8 @@ void CodeGenFunction::EmitOMPAggregateAssign(
|
||||
llvm::Value *SrcBegin = SrcAddr.getPointer();
|
||||
llvm::Value *DestBegin = DestAddr.getPointer();
|
||||
// Cast from pointer to array type to pointer to single element.
|
||||
llvm::Value *DestEnd = Builder.CreateGEP(DestBegin, NumElements);
|
||||
llvm::Value *DestEnd =
|
||||
Builder.CreateGEP(DestAddr.getElementType(), DestBegin, NumElements);
|
||||
// The basic structure here is a while-do loop.
|
||||
llvm::BasicBlock *BodyBB = createBasicBlock("omp.arraycpy.body");
|
||||
llvm::BasicBlock *DoneBB = createBasicBlock("omp.arraycpy.done");
|
||||
|
@ -720,7 +720,8 @@ CGCallee ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(
|
||||
}
|
||||
|
||||
if (ShouldEmitVFEInfo) {
|
||||
llvm::Value *VFPAddr = Builder.CreateGEP(VTable, VTableOffset);
|
||||
llvm::Value *VFPAddr =
|
||||
Builder.CreateGEP(CGF.Int8Ty, VTable, VTableOffset);
|
||||
|
||||
// If doing VFE, load from the vtable with a type.checked.load intrinsic
|
||||
// call. Note that we use the GEP to calculate the address to load from
|
||||
@ -738,7 +739,8 @@ CGCallee ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(
|
||||
// When not doing VFE, emit a normal load, as it allows more
|
||||
// optimisations than type.checked.load.
|
||||
if (ShouldEmitCFICheck || ShouldEmitWPDInfo) {
|
||||
llvm::Value *VFPAddr = Builder.CreateGEP(VTable, VTableOffset);
|
||||
llvm::Value *VFPAddr =
|
||||
Builder.CreateGEP(CGF.Int8Ty, VTable, VTableOffset);
|
||||
CheckResult = Builder.CreateCall(
|
||||
CGM.getIntrinsic(llvm::Intrinsic::type_test),
|
||||
{Builder.CreateBitCast(VFPAddr, CGF.Int8PtrTy), TypeId});
|
||||
@ -751,7 +753,8 @@ CGCallee ItaniumCXXABI::EmitLoadOfMemberFunctionPointer(
|
||||
{VTable, VTableOffset});
|
||||
VirtualFn = CGF.Builder.CreateBitCast(VirtualFn, FTy->getPointerTo());
|
||||
} else {
|
||||
llvm::Value *VFPAddr = CGF.Builder.CreateGEP(VTable, VTableOffset);
|
||||
llvm::Value *VFPAddr =
|
||||
CGF.Builder.CreateGEP(CGF.Int8Ty, VTable, VTableOffset);
|
||||
VFPAddr = CGF.Builder.CreateBitCast(
|
||||
VFPAddr, FTy->getPointerTo()->getPointerTo());
|
||||
VirtualFn = CGF.Builder.CreateAlignedLoad(
|
||||
|
@ -2201,7 +2201,7 @@ llvm::Value *MicrosoftCXXABI::performThisAdjustment(CodeGenFunction &CGF,
|
||||
CharUnits::fromQuantity(TA.Virtual.Microsoft.VtordispOffset));
|
||||
VtorDispPtr = CGF.Builder.CreateElementBitCast(VtorDispPtr, CGF.Int32Ty);
|
||||
llvm::Value *VtorDisp = CGF.Builder.CreateLoad(VtorDispPtr, "vtordisp");
|
||||
V = CGF.Builder.CreateGEP(This.getPointer(),
|
||||
V = CGF.Builder.CreateGEP(This.getElementType(), This.getPointer(),
|
||||
CGF.Builder.CreateNeg(VtorDisp));
|
||||
|
||||
// Unfortunately, having applied the vtordisp means that we no
|
||||
|
@ -3966,8 +3966,8 @@ static Address EmitX86_64VAArgFromMemory(CodeGenFunction &CGF,
|
||||
uint64_t SizeInBytes = (CGF.getContext().getTypeSize(Ty) + 7) / 8;
|
||||
llvm::Value *Offset =
|
||||
llvm::ConstantInt::get(CGF.Int32Ty, (SizeInBytes + 7) & ~7);
|
||||
overflow_arg_area = CGF.Builder.CreateGEP(overflow_arg_area, Offset,
|
||||
"overflow_arg_area.next");
|
||||
overflow_arg_area = CGF.Builder.CreateGEP(CGF.Int8Ty, overflow_arg_area,
|
||||
Offset, "overflow_arg_area.next");
|
||||
CGF.Builder.CreateStore(overflow_arg_area, overflow_arg_area_p);
|
||||
|
||||
// AMD64-ABI 3.5.7p5: Step 11. Return the fetched type.
|
||||
@ -4061,8 +4061,10 @@ Address X86_64ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
|
||||
"Unexpected ABI info for mixed regs");
|
||||
llvm::Type *PTyLo = llvm::PointerType::getUnqual(TyLo);
|
||||
llvm::Type *PTyHi = llvm::PointerType::getUnqual(TyHi);
|
||||
llvm::Value *GPAddr = CGF.Builder.CreateGEP(RegSaveArea, gp_offset);
|
||||
llvm::Value *FPAddr = CGF.Builder.CreateGEP(RegSaveArea, fp_offset);
|
||||
llvm::Value *GPAddr =
|
||||
CGF.Builder.CreateGEP(CGF.Int8Ty, RegSaveArea, gp_offset);
|
||||
llvm::Value *FPAddr =
|
||||
CGF.Builder.CreateGEP(CGF.Int8Ty, RegSaveArea, fp_offset);
|
||||
llvm::Value *RegLoAddr = TyLo->isFPOrFPVectorTy() ? FPAddr : GPAddr;
|
||||
llvm::Value *RegHiAddr = TyLo->isFPOrFPVectorTy() ? GPAddr : FPAddr;
|
||||
|
||||
@ -4081,7 +4083,7 @@ Address X86_64ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
|
||||
|
||||
RegAddr = CGF.Builder.CreateElementBitCast(Tmp, LTy);
|
||||
} else if (neededInt) {
|
||||
RegAddr = Address(CGF.Builder.CreateGEP(RegSaveArea, gp_offset),
|
||||
RegAddr = Address(CGF.Builder.CreateGEP(CGF.Int8Ty, RegSaveArea, gp_offset),
|
||||
CharUnits::fromQuantity(8));
|
||||
RegAddr = CGF.Builder.CreateElementBitCast(RegAddr, LTy);
|
||||
|
||||
@ -4099,7 +4101,7 @@ Address X86_64ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
|
||||
}
|
||||
|
||||
} else if (neededSSE == 1) {
|
||||
RegAddr = Address(CGF.Builder.CreateGEP(RegSaveArea, fp_offset),
|
||||
RegAddr = Address(CGF.Builder.CreateGEP(CGF.Int8Ty, RegSaveArea, fp_offset),
|
||||
CharUnits::fromQuantity(16));
|
||||
RegAddr = CGF.Builder.CreateElementBitCast(RegAddr, LTy);
|
||||
} else {
|
||||
@ -4110,7 +4112,8 @@ Address X86_64ABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
|
||||
// to assume that the slots are 16-byte aligned, since the stack is
|
||||
// naturally 16-byte aligned and the prologue is expected to store
|
||||
// all the SSE registers to the RSA.
|
||||
Address RegAddrLo = Address(CGF.Builder.CreateGEP(RegSaveArea, fp_offset),
|
||||
Address RegAddrLo = Address(CGF.Builder.CreateGEP(CGF.Int8Ty, RegSaveArea,
|
||||
fp_offset),
|
||||
CharUnits::fromQuantity(16));
|
||||
Address RegAddrHi =
|
||||
CGF.Builder.CreateConstInBoundsByteGEP(RegAddrLo,
|
||||
@ -7460,7 +7463,8 @@ Address SystemZABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
|
||||
|
||||
// Update overflow_arg_area_ptr pointer
|
||||
llvm::Value *NewOverflowArgArea =
|
||||
CGF.Builder.CreateGEP(OverflowArgArea.getPointer(), PaddedSizeV,
|
||||
CGF.Builder.CreateGEP(OverflowArgArea.getElementType(),
|
||||
OverflowArgArea.getPointer(), PaddedSizeV,
|
||||
"overflow_arg_area");
|
||||
CGF.Builder.CreateStore(NewOverflowArgArea, OverflowArgAreaPtr);
|
||||
|
||||
@ -7510,7 +7514,7 @@ Address SystemZABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
|
||||
CGF.Builder.CreateStructGEP(VAListAddr, 3, "reg_save_area_ptr");
|
||||
llvm::Value *RegSaveArea =
|
||||
CGF.Builder.CreateLoad(RegSaveAreaPtr, "reg_save_area");
|
||||
Address RawRegAddr(CGF.Builder.CreateGEP(RegSaveArea, RegOffset,
|
||||
Address RawRegAddr(CGF.Builder.CreateGEP(CGF.Int8Ty, RegSaveArea, RegOffset,
|
||||
"raw_reg_addr"),
|
||||
PaddedSize);
|
||||
Address RegAddr =
|
||||
@ -7539,7 +7543,8 @@ Address SystemZABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
|
||||
|
||||
// Update overflow_arg_area_ptr pointer
|
||||
llvm::Value *NewOverflowArgArea =
|
||||
CGF.Builder.CreateGEP(OverflowArgArea.getPointer(), PaddedSizeV,
|
||||
CGF.Builder.CreateGEP(OverflowArgArea.getElementType(),
|
||||
OverflowArgArea.getPointer(), PaddedSizeV,
|
||||
"overflow_arg_area");
|
||||
CGF.Builder.CreateStore(NewOverflowArgArea, OverflowArgAreaPtr);
|
||||
CGF.EmitBranch(ContBlock);
|
||||
@ -8470,7 +8475,7 @@ Address HexagonABIInfo::EmitVAArgFromMemory(CodeGenFunction &CGF,
|
||||
|
||||
// Add offset to the current pointer to access the argument.
|
||||
__overflow_area_pointer =
|
||||
CGF.Builder.CreateGEP(__overflow_area_pointer, Offset);
|
||||
CGF.Builder.CreateGEP(CGF.Int8Ty, __overflow_area_pointer, Offset);
|
||||
llvm::Value *AsInt =
|
||||
CGF.Builder.CreatePtrToInt(__overflow_area_pointer, CGF.Int32Ty);
|
||||
|
||||
@ -8493,7 +8498,8 @@ Address HexagonABIInfo::EmitVAArgFromMemory(CodeGenFunction &CGF,
|
||||
uint64_t Offset = llvm::alignTo(CGF.getContext().getTypeSize(Ty) / 8, 4);
|
||||
|
||||
__overflow_area_pointer = CGF.Builder.CreateGEP(
|
||||
__overflow_area_pointer, llvm::ConstantInt::get(CGF.Int32Ty, Offset),
|
||||
CGF.Int8Ty, __overflow_area_pointer,
|
||||
llvm::ConstantInt::get(CGF.Int32Ty, Offset),
|
||||
"__overflow_area_pointer.next");
|
||||
CGF.Builder.CreateStore(__overflow_area_pointer, __overflow_area_pointer_p);
|
||||
|
||||
@ -8524,7 +8530,7 @@ Address HexagonABIInfo::EmitVAArgForHexagon(CodeGenFunction &CGF,
|
||||
|
||||
uint64_t Offset = llvm::alignTo(CGF.getContext().getTypeSize(Ty) / 8, 4);
|
||||
llvm::Value *NextAddr = Builder.CreateGEP(
|
||||
Addr, llvm::ConstantInt::get(CGF.Int32Ty, Offset), "ap.next");
|
||||
CGF.Int8Ty, Addr, llvm::ConstantInt::get(CGF.Int32Ty, Offset), "ap.next");
|
||||
Builder.CreateStore(NextAddr, VAListAddrAsBPP);
|
||||
|
||||
return AddrTyped;
|
||||
@ -8596,7 +8602,7 @@ Address HexagonABIInfo::EmitVAArgForHexagonLinux(CodeGenFunction &CGF,
|
||||
}
|
||||
|
||||
llvm::Value *__new_saved_reg_area_pointer =
|
||||
CGF.Builder.CreateGEP(__current_saved_reg_area_pointer,
|
||||
CGF.Builder.CreateGEP(CGF.Int8Ty, __current_saved_reg_area_pointer,
|
||||
llvm::ConstantInt::get(CGF.Int32Ty, ArgSize),
|
||||
"__new_saved_reg_area_pointer");
|
||||
|
||||
@ -8652,7 +8658,8 @@ Address HexagonABIInfo::EmitVAArgForHexagonLinux(CodeGenFunction &CGF,
|
||||
// Get the pointer for next argument in overflow area and store it
|
||||
// to overflow area pointer.
|
||||
llvm::Value *__new_overflow_area_pointer = CGF.Builder.CreateGEP(
|
||||
__overflow_area_pointer, llvm::ConstantInt::get(CGF.Int32Ty, ArgSize),
|
||||
CGF.Int8Ty, __overflow_area_pointer,
|
||||
llvm::ConstantInt::get(CGF.Int32Ty, ArgSize),
|
||||
"__overflow_area_pointer.next");
|
||||
|
||||
CGF.Builder.CreateStore(__new_overflow_area_pointer,
|
||||
|
@ -302,7 +302,7 @@ class ReplaceLDSUseImpl {
|
||||
// Insert required set of instructions which replace LDS within F.
|
||||
auto *V = Builder.CreateBitCast(
|
||||
Builder.CreateGEP(
|
||||
LDSMemBaseAddr,
|
||||
Builder.getInt8Ty(), LDSMemBaseAddr,
|
||||
Builder.CreateLoad(LDSPointer->getValueType(), LDSPointer)),
|
||||
GV->getType());
|
||||
|
||||
|
@ -179,7 +179,8 @@ static void packFunctionArguments(Module *module) {
|
||||
for (auto &indexedArg : llvm::enumerate(func.args())) {
|
||||
llvm::Value *argIndex = llvm::Constant::getIntegerValue(
|
||||
builder.getInt64Ty(), APInt(64, indexedArg.index()));
|
||||
llvm::Value *argPtrPtr = builder.CreateGEP(argList, argIndex);
|
||||
llvm::Value *argPtrPtr = builder.CreateGEP(
|
||||
builder.getInt8Ty(), argList, argIndex);
|
||||
llvm::Value *argPtr = builder.CreateLoad(builder.getInt8PtrTy(),
|
||||
argPtrPtr);
|
||||
llvm::Type *argTy = indexedArg.value().getType();
|
||||
@ -195,7 +196,8 @@ static void packFunctionArguments(Module *module) {
|
||||
if (!result->getType()->isVoidTy()) {
|
||||
llvm::Value *retIndex = llvm::Constant::getIntegerValue(
|
||||
builder.getInt64Ty(), APInt(64, llvm::size(func.args())));
|
||||
llvm::Value *retPtrPtr = builder.CreateGEP(argList, retIndex);
|
||||
llvm::Value *retPtrPtr =
|
||||
builder.CreateGEP(builder.getInt8Ty(), argList, retIndex);
|
||||
llvm::Value *retPtr = builder.CreateLoad(builder.getInt8PtrTy(),
|
||||
retPtrPtr);
|
||||
retPtr = builder.CreateBitCast(retPtr, result->getType()->getPointerTo());
|
||||
|
@ -334,7 +334,8 @@ IslExprBuilder::createAccessAddress(isl_ast_expr *Expr) {
|
||||
IndexOp = createMul(IndexOp, DimSize, "polly.access.mul." + BaseName);
|
||||
}
|
||||
|
||||
Access = Builder.CreateGEP(Base, IndexOp, "polly.access." + BaseName);
|
||||
Access = Builder.CreateGEP(SAI->getElementType(), Base, IndexOp,
|
||||
"polly.access." + BaseName);
|
||||
|
||||
if (PollyDebugPrinting)
|
||||
RuntimeDebugBuilder::createCPUPrinter(Builder, "\n");
|
||||
|
@ -134,7 +134,7 @@ prepareValuesForPrinting(PollyIRBuilder &Builder, ArrayRef<Value *> Values) {
|
||||
} else if (isa<PointerType>(Ty)) {
|
||||
if (Ty->getPointerElementType() == Builder.getInt8Ty() &&
|
||||
Ty->getPointerAddressSpace() == 4) {
|
||||
Val = Builder.CreateGEP(Val, Builder.getInt64(0));
|
||||
Val = Builder.CreateGEP(Builder.getInt8Ty(), Val, Builder.getInt64(0));
|
||||
} else {
|
||||
Val = Builder.CreatePtrToInt(Val, Builder.getInt64Ty());
|
||||
}
|
||||
@ -192,7 +192,8 @@ void RuntimeDebugBuilder::createGPUPrinterT(PollyIRBuilder &Builder,
|
||||
|
||||
int Offset = 0;
|
||||
for (auto Val : ToPrint) {
|
||||
auto Ptr = Builder.CreateGEP(DataPtr, Builder.getInt64(Offset));
|
||||
auto Ptr = Builder.CreateGEP(Builder.getInt32Ty(), DataPtr,
|
||||
Builder.getInt64(Offset));
|
||||
Type *Ty = Val->getType();
|
||||
|
||||
if (Ty->isFloatingPointTy()) {
|
||||
@ -209,7 +210,8 @@ void RuntimeDebugBuilder::createGPUPrinterT(PollyIRBuilder &Builder,
|
||||
} else if (auto PtTy = dyn_cast<PointerType>(Ty)) {
|
||||
if (PtTy->getAddressSpace() == 4) {
|
||||
// Pointers in constant address space are printed as strings
|
||||
Val = Builder.CreateGEP(Val, Builder.getInt64(0));
|
||||
Val = Builder.CreateGEP(Ty->getPointerElementType(), Val,
|
||||
Builder.getInt64(0));
|
||||
auto F = RuntimeDebugBuilder::getAddressSpaceCast(Builder, 4, 0);
|
||||
Val = Builder.CreateCall(F, Val);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user