1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[OpaquePtrs] Remove some uses of type-less CreateLoad APIs (NFC)

Explicitly pass loaded type when creating loads, in preparation
for the deprecation of these APIs.

There are still a couple of uses left.
This commit is contained in:
Nikita Popov 2021-02-12 00:07:23 +01:00
parent fcd766a749
commit e1008acc0b
4 changed files with 17 additions and 15 deletions

View File

@ -552,11 +552,12 @@ IRBuilder<>::InsertPoint OpenMPIRBuilder::createParallel(
AllocaInst *PrivTIDAddr =
Builder.CreateAlloca(Int32, nullptr, "tid.addr.local");
Instruction *PrivTID = Builder.CreateLoad(PrivTIDAddr, "tid");
Instruction *PrivTID = Builder.CreateLoad(Int32, PrivTIDAddr, "tid");
// Add some fake uses for OpenMP provided arguments.
ToBeDeleted.push_back(Builder.CreateLoad(TIDAddr, "tid.addr.use"));
Instruction *ZeroAddrUse = Builder.CreateLoad(ZeroAddr, "zero.addr.use");
ToBeDeleted.push_back(Builder.CreateLoad(Int32, TIDAddr, "tid.addr.use"));
Instruction *ZeroAddrUse = Builder.CreateLoad(Int32, ZeroAddr,
"zero.addr.use");
ToBeDeleted.push_back(ZeroAddrUse);
// ThenBB
@ -637,7 +638,7 @@ IRBuilder<>::InsertPoint OpenMPIRBuilder::createParallel(
// Initialize the local TID stack location with the argument value.
Builder.SetInsertPoint(PrivTID);
Function::arg_iterator OutlinedAI = OutlinedFn.arg_begin();
Builder.CreateStore(Builder.CreateLoad(OutlinedAI), PrivTIDAddr);
Builder.CreateStore(Builder.CreateLoad(Int32, OutlinedAI), PrivTIDAddr);
// If no "if" clause was present we do not need the call created during
// outlining, otherwise we reuse it in the serialized parallel region.
@ -755,7 +756,7 @@ IRBuilder<>::InsertPoint OpenMPIRBuilder::createParallel(
// Load back next to allocations in the to-be-outlined region.
Builder.restoreIP(InnerAllocaIP);
Inner = Builder.CreateLoad(Ptr);
Inner = Builder.CreateLoad(V.getType(), Ptr);
}
Value *ReplacementValue = nullptr;
@ -1141,8 +1142,8 @@ CanonicalLoopInfo *OpenMPIRBuilder::createStaticWorkshareLoop(
Builder.CreateCall(StaticInit,
{SrcLoc, ThreadNum, SchedulingType, PLastIter, PLowerBound,
PUpperBound, PStride, One, Chunk});
Value *LowerBound = Builder.CreateLoad(PLowerBound);
Value *InclusiveUpperBound = Builder.CreateLoad(PUpperBound);
Value *LowerBound = Builder.CreateLoad(IVTy, PLowerBound);
Value *InclusiveUpperBound = Builder.CreateLoad(IVTy, PUpperBound);
Value *TripCountMinusOne = Builder.CreateSub(InclusiveUpperBound, LowerBound);
Value *TripCount = Builder.CreateAdd(TripCountMinusOne, One);
setCanonicalLoopTripCount(CLI, TripCount);
@ -1561,7 +1562,7 @@ OpenMPIRBuilder::createCopyPrivate(const LocationDescription &Loc,
Value *Ident = getOrCreateIdent(SrcLocStr);
Value *ThreadId = getOrCreateThreadID(Ident);
llvm::Value *DidItLD = Builder.CreateLoad(DidIt);
llvm::Value *DidItLD = Builder.CreateLoad(Builder.getInt32Ty(), DidIt);
Value *Args[] = {Ident, ThreadId, BufSize, CpyBuf, CpyFn, DidItLD};

View File

@ -168,7 +168,7 @@ bool AMDGPULateCodeGenPrepare::visitLoadInst(LoadInst &LI) {
IRB.CreateConstGEP1_64(IRB.CreateBitCast(Base, Int8PtrTy),
Offset - Adjust),
Int32PtrTy);
LoadInst *NewLd = IRB.CreateAlignedLoad(NewPtr, Align(4));
LoadInst *NewLd = IRB.CreateAlignedLoad(IRB.getInt32Ty(), NewPtr, Align(4));
NewLd->copyMetadata(LI);
NewLd->setMetadata(LLVMContext::MD_range, nullptr);

View File

@ -797,15 +797,16 @@ public:
/// vectors.
MatrixTy loadMatrix(Type *Ty, Value *Ptr, MaybeAlign MAlign, Value *Stride,
bool IsVolatile, ShapeInfo Shape, IRBuilder<> &Builder) {
auto VType = cast<VectorType>(Ty);
Value *EltPtr = createElementPtr(Ptr, VType->getElementType(), Builder);
auto *VType = cast<VectorType>(Ty);
Type *EltTy = VType->getElementType();
Type *VecTy = FixedVectorType::get(EltTy, Shape.getStride());
Value *EltPtr = createElementPtr(Ptr, EltTy, Builder);
MatrixTy Result;
for (unsigned I = 0, E = Shape.getNumVectors(); I < E; ++I) {
Value *GEP = computeVectorAddr(EltPtr, Builder.getInt64(I), Stride,
Shape.getStride(), VType->getElementType(),
Builder);
Shape.getStride(), EltTy, Builder);
Value *Vector = Builder.CreateAlignedLoad(
GEP, getAlignForIndex(I, Stride, VType->getElementType(), MAlign),
VecTy, GEP, getAlignForIndex(I, Stride, EltTy, MAlign),
IsVolatile, "col.load");
Result.addVector(Vector);

View File

@ -138,7 +138,7 @@ static Value *getStrlenWithNull(IRBuilder<> &Builder, Value *Str) {
PtrPhi->addIncoming(PtrNext, While);
// Condition for the while loop.
auto Data = Builder.CreateLoad(PtrPhi);
auto Data = Builder.CreateLoad(Builder.getInt8Ty(), PtrPhi);
auto Cmp = Builder.CreateICmpEQ(Data, CharZero);
Builder.CreateCondBr(Cmp, WhileDone, While);