forked from OSchip/llvm-project
[OPENMP] Replace call of EmitLoadOfLValue() by EmitLoadOfScalar(), NFC.
Replace calls of EmitLoadOfLValue() by EmitLoadOfScalar() functions if it is known that the value is scalar. llvm-svn: 323236
This commit is contained in:
parent
596527bca6
commit
1e49137d34
|
@ -1499,7 +1499,7 @@ llvm::Value *CGOpenMPRuntime::getThreadID(CodeGenFunction &CGF,
|
|||
if (OMPRegionInfo->getThreadIDVariable()) {
|
||||
// Check if this an outlined function with thread id passed as argument.
|
||||
auto LVal = OMPRegionInfo->getThreadIDVariableLValue(CGF);
|
||||
ThreadID = CGF.EmitLoadOfLValue(LVal, Loc).getScalarVal();
|
||||
ThreadID = CGF.EmitLoadOfScalar(LVal, Loc);
|
||||
// If value loaded in entry block, cache it and use it everywhere in
|
||||
// function.
|
||||
if (CGF.Builder.GetInsertBlock() == CGF.AllocaInsertPt->getParent()) {
|
||||
|
@ -3979,7 +3979,7 @@ emitProxyTaskFunction(CodeGenModule &CGM, SourceLocation Loc,
|
|||
auto SharedsFI = std::next(KmpTaskTQTyRD->field_begin(), KmpTaskTShareds);
|
||||
auto SharedsLVal = CGF.EmitLValueForField(Base, *SharedsFI);
|
||||
auto *SharedsParam = CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
|
||||
CGF.EmitLoadOfLValue(SharedsLVal, Loc).getScalarVal(),
|
||||
CGF.EmitLoadOfScalar(SharedsLVal, Loc),
|
||||
CGF.ConvertTypeForMem(SharedsPtrTy));
|
||||
|
||||
auto PrivatesFI = std::next(KmpTaskTWithPrivatesQTyRD->field_begin(), 1);
|
||||
|
@ -4002,19 +4002,19 @@ emitProxyTaskFunction(CodeGenModule &CGM, SourceLocation Loc,
|
|||
if (isOpenMPTaskLoopDirective(Kind)) {
|
||||
auto LBFI = std::next(KmpTaskTQTyRD->field_begin(), KmpTaskTLowerBound);
|
||||
auto LBLVal = CGF.EmitLValueForField(Base, *LBFI);
|
||||
auto *LBParam = CGF.EmitLoadOfLValue(LBLVal, Loc).getScalarVal();
|
||||
auto *LBParam = CGF.EmitLoadOfScalar(LBLVal, Loc);
|
||||
auto UBFI = std::next(KmpTaskTQTyRD->field_begin(), KmpTaskTUpperBound);
|
||||
auto UBLVal = CGF.EmitLValueForField(Base, *UBFI);
|
||||
auto *UBParam = CGF.EmitLoadOfLValue(UBLVal, Loc).getScalarVal();
|
||||
auto *UBParam = CGF.EmitLoadOfScalar(UBLVal, Loc);
|
||||
auto StFI = std::next(KmpTaskTQTyRD->field_begin(), KmpTaskTStride);
|
||||
auto StLVal = CGF.EmitLValueForField(Base, *StFI);
|
||||
auto *StParam = CGF.EmitLoadOfLValue(StLVal, Loc).getScalarVal();
|
||||
auto *StParam = CGF.EmitLoadOfScalar(StLVal, Loc);
|
||||
auto LIFI = std::next(KmpTaskTQTyRD->field_begin(), KmpTaskTLastIter);
|
||||
auto LILVal = CGF.EmitLValueForField(Base, *LIFI);
|
||||
auto *LIParam = CGF.EmitLoadOfLValue(LILVal, Loc).getScalarVal();
|
||||
auto *LIParam = CGF.EmitLoadOfScalar(LILVal, Loc);
|
||||
auto RFI = std::next(KmpTaskTQTyRD->field_begin(), KmpTaskTReductions);
|
||||
auto RLVal = CGF.EmitLValueForField(Base, *RFI);
|
||||
auto *RParam = CGF.EmitLoadOfLValue(RLVal, Loc).getScalarVal();
|
||||
auto *RParam = CGF.EmitLoadOfScalar(RLVal, Loc);
|
||||
CallArgs.push_back(LBParam);
|
||||
CallArgs.push_back(UBParam);
|
||||
CallArgs.push_back(StParam);
|
||||
|
@ -6714,10 +6714,8 @@ public:
|
|||
// We didn't find any match in our map information - generate a zero
|
||||
// size array section.
|
||||
// FIXME: MSVC 2013 seems to require this-> to find member CGF.
|
||||
llvm::Value *Ptr =
|
||||
this->CGF
|
||||
.EmitLoadOfLValue(this->CGF.EmitLValue(IE), IE->getExprLoc())
|
||||
.getScalarVal();
|
||||
llvm::Value *Ptr = this->CGF.EmitLoadOfScalar(this->CGF.EmitLValue(IE),
|
||||
IE->getExprLoc());
|
||||
BasePointers.push_back({Ptr, VD});
|
||||
Pointers.push_back(Ptr);
|
||||
Sizes.push_back(llvm::Constant::getNullValue(this->CGF.SizeTy));
|
||||
|
|
|
@ -265,8 +265,7 @@ void CodeGenFunction::GenerateOpenMPCapturedVars(
|
|||
} else if (CurCap->capturesThis())
|
||||
CapturedVars.push_back(CXXThisValue);
|
||||
else if (CurCap->capturesVariableByCopy()) {
|
||||
llvm::Value *CV =
|
||||
EmitLoadOfLValue(EmitLValue(*I), SourceLocation()).getScalarVal();
|
||||
llvm::Value *CV = EmitLoadOfScalar(EmitLValue(*I), CurCap->getLocation());
|
||||
|
||||
// If the field is not a pointer, we need to save the actual value
|
||||
// and load it as a void pointer.
|
||||
|
@ -287,7 +286,7 @@ void CodeGenFunction::GenerateOpenMPCapturedVars(
|
|||
EmitStoreThroughLValue(RValue::get(CV), SrcLV);
|
||||
|
||||
// Load the value using the destination type pointer.
|
||||
CV = EmitLoadOfLValue(DstLV, CurCap->getLocation()).getScalarVal();
|
||||
CV = EmitLoadOfScalar(DstLV, CurCap->getLocation());
|
||||
}
|
||||
CapturedVars.push_back(CV);
|
||||
} else {
|
||||
|
@ -501,8 +500,7 @@ static llvm::Function *emitOutlinedFunctionPrologue(
|
|||
Args[Cnt]->getName(), ArgLVal),
|
||||
FD->getType(), AlignmentSource::Decl);
|
||||
}
|
||||
auto *ExprArg =
|
||||
CGF.EmitLoadOfLValue(ArgLVal, I->getLocation()).getScalarVal();
|
||||
auto *ExprArg = CGF.EmitLoadOfScalar(ArgLVal, I->getLocation());
|
||||
auto VAT = FD->getCapturedVLAType();
|
||||
VLASizes.insert({Args[Cnt], {VAT->getSizeExpr(), ExprArg}});
|
||||
} else if (I->capturesVariable()) {
|
||||
|
@ -538,8 +536,7 @@ static llvm::Function *emitOutlinedFunctionPrologue(
|
|||
} else {
|
||||
// If 'this' is captured, load it into CXXThisValue.
|
||||
assert(I->capturesThis());
|
||||
CXXThisValue =
|
||||
CGF.EmitLoadOfLValue(ArgLVal, I->getLocation()).getScalarVal();
|
||||
CXXThisValue = CGF.EmitLoadOfScalar(ArgLVal, I->getLocation());
|
||||
LocalAddrs.insert({Args[Cnt], {nullptr, ArgLVal.getAddress()}});
|
||||
}
|
||||
++Cnt;
|
||||
|
|
Loading…
Reference in New Issue