Skip to content

Commit 63508b8

Browse files
committed
merge main into amd-staging
xfails new test: Driver/XRay/xray-shared.cpp Change-Id: I7f4cb89a3b12ed39ab2221191b6611d581b416fa
2 parents 56e3e19 + c2d2b3b commit 63508b8

File tree

385 files changed

+7798
-5630
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

385 files changed

+7798
-5630
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,8 @@ Improvements to Clang's diagnostics
449449
name was a reserved name, which we improperly allowed to suppress the
450450
diagnostic.
451451

452+
- Clang now diagnoses ``[[deprecated]]`` attribute usage on local variables (#GH90073).
453+
452454
Improvements to Clang's time-trace
453455
----------------------------------
454456

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ CODEGENOPT(XRayIgnoreLoops , 1, 0)
136136
///< Emit the XRay function index section.
137137
CODEGENOPT(XRayFunctionIndex , 1, 1)
138138

139+
///< Set when -fxray-shared is enabled
140+
CODEGENOPT(XRayShared , 1, 0)
139141

140142
///< Set the minimum number of instructions in a function to determine selective
141143
///< XRay instrumentation.

clang/include/clang/Driver/Options.td

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2953,6 +2953,11 @@ def fxray_selected_function_group :
29532953
HelpText<"When using -fxray-function-groups, select which group of functions to instrument. Valid range is 0 to fxray-function-groups - 1">,
29542954
MarshallingInfoInt<CodeGenOpts<"XRaySelectedFunctionGroup">, "0">;
29552955

2956+
defm xray_shared : BoolFOption<"xray-shared",
2957+
CodeGenOpts<"XRayShared">, DefaultFalse,
2958+
PosFlag<SetTrue, [], [ClangOption, CC1Option],
2959+
"Enable shared library instrumentation with XRay">,
2960+
NegFlag<SetFalse>>;
29562961

29572962
defm fine_grained_bitfield_accesses : BoolOption<"f", "fine-grained-bitfield-accesses",
29582963
CodeGenOpts<"FineGrainedBitfieldAccesses">, DefaultFalse,
@@ -5512,9 +5517,9 @@ def mfrecipe : Flag<["-"], "mfrecipe">, Group<m_loongarch_Features_Group>,
55125517
def mno_frecipe : Flag<["-"], "mno-frecipe">, Group<m_loongarch_Features_Group>,
55135518
HelpText<"Disable frecipe.{s/d} and frsqrte.{s/d}">;
55145519
def mlam_bh : Flag<["-"], "mlam-bh">, Group<m_loongarch_Features_Group>,
5515-
HelpText<"Enable amswap_[db].{b/h} and amadd_[db].{b/h}">;
5520+
HelpText<"Enable amswap[_db].{b/h} and amadd[_db].{b/h}">;
55165521
def mno_lam_bh : Flag<["-"], "mno-lam-bh">, Group<m_loongarch_Features_Group>,
5517-
HelpText<"Disable amswap_[db].{b/h} and amadd_[db].{b/h}">;
5522+
HelpText<"Disable amswap[_db].{b/h} and amadd[_db].{b/h}">;
55185523
def mannotate_tablejump : Flag<["-"], "mannotate-tablejump">, Group<m_loongarch_Features_Group>,
55195524
HelpText<"Enable annotate table jump instruction to correlate it with the jump table.">;
55205525
def mno_annotate_tablejump : Flag<["-"], "mno-annotate-tablejump">, Group<m_loongarch_Features_Group>,
@@ -6917,10 +6922,6 @@ def flang_deprecated_no_hlfir : Flag<["-"], "flang-deprecated-no-hlfir">,
69176922
Flags<[HelpHidden]>, Visibility<[FlangOption, FC1Option]>,
69186923
HelpText<"Do not use HLFIR lowering (deprecated)">;
69196924

6920-
def flang_experimental_integer_overflow : Flag<["-"], "flang-experimental-integer-overflow">,
6921-
Flags<[HelpHidden]>, Visibility<[FlangOption, FC1Option]>,
6922-
HelpText<"Add nsw flag to internal operations such as do-variable increment (experimental)">;
6923-
69246925
//===----------------------------------------------------------------------===//
69256926
// FLangOption + CoreOption + NoXarchOption
69266927
//===----------------------------------------------------------------------===//

clang/include/clang/Driver/XRayArgs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class XRayArgs {
2727
XRayInstrSet InstrumentationBundle;
2828
llvm::opt::Arg *XRayInstrument = nullptr;
2929
bool XRayRT = true;
30+
bool XRayShared = false;
3031

3132
public:
3233
/// Parses the XRay arguments from an argument list.
@@ -35,6 +36,7 @@ class XRayArgs {
3536
llvm::opt::ArgStringList &CmdArgs, types::ID InputType) const;
3637

3738
bool needsXRayRt() const { return XRayInstrument && XRayRT; }
39+
bool needsXRayDSORt() const { return XRayInstrument && XRayRT && XRayShared; }
3840
llvm::ArrayRef<std::string> modeList() const { return Modes; }
3941
XRayInstrSet instrumentationBundle() const { return InstrumentationBundle; }
4042
};

clang/lib/CodeGen/CGCall.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5126,7 +5126,11 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
51265126
RawAddress SRetAlloca = RawAddress::invalid();
51275127
llvm::Value *UnusedReturnSizePtr = nullptr;
51285128
if (RetAI.isIndirect() || RetAI.isInAlloca() || RetAI.isCoerceAndExpand()) {
5129-
if (IsVirtualFunctionPointerThunk && RetAI.isIndirect()) {
5129+
// For virtual function pointer thunks and musttail calls, we must always
5130+
// forward an incoming SRet pointer to the callee, because a local alloca
5131+
// would be de-allocated before the call. These cases both guarantee that
5132+
// there will be an incoming SRet argument of the correct type.
5133+
if ((IsVirtualFunctionPointerThunk || IsMustTail) && RetAI.isIndirect()) {
51305134
SRetPtr = makeNaturalAddressForPointer(CurFn->arg_begin() +
51315135
IRFunctionArgs.getSRetArgNo(),
51325136
RetTy, CharUnits::fromQuantity(1));

clang/lib/CodeGen/CGOpenMPRuntime.cpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,7 @@ struct PushAndPopStackRAII {
12141214
CodeGenFunction::JumpDest Dest =
12151215
CGF.getOMPCancelDestination(OMPD_parallel);
12161216
CGF.EmitBranchThroughCleanup(Dest);
1217+
return llvm::Error::success();
12171218
};
12181219

12191220
// TODO: Remove this once we emit parallel regions through the
@@ -2355,8 +2356,11 @@ void CGOpenMPRuntime::emitBarrierCall(CodeGenFunction &CGF, SourceLocation Loc,
23552356
auto *OMPRegionInfo =
23562357
dyn_cast_or_null<CGOpenMPRegionInfo>(CGF.CapturedStmtInfo);
23572358
if (CGF.CGM.getLangOpts().OpenMPIRBuilder) {
2358-
CGF.Builder.restoreIP(OMPBuilder.createBarrier(
2359-
CGF.Builder, Kind, ForceSimpleCall, EmitChecks));
2359+
llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
2360+
OMPBuilder.createBarrier(CGF.Builder, Kind, ForceSimpleCall,
2361+
EmitChecks);
2362+
assert(AfterIP && "unexpected error creating barrier");
2363+
CGF.Builder.restoreIP(*AfterIP);
23602364
return;
23612365
}
23622366

@@ -5977,8 +5981,10 @@ void CGOpenMPRuntime::emitTargetOutlinedFunctionHelper(
59775981
/*CanHaveMultiDeviceArgs*/ true, /*IsTopKernel*/ true);
59785982
};
59795983

5980-
OMPBuilder.emitTargetRegionFunction(EntryInfo, GenerateOutlinedFunction,
5981-
IsOffloadEntry, OutlinedFn, OutlinedFnID);
5984+
llvm::Error Err = OMPBuilder.emitTargetRegionFunction(
5985+
EntryInfo, GenerateOutlinedFunction, IsOffloadEntry, OutlinedFn,
5986+
OutlinedFnID);
5987+
assert(!Err && "unexpected error creating target region");
59825988

59835989
if (!OutlinedFn)
59845990
return;
@@ -9970,9 +9976,12 @@ static void emitTargetCallKernelLaunch(
99709976
NumTargetItems, RTArgs, NumIterations, NumTeams, NumThreads,
99719977
DynCGGroupMem, HasNoWait);
99729978

9973-
CGF.Builder.restoreIP(OMPRuntime->getOMPBuilder().emitKernelLaunch(
9974-
CGF.Builder, OutlinedFnID, EmitTargetCallFallbackCB, Args, DeviceID,
9975-
RTLoc, AllocaIP));
9979+
llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
9980+
OMPRuntime->getOMPBuilder().emitKernelLaunch(
9981+
CGF.Builder, OutlinedFnID, EmitTargetCallFallbackCB, Args, DeviceID,
9982+
RTLoc, AllocaIP);
9983+
assert(AfterIP && "unexpected error creating kernel launch");
9984+
CGF.Builder.restoreIP(*AfterIP);
99769985
};
99779986

99789987
if (RequiresOuterTask) {
@@ -10668,9 +10677,12 @@ void CGOpenMPRuntime::emitTargetDataCalls(
1066810677
InsertPointTy CodeGenIP(CGF.Builder.GetInsertBlock(),
1066910678
CGF.Builder.GetInsertPoint());
1067010679
llvm::OpenMPIRBuilder::LocationDescription OmpLoc(CodeGenIP);
10671-
CGF.Builder.restoreIP(OMPBuilder.createTargetData(
10672-
OmpLoc, AllocaIP, CodeGenIP, DeviceID, IfCondVal, Info, GenMapInfoCB,
10673-
/*MapperFunc=*/nullptr, BodyCB, DeviceAddrCB, CustomMapperCB, RTLoc));
10680+
llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
10681+
OMPBuilder.createTargetData(
10682+
OmpLoc, AllocaIP, CodeGenIP, DeviceID, IfCondVal, Info, GenMapInfoCB,
10683+
/*MapperFunc=*/nullptr, BodyCB, DeviceAddrCB, CustomMapperCB, RTLoc);
10684+
assert(AfterIP && "unexpected error creating target data");
10685+
CGF.Builder.restoreIP(*AfterIP);
1067410686
}
1067510687

1067610688
void CGOpenMPRuntime::emitTargetDataStandAloneCall(

clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,11 +1984,14 @@ void CGOpenMPRuntimeGPU::emitReduction(
19841984
Idx++;
19851985
}
19861986

1987-
CGF.Builder.restoreIP(OMPBuilder.createReductionsGPU(
1988-
OmpLoc, AllocaIP, CodeGenIP, ReductionInfos, false, TeamsReduction,
1989-
DistributeReduction, llvm::OpenMPIRBuilder::ReductionGenCBKind::Clang,
1990-
CGF.getTarget().getGridValue(), C.getLangOpts().OpenMPCUDAReductionBufNum,
1991-
RTLoc));
1987+
llvm::OpenMPIRBuilder::InsertPointOrErrorTy AfterIP =
1988+
OMPBuilder.createReductionsGPU(
1989+
OmpLoc, AllocaIP, CodeGenIP, ReductionInfos, false, TeamsReduction,
1990+
DistributeReduction, llvm::OpenMPIRBuilder::ReductionGenCBKind::Clang,
1991+
CGF.getTarget().getGridValue(),
1992+
C.getLangOpts().OpenMPCUDAReductionBufNum, RTLoc);
1993+
assert(AfterIP && "unexpected error creating GPU reductions");
1994+
CGF.Builder.restoreIP(*AfterIP);
19921995
return;
19931996
}
19941997

0 commit comments

Comments
 (0)