Skip to content

Commit cbf17e7

Browse files
committed
merge main into amd-staging
2 parents 039d374 + b6df17f commit cbf17e7

File tree

281 files changed

+11813
-7980
lines changed

Some content is hidden

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

281 files changed

+11813
-7980
lines changed

clang/docs/OpenMPSupport.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ implementation.
191191
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
192192
| device | teams construct on the host device | :good:`done` | r371553 |
193193
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
194-
| device | support non-contiguous array sections for target update | :good:`done` | https://github.com/llvm/llvm-project/pull/144635 |
194+
| device | support non-contiguous array sections for target update | :good:`done` | https://github.com/llvm/llvm-project/pull/144635 |
195195
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
196196
| device | pointer attachment | :good:`done` | |
197197
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
@@ -338,7 +338,7 @@ implementation.
338338
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
339339
| OMPT | new 'emi' callbacks for external monitoring interfaces | :good:`done` | |
340340
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
341-
| OMPT | device tracing interface | :none:`unclaimed` | |
341+
| OMPT | device tracing interface | :none:`in progress` | jplehr |
342342
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
343343
| task | 'strict' modifier for taskloop construct | :none:`unclaimed` | |
344344
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
@@ -470,9 +470,9 @@ implementation.
470470
| need_device_addr modifier for adjust_args clause | :part:`partial` | :none:`unclaimed` | Parsing/Sema: https://github.com/llvm/llvm-project/pull/143442 |
471471
| | | | https://github.com/llvm/llvm-project/pull/149586 |
472472
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
473-
| Prescriptive num_threads | :part:`In Progress` | :none:`unclaimed` | |
473+
| Prescriptive num_threads | :part:`In Progress` | :none:`unclaimed` | ro-i |
474474
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
475-
| Message and severity clauses | :part:`In Progress` | :none:`unclaimed` | |
475+
| Message and severity clauses | :part:`In Progress` | :none:`unclaimed` | ro-i |
476476
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+
477477
| Local clause on declare target | :part:`In Progress` | :none:`unclaimed` | |
478478
+-------------------------------------------------------------+---------------------------+---------------------------+--------------------------------------------------------------------------+

