forked from OSchip/llvm-project
[OPENMP] Remove more empty SourceLocations() from the code.
Removed more empty SourceLocations() from the OpenMP code and replaced with the correct locations for better debug info emission. llvm-svn: 323232
This commit is contained in:
parent
7143302a7e
commit
a9b9cc0d79
|
@ -190,8 +190,8 @@ class OMPCapturedExprDecl final : public VarDecl {
|
|||
|
||||
OMPCapturedExprDecl(ASTContext &C, DeclContext *DC, IdentifierInfo *Id,
|
||||
QualType Type, SourceLocation StartLoc)
|
||||
: VarDecl(OMPCapturedExpr, C, DC, StartLoc, SourceLocation(), Id, Type,
|
||||
nullptr, SC_None) {
|
||||
: VarDecl(OMPCapturedExpr, C, DC, StartLoc, StartLoc, Id, Type, nullptr,
|
||||
SC_None) {
|
||||
setImplicit();
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
auto PartIdLVal = CGF.EmitLoadOfPointerLValue(
|
||||
CGF.GetAddrOfLocalVar(PartIDVar),
|
||||
PartIDVar->getType()->castAs<PointerType>());
|
||||
auto *Res = CGF.EmitLoadOfScalar(PartIdLVal, SourceLocation());
|
||||
auto *Res = CGF.EmitLoadOfScalar(PartIdLVal, PartIDVar->getLocation());
|
||||
auto *DoneBB = CGF.createBasicBlock(".untied.done.");
|
||||
UntiedSwitch = CGF.Builder.CreateSwitch(Res, DoneBB);
|
||||
CGF.EmitBlock(DoneBB);
|
||||
|
@ -354,7 +354,7 @@ public:
|
|||
DeclRefExpr DRE(const_cast<VarDecl *>(VD),
|
||||
/*RefersToEnclosingVariableOrCapture=*/false,
|
||||
VD->getType().getNonReferenceType(), VK_LValue,
|
||||
SourceLocation());
|
||||
C.getLocation());
|
||||
PrivScope.addPrivate(VD, [&CGF, &DRE]() -> Address {
|
||||
return CGF.EmitLValue(&DRE).getAddress();
|
||||
});
|
||||
|
@ -787,17 +787,17 @@ static void emitInitWithReductionInitializer(CodeGenFunction &CGF,
|
|||
RValue InitRVal;
|
||||
switch (CGF.getEvaluationKind(Ty)) {
|
||||
case TEK_Scalar:
|
||||
InitRVal = CGF.EmitLoadOfLValue(LV, SourceLocation());
|
||||
InitRVal = CGF.EmitLoadOfLValue(LV, DRD->getLocation());
|
||||
break;
|
||||
case TEK_Complex:
|
||||
InitRVal =
|
||||
RValue::getComplex(CGF.EmitLoadOfComplex(LV, SourceLocation()));
|
||||
RValue::getComplex(CGF.EmitLoadOfComplex(LV, DRD->getLocation()));
|
||||
break;
|
||||
case TEK_Aggregate:
|
||||
InitRVal = RValue::getAggregate(LV.getAddress());
|
||||
break;
|
||||
}
|
||||
OpaqueValueExpr OVE(SourceLocation(), Ty, VK_RValue);
|
||||
OpaqueValueExpr OVE(DRD->getLocation(), Ty, VK_RValue);
|
||||
CodeGenFunction::OpaqueValueMapping OpaqueMap(CGF, &OVE, InitRVal);
|
||||
CGF.EmitAnyExprToMem(&OVE, Private, Ty.getQualifiers(),
|
||||
/*IsInitializer=*/false);
|
||||
|
@ -4836,7 +4836,7 @@ void CGOpenMPRuntime::emitTaskLoopCall(CodeGenFunction &CGF, SourceLocation Loc,
|
|||
IfVal,
|
||||
LBLVal.getPointer(),
|
||||
UBLVal.getPointer(),
|
||||
CGF.EmitLoadOfScalar(StLVal, SourceLocation()),
|
||||
CGF.EmitLoadOfScalar(StLVal, Loc),
|
||||
llvm::ConstantInt::getNullValue(
|
||||
CGF.IntTy), // Always 0 because taskgroup emitted by the compiler
|
||||
llvm::ConstantInt::getSigned(
|
||||
|
@ -5399,9 +5399,8 @@ static llvm::Value *emitReduceInitFunction(CodeGenModule &CGM,
|
|||
Address SizeAddr = CGM.getOpenMPRuntime().getAddrOfArtificialThreadPrivate(
|
||||
CGF, CGM.getContext().getSizeType(),
|
||||
generateUniqueName("reduction_size", Loc, N));
|
||||
Size =
|
||||
CGF.EmitLoadOfScalar(SizeAddr, /*Volatile=*/false,
|
||||
CGM.getContext().getSizeType(), SourceLocation());
|
||||
Size = CGF.EmitLoadOfScalar(SizeAddr, /*Volatile=*/false,
|
||||
CGM.getContext().getSizeType(), Loc);
|
||||
}
|
||||
RCG.emitAggregateType(CGF, N, Size);
|
||||
LValue SharedLVal;
|
||||
|
@ -5469,9 +5468,8 @@ static llvm::Value *emitReduceCombFunction(CodeGenModule &CGM,
|
|||
Address SizeAddr = CGM.getOpenMPRuntime().getAddrOfArtificialThreadPrivate(
|
||||
CGF, CGM.getContext().getSizeType(),
|
||||
generateUniqueName("reduction_size", Loc, N));
|
||||
Size =
|
||||
CGF.EmitLoadOfScalar(SizeAddr, /*Volatile=*/false,
|
||||
CGM.getContext().getSizeType(), SourceLocation());
|
||||
Size = CGF.EmitLoadOfScalar(SizeAddr, /*Volatile=*/false,
|
||||
CGM.getContext().getSizeType(), Loc);
|
||||
}
|
||||
RCG.emitAggregateType(CGF, N, Size);
|
||||
// Remap lhs and rhs variables to the addresses of the function arguments.
|
||||
|
@ -5541,9 +5539,8 @@ static llvm::Value *emitReduceFiniFunction(CodeGenModule &CGM,
|
|||
Address SizeAddr = CGM.getOpenMPRuntime().getAddrOfArtificialThreadPrivate(
|
||||
CGF, CGM.getContext().getSizeType(),
|
||||
generateUniqueName("reduction_size", Loc, N));
|
||||
Size =
|
||||
CGF.EmitLoadOfScalar(SizeAddr, /*Volatile=*/false,
|
||||
CGM.getContext().getSizeType(), SourceLocation());
|
||||
Size = CGF.EmitLoadOfScalar(SizeAddr, /*Volatile=*/false,
|
||||
CGM.getContext().getSizeType(), Loc);
|
||||
}
|
||||
RCG.emitAggregateType(CGF, N, Size);
|
||||
// Emit the finalizer body:
|
||||
|
@ -6719,7 +6716,7 @@ public:
|
|||
// FIXME: MSVC 2013 seems to require this-> to find member CGF.
|
||||
llvm::Value *Ptr =
|
||||
this->CGF
|
||||
.EmitLoadOfLValue(this->CGF.EmitLValue(IE), SourceLocation())
|
||||
.EmitLoadOfLValue(this->CGF.EmitLValue(IE), IE->getExprLoc())
|
||||
.getScalarVal();
|
||||
BasePointers.push_back({Ptr, VD});
|
||||
Pointers.push_back(Ptr);
|
||||
|
|
|
@ -1260,7 +1260,7 @@ static void emitReductionListCopy(
|
|||
SrcElementAddr, CGF.ConvertTypeForMem(Private->getType()));
|
||||
llvm::Value *Elem =
|
||||
CGF.EmitLoadOfScalar(SrcElementAddr, /*Volatile=*/false,
|
||||
Private->getType(), SourceLocation());
|
||||
Private->getType(), Private->getExprLoc());
|
||||
|
||||
// Now that all active lanes have read the element in the
|
||||
// Reduce list, shuffle over the value from the remote lane.
|
||||
|
@ -1380,29 +1380,27 @@ static llvm::Value *emitReduceScratchpadFunction(
|
|||
Address ReduceListAddr(
|
||||
Bld.CreatePointerBitCastOrAddrSpaceCast(
|
||||
CGF.EmitLoadOfScalar(AddrReduceListArg, /*Volatile=*/false,
|
||||
C.VoidPtrTy, SourceLocation()),
|
||||
C.VoidPtrTy, Loc),
|
||||
CGF.ConvertTypeForMem(ReductionArrayTy)->getPointerTo()),
|
||||
CGF.getPointerAlign());
|
||||
|
||||
Address AddrScratchPadArg = CGF.GetAddrOfLocalVar(&ScratchPadArg);
|
||||
llvm::Value *ScratchPadBase = CGF.EmitLoadOfScalar(
|
||||
AddrScratchPadArg, /*Volatile=*/false, C.VoidPtrTy, SourceLocation());
|
||||
AddrScratchPadArg, /*Volatile=*/false, C.VoidPtrTy, Loc);
|
||||
|
||||
Address AddrIndexArg = CGF.GetAddrOfLocalVar(&IndexArg);
|
||||
llvm::Value *IndexVal =
|
||||
Bld.CreateIntCast(CGF.EmitLoadOfScalar(AddrIndexArg, /*Volatile=*/false,
|
||||
Int32Ty, SourceLocation()),
|
||||
CGM.SizeTy, /*isSigned=*/true);
|
||||
llvm::Value *IndexVal = Bld.CreateIntCast(
|
||||
CGF.EmitLoadOfScalar(AddrIndexArg, /*Volatile=*/false, Int32Ty, Loc),
|
||||
CGM.SizeTy, /*isSigned=*/true);
|
||||
|
||||
Address AddrWidthArg = CGF.GetAddrOfLocalVar(&WidthArg);
|
||||
llvm::Value *WidthVal =
|
||||
Bld.CreateIntCast(CGF.EmitLoadOfScalar(AddrWidthArg, /*Volatile=*/false,
|
||||
Int32Ty, SourceLocation()),
|
||||
CGM.SizeTy, /*isSigned=*/true);
|
||||
llvm::Value *WidthVal = Bld.CreateIntCast(
|
||||
CGF.EmitLoadOfScalar(AddrWidthArg, /*Volatile=*/false, Int32Ty, Loc),
|
||||
CGM.SizeTy, /*isSigned=*/true);
|
||||
|
||||
Address AddrShouldReduceArg = CGF.GetAddrOfLocalVar(&ShouldReduceArg);
|
||||
llvm::Value *ShouldReduceVal = CGF.EmitLoadOfScalar(
|
||||
AddrShouldReduceArg, /*Volatile=*/false, Int32Ty, SourceLocation());
|
||||
AddrShouldReduceArg, /*Volatile=*/false, Int32Ty, Loc);
|
||||
|
||||
// The absolute ptr address to the base addr of the next element to copy.
|
||||
llvm::Value *CumulativeElemBasePtr =
|
||||
|
@ -1502,19 +1500,18 @@ static llvm::Value *emitCopyToScratchpad(CodeGenModule &CGM,
|
|||
Address SrcDataAddr(
|
||||
Bld.CreatePointerBitCastOrAddrSpaceCast(
|
||||
CGF.EmitLoadOfScalar(AddrReduceListArg, /*Volatile=*/false,
|
||||
C.VoidPtrTy, SourceLocation()),
|
||||
C.VoidPtrTy, Loc),
|
||||
CGF.ConvertTypeForMem(ReductionArrayTy)->getPointerTo()),
|
||||
CGF.getPointerAlign());
|
||||
|
||||
Address AddrScratchPadArg = CGF.GetAddrOfLocalVar(&ScratchPadArg);
|
||||
llvm::Value *ScratchPadBase = CGF.EmitLoadOfScalar(
|
||||
AddrScratchPadArg, /*Volatile=*/false, C.VoidPtrTy, SourceLocation());
|
||||
AddrScratchPadArg, /*Volatile=*/false, C.VoidPtrTy, Loc);
|
||||
|
||||
Address AddrIndexArg = CGF.GetAddrOfLocalVar(&IndexArg);
|
||||
llvm::Value *IndexVal =
|
||||
Bld.CreateIntCast(CGF.EmitLoadOfScalar(AddrIndexArg, /*Volatile=*/false,
|
||||
Int32Ty, SourceLocation()),
|
||||
CGF.SizeTy, /*isSigned=*/true);
|
||||
llvm::Value *IndexVal = Bld.CreateIntCast(
|
||||
CGF.EmitLoadOfScalar(AddrIndexArg, /*Volatile=*/false, Int32Ty, Loc),
|
||||
CGF.SizeTy, /*isSigned=*/true);
|
||||
|
||||
Address AddrWidthArg = CGF.GetAddrOfLocalVar(&WidthArg);
|
||||
llvm::Value *WidthVal =
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
const_cast<VarDecl *>(VD),
|
||||
isCapturedVar(CGF, VD) || (CGF.CapturedStmtInfo &&
|
||||
InlinedShareds.isGlobalVarCaptured(VD)),
|
||||
VD->getType().getNonReferenceType(), VK_LValue, SourceLocation());
|
||||
VD->getType().getNonReferenceType(), VK_LValue, C.getLocation());
|
||||
InlinedShareds.addPrivate(VD, [&CGF, &DRE]() -> Address {
|
||||
return CGF.EmitLValue(&DRE).getAddress();
|
||||
});
|
||||
|
@ -196,7 +196,7 @@ public:
|
|||
(CGF.CapturedStmtInfo &&
|
||||
InlinedShareds.isGlobalVarCaptured(VD)),
|
||||
VD->getType().getNonReferenceType(), VK_LValue,
|
||||
SourceLocation());
|
||||
C.getLocation());
|
||||
InlinedShareds.addPrivate(VD, [&CGF, &DRE]() -> Address {
|
||||
return CGF.EmitLValue(&DRE).getAddress();
|
||||
});
|
||||
|
@ -279,7 +279,7 @@ void CodeGenFunction::GenerateOpenMPCapturedVars(
|
|||
|
||||
auto *SrcAddrVal = EmitScalarConversion(
|
||||
DstAddr.getPointer(), Ctx.getPointerType(Ctx.getUIntPtrType()),
|
||||
Ctx.getPointerType(CurField->getType()), SourceLocation());
|
||||
Ctx.getPointerType(CurField->getType()), CurCap->getLocation());
|
||||
LValue SrcLV =
|
||||
MakeNaturalAlignAddrLValue(SrcAddrVal, CurField->getType());
|
||||
|
||||
|
@ -287,7 +287,7 @@ void CodeGenFunction::GenerateOpenMPCapturedVars(
|
|||
EmitStoreThroughLValue(RValue::get(CV), SrcLV);
|
||||
|
||||
// Load the value using the destination type pointer.
|
||||
CV = EmitLoadOfLValue(DstLV, SourceLocation()).getScalarVal();
|
||||
CV = EmitLoadOfLValue(DstLV, CurCap->getLocation()).getScalarVal();
|
||||
}
|
||||
CapturedVars.push_back(CV);
|
||||
} else {
|
||||
|
@ -297,14 +297,15 @@ void CodeGenFunction::GenerateOpenMPCapturedVars(
|
|||
}
|
||||
}
|
||||
|
||||
static Address castValueFromUintptr(CodeGenFunction &CGF, QualType DstType,
|
||||
StringRef Name, LValue AddrLV,
|
||||
static Address castValueFromUintptr(CodeGenFunction &CGF, SourceLocation Loc,
|
||||
QualType DstType, StringRef Name,
|
||||
LValue AddrLV,
|
||||
bool isReferenceType = false) {
|
||||
ASTContext &Ctx = CGF.getContext();
|
||||
|
||||
auto *CastedPtr = CGF.EmitScalarConversion(
|
||||
AddrLV.getAddress().getPointer(), Ctx.getUIntPtrType(),
|
||||
Ctx.getPointerType(DstType), SourceLocation());
|
||||
auto *CastedPtr = CGF.EmitScalarConversion(AddrLV.getAddress().getPointer(),
|
||||
Ctx.getUIntPtrType(),
|
||||
Ctx.getPointerType(DstType), Loc);
|
||||
auto TmpAddr =
|
||||
CGF.MakeNaturalAlignAddrLValue(CastedPtr, Ctx.getPointerType(DstType))
|
||||
.getAddress();
|
||||
|
@ -495,13 +496,13 @@ static llvm::Function *emitOutlinedFunctionPrologue(
|
|||
AlignmentSource::Decl);
|
||||
if (FD->hasCapturedVLAType()) {
|
||||
if (FO.UIntPtrCastRequired) {
|
||||
ArgLVal = CGF.MakeAddrLValue(castValueFromUintptr(CGF, FD->getType(),
|
||||
Args[Cnt]->getName(),
|
||||
ArgLVal),
|
||||
FD->getType(), AlignmentSource::Decl);
|
||||
ArgLVal = CGF.MakeAddrLValue(
|
||||
castValueFromUintptr(CGF, I->getLocation(), FD->getType(),
|
||||
Args[Cnt]->getName(), ArgLVal),
|
||||
FD->getType(), AlignmentSource::Decl);
|
||||
}
|
||||
auto *ExprArg =
|
||||
CGF.EmitLoadOfLValue(ArgLVal, SourceLocation()).getScalarVal();
|
||||
CGF.EmitLoadOfLValue(ArgLVal, I->getLocation()).getScalarVal();
|
||||
auto VAT = FD->getCapturedVLAType();
|
||||
VLASizes.insert({Args[Cnt], {VAT->getSizeExpr(), ExprArg}});
|
||||
} else if (I->capturesVariable()) {
|
||||
|
@ -529,16 +530,16 @@ static llvm::Function *emitOutlinedFunctionPrologue(
|
|||
QualType VarTy = Var->getType();
|
||||
LocalAddrs.insert(
|
||||
{Args[Cnt],
|
||||
{Var,
|
||||
FO.UIntPtrCastRequired
|
||||
? castValueFromUintptr(CGF, FD->getType(), Args[Cnt]->getName(),
|
||||
ArgLVal, VarTy->isReferenceType())
|
||||
: ArgLVal.getAddress()}});
|
||||
{Var, FO.UIntPtrCastRequired
|
||||
? castValueFromUintptr(CGF, I->getLocation(),
|
||||
FD->getType(), Args[Cnt]->getName(),
|
||||
ArgLVal, VarTy->isReferenceType())
|
||||
: ArgLVal.getAddress()}});
|
||||
} else {
|
||||
// If 'this' is captured, load it into CXXThisValue.
|
||||
assert(I->capturesThis());
|
||||
CXXThisValue = CGF.EmitLoadOfLValue(ArgLVal, Args[Cnt]->getLocation())
|
||||
.getScalarVal();
|
||||
CXXThisValue =
|
||||
CGF.EmitLoadOfLValue(ArgLVal, I->getLocation()).getScalarVal();
|
||||
LocalAddrs.insert({Args[Cnt], {nullptr, ArgLVal.getAddress()}});
|
||||
}
|
||||
++Cnt;
|
||||
|
@ -603,7 +604,7 @@ CodeGenFunction::GenerateOpenMPCapturedStmtFunction(const CapturedStmt &S) {
|
|||
I->second.second,
|
||||
I->second.first ? I->second.first->getType() : Arg->getType(),
|
||||
AlignmentSource::Decl);
|
||||
CallArg = WrapperCGF.EmitLoadOfScalar(LV, SourceLocation());
|
||||
CallArg = WrapperCGF.EmitLoadOfScalar(LV, S.getLocStart());
|
||||
} else {
|
||||
auto EI = VLASizes.find(Arg);
|
||||
if (EI != VLASizes.end())
|
||||
|
@ -612,7 +613,7 @@ CodeGenFunction::GenerateOpenMPCapturedStmtFunction(const CapturedStmt &S) {
|
|||
LValue LV = WrapperCGF.MakeAddrLValue(WrapperCGF.GetAddrOfLocalVar(Arg),
|
||||
Arg->getType(),
|
||||
AlignmentSource::Decl);
|
||||
CallArg = WrapperCGF.EmitLoadOfScalar(LV, SourceLocation());
|
||||
CallArg = WrapperCGF.EmitLoadOfScalar(LV, S.getLocStart());
|
||||
}
|
||||
}
|
||||
CallArgs.emplace_back(WrapperCGF.EmitFromMemory(CallArg, Arg->getType()));
|
||||
|
@ -2032,14 +2033,18 @@ emitDistributeParallelForInnerBounds(CodeGenFunction &CGF,
|
|||
// the current ones.
|
||||
LValue PrevLB = CGF.EmitLValue(LS.getPrevLowerBoundVariable());
|
||||
LValue PrevUB = CGF.EmitLValue(LS.getPrevUpperBoundVariable());
|
||||
llvm::Value *PrevLBVal = CGF.EmitLoadOfScalar(PrevLB, SourceLocation());
|
||||
llvm::Value *PrevLBVal = CGF.EmitLoadOfScalar(
|
||||
PrevLB, LS.getPrevLowerBoundVariable()->getExprLoc());
|
||||
PrevLBVal = CGF.EmitScalarConversion(
|
||||
PrevLBVal, LS.getPrevLowerBoundVariable()->getType(),
|
||||
LS.getIterationVariable()->getType(), SourceLocation());
|
||||
llvm::Value *PrevUBVal = CGF.EmitLoadOfScalar(PrevUB, SourceLocation());
|
||||
LS.getIterationVariable()->getType(),
|
||||
LS.getPrevLowerBoundVariable()->getExprLoc());
|
||||
llvm::Value *PrevUBVal = CGF.EmitLoadOfScalar(
|
||||
PrevUB, LS.getPrevUpperBoundVariable()->getExprLoc());
|
||||
PrevUBVal = CGF.EmitScalarConversion(
|
||||
PrevUBVal, LS.getPrevUpperBoundVariable()->getType(),
|
||||
LS.getIterationVariable()->getType(), SourceLocation());
|
||||
LS.getIterationVariable()->getType(),
|
||||
LS.getPrevUpperBoundVariable()->getExprLoc());
|
||||
|
||||
CGF.EmitStoreOfScalar(PrevLBVal, LB);
|
||||
CGF.EmitStoreOfScalar(PrevUBVal, UB);
|
||||
|
@ -2065,10 +2070,10 @@ emitDistributeParallelForDispatchBounds(CodeGenFunction &CGF,
|
|||
// is not normalized as each team only executes its own assigned
|
||||
// distribute chunk
|
||||
QualType IteratorTy = IVExpr->getType();
|
||||
llvm::Value *LBVal = CGF.EmitLoadOfScalar(LB, /*Volatile=*/false, IteratorTy,
|
||||
SourceLocation());
|
||||
llvm::Value *UBVal = CGF.EmitLoadOfScalar(UB, /*Volatile=*/false, IteratorTy,
|
||||
SourceLocation());
|
||||
llvm::Value *LBVal =
|
||||
CGF.EmitLoadOfScalar(LB, /*Volatile=*/false, IteratorTy, S.getLocStart());
|
||||
llvm::Value *UBVal =
|
||||
CGF.EmitLoadOfScalar(UB, /*Volatile=*/false, IteratorTy, S.getLocStart());
|
||||
return {LBVal, UBVal};
|
||||
}
|
||||
|
||||
|
@ -2489,9 +2494,9 @@ void CodeGenFunction::EmitSections(const OMPExecutableDirective &S) {
|
|||
// }
|
||||
// .omp.sections.exit:
|
||||
auto *ExitBB = CGF.createBasicBlock(".omp.sections.exit");
|
||||
auto *SwitchStmt = CGF.Builder.CreateSwitch(
|
||||
CGF.EmitLoadOfLValue(IV, S.getLocStart()).getScalarVal(), ExitBB,
|
||||
CS == nullptr ? 1 : CS->size());
|
||||
auto *SwitchStmt =
|
||||
CGF.Builder.CreateSwitch(CGF.EmitLoadOfScalar(IV, S.getLocStart()),
|
||||
ExitBB, CS == nullptr ? 1 : CS->size());
|
||||
if (CS) {
|
||||
unsigned CaseNumber = 0;
|
||||
for (auto *SubStmt : CS->children()) {
|
||||
|
@ -2886,7 +2891,7 @@ void CodeGenFunction::EmitOMPTaskBasedDirective(
|
|||
Replacement.getPointer(), CGF.getContext().VoidPtrTy,
|
||||
CGF.getContext().getPointerType(
|
||||
Data.ReductionCopies[Cnt]->getType()),
|
||||
SourceLocation()),
|
||||
Data.ReductionCopies[Cnt]->getExprLoc()),
|
||||
Replacement.getAlignment());
|
||||
Replacement = RedCG.adjustPrivateAddress(CGF, Cnt, Replacement);
|
||||
Scope.addPrivate(RedCG.getBaseDecl(Cnt),
|
||||
|
@ -2928,15 +2933,16 @@ void CodeGenFunction::EmitOMPTaskBasedDirective(
|
|||
RedCG.emitAggregateType(CGF, Cnt);
|
||||
// The taskgroup descriptor variable is always implicit firstprivate and
|
||||
// privatized already during procoessing of the firstprivates.
|
||||
llvm::Value *ReductionsPtr = CGF.EmitLoadOfScalar(
|
||||
CGF.EmitLValue(TaskgroupDescriptors[Cnt]), SourceLocation());
|
||||
llvm::Value *ReductionsPtr =
|
||||
CGF.EmitLoadOfScalar(CGF.EmitLValue(TaskgroupDescriptors[Cnt]),
|
||||
TaskgroupDescriptors[Cnt]->getExprLoc());
|
||||
Address Replacement = CGF.CGM.getOpenMPRuntime().getTaskReductionItem(
|
||||
CGF, S.getLocStart(), ReductionsPtr, RedCG.getSharedLValue(Cnt));
|
||||
Replacement = Address(
|
||||
CGF.EmitScalarConversion(
|
||||
Replacement.getPointer(), CGF.getContext().VoidPtrTy,
|
||||
CGF.getContext().getPointerType(InRedPrivs[Cnt]->getType()),
|
||||
SourceLocation()),
|
||||
InRedPrivs[Cnt]->getExprLoc()),
|
||||
Replacement.getAlignment());
|
||||
Replacement = RedCG.adjustPrivateAddress(CGF, Cnt, Replacement);
|
||||
InRedScope.addPrivate(RedCG.getBaseDecl(Cnt),
|
||||
|
@ -2962,27 +2968,24 @@ void CodeGenFunction::EmitOMPTaskBasedDirective(
|
|||
|
||||
static ImplicitParamDecl *
|
||||
createImplicitFirstprivateForType(ASTContext &C, OMPTaskDataTy &Data,
|
||||
QualType Ty, CapturedDecl *CD) {
|
||||
auto *OrigVD = ImplicitParamDecl::Create(
|
||||
C, CD, SourceLocation(), /*Id=*/nullptr, Ty, ImplicitParamDecl::Other);
|
||||
auto *OrigRef =
|
||||
DeclRefExpr::Create(C, NestedNameSpecifierLoc(), SourceLocation(), OrigVD,
|
||||
/*RefersToEnclosingVariableOrCapture=*/false,
|
||||
SourceLocation(), Ty, VK_LValue);
|
||||
auto *PrivateVD = ImplicitParamDecl::Create(
|
||||
C, CD, SourceLocation(), /*Id=*/nullptr, Ty, ImplicitParamDecl::Other);
|
||||
QualType Ty, CapturedDecl *CD,
|
||||
SourceLocation Loc) {
|
||||
auto *OrigVD = ImplicitParamDecl::Create(C, CD, Loc, /*Id=*/nullptr, Ty,
|
||||
ImplicitParamDecl::Other);
|
||||
auto *OrigRef = DeclRefExpr::Create(
|
||||
C, NestedNameSpecifierLoc(), SourceLocation(), OrigVD,
|
||||
/*RefersToEnclosingVariableOrCapture=*/false, Loc, Ty, VK_LValue);
|
||||
auto *PrivateVD = ImplicitParamDecl::Create(C, CD, Loc, /*Id=*/nullptr, Ty,
|
||||
ImplicitParamDecl::Other);
|
||||
auto *PrivateRef = DeclRefExpr::Create(
|
||||
C, NestedNameSpecifierLoc(), SourceLocation(), PrivateVD,
|
||||
/*RefersToEnclosingVariableOrCapture=*/false, SourceLocation(), Ty,
|
||||
VK_LValue);
|
||||
/*RefersToEnclosingVariableOrCapture=*/false, Loc, Ty, VK_LValue);
|
||||
QualType ElemType = C.getBaseElementType(Ty);
|
||||
auto *InitVD =
|
||||
ImplicitParamDecl::Create(C, CD, SourceLocation(), /*Id=*/nullptr,
|
||||
ElemType, ImplicitParamDecl::Other);
|
||||
auto *InitRef =
|
||||
DeclRefExpr::Create(C, NestedNameSpecifierLoc(), SourceLocation(), InitVD,
|
||||
/*RefersToEnclosingVariableOrCapture=*/false,
|
||||
SourceLocation(), ElemType, VK_LValue);
|
||||
auto *InitVD = ImplicitParamDecl::Create(C, CD, Loc, /*Id=*/nullptr, ElemType,
|
||||
ImplicitParamDecl::Other);
|
||||
auto *InitRef = DeclRefExpr::Create(
|
||||
C, NestedNameSpecifierLoc(), SourceLocation(), InitVD,
|
||||
/*RefersToEnclosingVariableOrCapture=*/false, Loc, ElemType, VK_LValue);
|
||||
PrivateVD->setInitStyle(VarDecl::CInit);
|
||||
PrivateVD->setInit(ImplicitCastExpr::Create(C, ElemType, CK_LValueToRValue,
|
||||
InitRef, /*BasePath=*/nullptr,
|
||||
|
@ -3029,14 +3032,15 @@ void CodeGenFunction::EmitOMPTargetTaskBasedDirective(
|
|||
QualType BaseAndPointersType = getContext().getConstantArrayType(
|
||||
getContext().VoidPtrTy, ArrSize, ArrayType::Normal,
|
||||
/*IndexTypeQuals=*/0);
|
||||
BPVD = createImplicitFirstprivateForType(getContext(), Data,
|
||||
BaseAndPointersType, CD);
|
||||
PVD = createImplicitFirstprivateForType(getContext(), Data,
|
||||
BaseAndPointersType, CD);
|
||||
BPVD = createImplicitFirstprivateForType(
|
||||
getContext(), Data, BaseAndPointersType, CD, S.getLocStart());
|
||||
PVD = createImplicitFirstprivateForType(
|
||||
getContext(), Data, BaseAndPointersType, CD, S.getLocStart());
|
||||
QualType SizesType = getContext().getConstantArrayType(
|
||||
getContext().getSizeType(), ArrSize, ArrayType::Normal,
|
||||
/*IndexTypeQuals=*/0);
|
||||
SVD = createImplicitFirstprivateForType(getContext(), Data, SizesType, CD);
|
||||
SVD = createImplicitFirstprivateForType(getContext(), Data, SizesType, CD,
|
||||
S.getLocStart());
|
||||
TargetScope.addPrivate(
|
||||
BPVD, [&InputInfo]() { return InputInfo.BasePointersArray; });
|
||||
TargetScope.addPrivate(PVD,
|
||||
|
|
|
@ -4863,7 +4863,7 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
|
|||
}
|
||||
|
||||
// Loop condition (IV < NumIterations) or (IV <= UB) for worksharing loops.
|
||||
SourceLocation CondLoc;
|
||||
SourceLocation CondLoc = AStmt->getLocStart();
|
||||
ExprResult Cond =
|
||||
(isOpenMPWorksharingDirective(DKind) ||
|
||||
isOpenMPTaskLoopDirective(DKind) || isOpenMPDistributeDirective(DKind))
|
||||
|
@ -4876,7 +4876,7 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
|
|||
SemaRef.BuildBinOp(CurScope, CondLoc, BO_LE, IV.get(), CombUB.get());
|
||||
}
|
||||
// Loop increment (IV = IV + 1)
|
||||
SourceLocation IncLoc;
|
||||
SourceLocation IncLoc = AStmt->getLocStart();
|
||||
ExprResult Inc =
|
||||
SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, IV.get(),
|
||||
SemaRef.ActOnIntegerConstant(IncLoc, 1).get());
|
||||
|
@ -4943,7 +4943,7 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
|
|||
// directive with for as IV = IV + ST; ensure upper bound expression based
|
||||
// on PrevUB instead of NumIterations - used to implement 'for' when found
|
||||
// in combination with 'distribute', like in 'distribute parallel for'
|
||||
SourceLocation DistIncLoc;
|
||||
SourceLocation DistIncLoc = AStmt->getLocStart();
|
||||
ExprResult DistCond, DistInc, PrevEUB;
|
||||
if (isOpenMPLoopBoundSharingDirective(DKind)) {
|
||||
DistCond = SemaRef.BuildBinOp(CurScope, CondLoc, BO_LE, IV.get(), UB.get());
|
||||
|
@ -4959,7 +4959,7 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
|
|||
|
||||
// Build expression: UB = min(UB, prevUB) for #for in composite or combined
|
||||
// construct
|
||||
SourceLocation DistEUBLoc;
|
||||
SourceLocation DistEUBLoc = AStmt->getLocStart();
|
||||
ExprResult IsUBGreater =
|
||||
SemaRef.BuildBinOp(CurScope, DistEUBLoc, BO_GT, UB.get(), PrevUB.get());
|
||||
ExprResult CondOp = SemaRef.ActOnConditionalOp(
|
||||
|
|
|
@ -35,4 +35,6 @@ int main() {
|
|||
// CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}})
|
||||
// CHECK: ret
|
||||
|
||||
// CHECK-NOT: line: 0,
|
||||
|
||||
#endif
|
||||
|
|
|
@ -690,4 +690,5 @@ void parallel_simd(float *a) {
|
|||
a[i] += bar();
|
||||
}
|
||||
// TERM_DEBUG: !{{[0-9]+}} = !DILocation(line: [[@LINE-11]],
|
||||
// TERM_DEBUG-NOT: line: 0,
|
||||
#endif // HEADER
|
||||
|
|
|
@ -685,5 +685,6 @@ void parallel_simd(float *a) {
|
|||
a[i] += bar();
|
||||
}
|
||||
// TERM_DEBUG: !{{[0-9]+}} = !DILocation(line: [[@LINE-11]],
|
||||
// TERM_DEBUG-NOT: line: 0,
|
||||
#endif // HEADER
|
||||
|
||||
|
|
|
@ -708,5 +708,8 @@ public:
|
|||
};
|
||||
S8 s8(0);
|
||||
|
||||
// TERM_DEBUG-NOT: line: 0,
|
||||
// TERM_DEBUG: distinct !DISubprogram(linkageName: "_GLOBAL__sub_I_simd_codegen.cpp",
|
||||
|
||||
#endif // HEADER
|
||||
|
||||
|
|
Loading…
Reference in New Issue