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