clang/docs/ReleaseNotes.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,17 @@ Improvements to Clang's diagnostics
397397
- Fixed fix-it hint for fold expressions. Clang now correctly places the suggested right
398398
parenthesis when diagnosing malformed fold expressions. (#GH151787)
399399

400+
- Fixed an issue where emitted format-signedness diagnostics were not associated with an appropriate
401+
diagnostic id. Besides being incorrect from an API standpoint, this was user visible, e.g.:
402+
"format specifies type 'unsigned int' but the argument has type 'int' [-Wformat]"
403+
"signedness of format specifier 'u' is incompatible with 'c' [-Wformat]"
404+
This was misleading, because even though -Wformat is required in order to emit the diagnostics,
405+
the warning flag the user needs to concerned with here is -Wformat-signedness, which is also
406+
required and is not enabled by default. With the change you'll now see:
407+
"format specifies type 'unsigned int' but the argument has type 'int', which differs in signedness [-Wformat-signedness]"
408+
"signedness of format specifier 'u' is incompatible with 'c' [-Wformat-signedness]"
409+
and the API-visible diagnostic id will be appropriate.
410+
400411
Improvements to Clang's time-trace
401412
----------------------------------
402413

@@ -436,6 +447,7 @@ Bug Fixes to C++ Support
436447
- Fix the dynamic_cast to final class optimization to correctly handle
437448
casts that are guaranteed to fail (#GH137518).
438449
- Fix bug rejecting partial specialization of variable templates with auto NTTPs (#GH118190).
450+
- Fix a crash when using ``explicit(bool)`` in pre-C++11 language modes. (#GH152729)
439451

440452
Bug Fixes to AST Handling
441453
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/include/clang/AST/APValue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class APValue {
143143
AddrLabelDiff
144144
};
145145

146-
class LValueBase {
146+
class alignas(uint64_t) LValueBase {
147147
typedef llvm::PointerUnion<const ValueDecl *, const Expr *, TypeInfoLValue,
148148
DynamicAllocLValue>
149149
PtrTy;

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10419,9 +10419,10 @@ def warn_format_conversion_argument_type_mismatch : Warning<
1041910419
def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
1042010420
warn_format_conversion_argument_type_mismatch.Summary>,
1042110421
InGroup<FormatPedantic>;
10422-
def warn_format_conversion_argument_type_mismatch_signedness : Warning<
10423-
warn_format_conversion_argument_type_mismatch.Summary>,
10424-
InGroup<FormatSignedness>, DefaultIgnore;
10422+
def warn_format_conversion_argument_type_mismatch_signedness: Warning<
10423+
"format specifies type %0 but the argument has %select{type|underlying "
10424+
"type}2 %1, which differs in signedness" >
10425+
, InGroup<FormatSignedness>, DefaultIgnore;
1042510426
def warn_format_conversion_argument_type_mismatch_confusion : Warning<
1042610427
warn_format_conversion_argument_type_mismatch.Summary>,
1042710428
InGroup<FormatTypeConfusion>, DefaultIgnore;
@@ -10533,8 +10534,10 @@ def warn_format_cmp_sensitivity_mismatch : Warning<
1053310534
"it should be %select{unspecified|private|public|sensitive}1">, InGroup<Format>;
1053410535
def warn_format_cmp_specifier_mismatch : Warning<
1053510536
"format specifier '%0' is incompatible with '%1'">, InGroup<Format>;
10536-
def warn_format_cmp_specifier_sign_mismatch : Warning<
10537-
"signedness of format specifier '%0' is incompatible with '%1'">, InGroup<Format>;
10537+
def warn_format_cmp_specifier_sign_mismatch
10538+
: Warning<"signedness of format specifier '%0' is incompatible with '%1'">,
10539+
InGroup<FormatSignedness>,
10540+
DefaultIgnore;
1053810541
def warn_format_cmp_specifier_mismatch_pedantic : Extension<
1053910542
warn_format_cmp_specifier_sign_mismatch.Summary>, InGroup<FormatPedantic>;
1054010543
def note_format_cmp_with : Note<
@@ -13529,7 +13532,7 @@ def err_acc_invalid_modifier
1352913532
def err_acc_invalid_default_type
1353013533
: Error<"invalid value %0 in '%1' clause; valid values are %2">;
1353113534
def err_acc_device_type_multiple_archs
13532-
: Error<"OpenACC 'device_type' clause on a 'set' construct only permits "
13535+
: Error<"OpenACC 'device_type' clause on a '%0' construct only permits "
1353313536
"one architecture">;
1353413537
def warn_acc_var_referenced_non_const_array
1353513538
: Warning<"variable of array type %0 referenced in OpenACC '%1' clause "

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,21 @@ def CIR_BrOp : CIR_Op<"br",[
10601060
}];
10611061
}
10621062

1063+
//===----------------------------------------------------------------------===//
1064+
// LabelOp
1065+
//===----------------------------------------------------------------------===//
1066+
1067+
// The LabelOp has AlwaysSpeculatable trait in order to not to be swept
1068+
// by canonicalizer
1069+
def CIR_LabelOp : CIR_Op<"label", [AlwaysSpeculatable]> {
1070+
let description = [{
1071+
An identifier which may be referred by cir.goto operation
1072+
}];
1073+
let arguments = (ins StrAttr:$label);
1074+
let assemblyFormat = [{ $label attr-dict }];
1075+
let hasVerifier = 1;
1076+
}
1077+
10631078
//===----------------------------------------------------------------------===//
10641079
// UnaryOp
10651080
//===----------------------------------------------------------------------===//
@@ -3295,4 +3310,28 @@ def CIR_ExpectOp : CIR_Op<"expect", [
32953310
}];
32963311
}
32973312

3313+
//===----------------------------------------------------------------------===//
3314+
// Floating Point Ops
3315+
//===----------------------------------------------------------------------===//
3316+
3317+
class CIR_UnaryFPToFPBuiltinOp<string mnemonic, string llvmOpName>
3318+
: CIR_Op<mnemonic, [Pure, SameOperandsAndResultType]>
3319+
{
3320+
let arguments = (ins CIR_AnyFloatOrVecOfFloatType:$src);
3321+
let results = (outs CIR_AnyFloatOrVecOfFloatType:$result);
3322+
3323+
let assemblyFormat = "$src `:` type($src) attr-dict";
3324+
3325+
let llvmOp = llvmOpName;
3326+
}
3327+
3328+
def CIR_FAbsOp : CIR_UnaryFPToFPBuiltinOp<"fabs", "FAbsOp"> {
3329+
let summary = "Computes the floating-point absolute value";
3330+
let description = [{
3331+
`cir.fabs` computes the absolute value of a floating-point operand
3332+
and returns a result of the same type, ignoring floating-point
3333+
exceptions. It does not set `errno`.
3334+
}];
3335+
}
3336+
32983337
#endif // CLANG_CIR_DIALECT_IR_CIROPS_TD

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5734,7 +5734,8 @@ def mno_outline_atomics : Flag<["-"], "mno-outline-atomics">, Group<f_clang_Grou
57345734
HelpText<"Don't generate local calls to out-of-line atomic operations">;
57355735
def mno_implicit_float : Flag<["-"], "mno-implicit-float">, Group<m_Group>,
57365736
HelpText<"Don't generate implicit floating point or vector instructions">;
5737-
def mimplicit_float : Flag<["-"], "mimplicit-float">, Group<m_Group>;
5737+
def mimplicit_float : Flag<["-"], "mimplicit-float">, Group<m_Group>,
5738+
HelpText<"Generate implicit floating point or vector instructions">;
57385739
def mrecip : Flag<["-"], "mrecip">, Group<m_Group>,
57395740
Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
57405741
HelpText<"Equivalent to '-mrecip=all'">;

clang/lib/AST/ByteCode/Descriptor.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,9 +471,7 @@ bool Descriptor::hasTrivialDtor() const {
471471
bool Descriptor::isUnion() const { return isRecord() && ElemRecord->isUnion(); }
472472

473473
InitMap::InitMap(unsigned N)
474-
: UninitFields(N), Data(std::make_unique<T[]>(numFields(N))) {
475-
std::fill_n(data(), numFields(N), 0);
476-
}
474+
: UninitFields(N), Data(std::make_unique<T[]>(numFields(N))) {}
477475

478476
bool InitMap::initializeElement(unsigned I) {
479477
unsigned Bucket = I / PER_FIELD;

clang/lib/CIR/CodeGen/CIRGenBuiltin.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,19 @@ RValue CIRGenFunction::emitRotate(const CallExpr *e, bool isRotateLeft) {
7272
return RValue::get(r);
7373
}
7474

75+
template <class Operation>
76+
static RValue emitUnaryMaybeConstrainedFPBuiltin(CIRGenFunction &cgf,
77+
const CallExpr &e) {
78+
mlir::Value arg = cgf.emitScalarExpr(e.getArg(0));
79+
80+
assert(!cir::MissingFeatures::cgFPOptionsRAII());
81+
assert(!cir::MissingFeatures::fpConstraints());
82+
83+
auto call =
84+
Operation::create(cgf.getBuilder(), arg.getLoc(), arg.getType(), arg);
85+
return RValue::get(call->getResult(0));
86+
}
87+
7588
RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
7689
const CallExpr *e,
7790
ReturnValueSlot returnValue) {
@@ -112,6 +125,16 @@ RValue CIRGenFunction::emitBuiltinExpr(const GlobalDecl &gd, unsigned builtinID,
112125
default:
113126
break;
114127

128+
case Builtin::BIfabs:
129+
case Builtin::BIfabsf:
130+
case Builtin::BIfabsl:
131+
case Builtin::BI__builtin_fabs:
132+
case Builtin::BI__builtin_fabsf:
133+
case Builtin::BI__builtin_fabsf16:
134+
case Builtin::BI__builtin_fabsl:
135+
case Builtin::BI__builtin_fabsf128:
136+
return emitUnaryMaybeConstrainedFPBuiltin<cir::FAbsOp>(*this, *e);
137+
115138
case Builtin::BI__assume:
116139
case Builtin::BI__builtin_assume: {
117140
if (e->getArg(0)->HasSideEffects(getContext()))

clang/lib/CIR/CodeGen/CIRGenFunction.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,9 @@ class CIRGenFunction : public CIRGenTypeCache {
11811181

11821182
mlir::Value emitOpOnBoolExpr(mlir::Location loc, const clang::Expr *cond);
11831183

1184+
mlir::LogicalResult emitLabel(const clang::LabelDecl &d);
1185+
mlir::LogicalResult emitLabelStmt(const clang::LabelStmt &s);
1186+
11841187
mlir::LogicalResult emitIfStmt(const clang::IfStmt &s);
11851188

11861189
/// Emit code to compute the specified expression,

clang/lib/CIR/CodeGen/CIRGenModule.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,20 @@ void CIRGenModule::emitGlobalFunctionDefinition(clang::GlobalDecl gd,
438438
errorNYI(funcDecl->getSourceRange(), "deferredAnnotations");
439439
}
440440

441+
void CIRGenModule::handleCXXStaticMemberVarInstantiation(VarDecl *vd) {
442+
VarDecl::DefinitionKind dk = vd->isThisDeclarationADefinition();
443+
if (dk == VarDecl::Definition && vd->hasAttr<DLLImportAttr>())
444+
return;
445+
446+
TemplateSpecializationKind tsk = vd->getTemplateSpecializationKind();
447+
// If we have a definition, this might be a deferred decl. If the
448+
// instantiation is explicit, make sure we emit it at the end.
449+
if (vd->getDefinition() && tsk == TSK_ExplicitInstantiationDefinition)
450+
getAddrOfGlobalVar(vd);
451+
452+
emitTopLevelDecl(vd);
453+
}
454+
441455
mlir::Operation *CIRGenModule::getGlobalValue(StringRef name) {
442456
return mlir::SymbolTable::lookupSymbolIn(theModule, name);
443457
}

0 commit comments

Comments
 (0)