Skip to content

Commit 6773883

Browse files
committed
merge main into amd-staging
2 parents 0df1749 + 9885aed commit 6773883

File tree

242 files changed

+8219
-1484
lines changed

Some content is hidden

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

242 files changed

+8219
-1484
lines changed

clang-tools-extra/clang-tidy/ExpandModularHeadersPPCallbacks.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class ExpandModularHeadersPPCallbacks : public PPCallbacks {
137137
std::unique_ptr<Preprocessor> PP;
138138
bool EnteredMainFile = false;
139139
bool StartedLexing = false;
140-
Token CurrentToken;
140+
Token CurrentToken = Token();
141141
};
142142

143143
} // namespace tooling

clang-tools-extra/clang-tidy/bugprone/FloatLoopCounterCheck.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ void FloatLoopCounterCheck::registerMatchers(MatchFinder *Finder) {
3131

3232
void FloatLoopCounterCheck::check(const MatchFinder::MatchResult &Result) {
3333
const auto *FS = Result.Nodes.getNodeAs<ForStmt>("for");
34+
assert(FS && "FS should not be null");
3435

3536
diag(FS->getInc()->getBeginLoc(), "loop induction expression should not have "
3637
"floating-point type")

clang-tools-extra/clang-tidy/cppcoreguidelines/ProBoundsAvoidUncheckedContainerAccessCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ void ProBoundsAvoidUncheckedContainerAccessCheck::check(
176176
}
177177
} else if (const auto *MCE = dyn_cast<CXXMemberCallExpr>(MatchedExpr)) {
178178
// Case: a.operator[](i) or a->operator[](i)
179-
const auto *Callee = dyn_cast<MemberExpr>(MCE->getCallee());
179+
const auto *Callee = cast<MemberExpr>(MCE->getCallee());
180180

181181
if (FixMode == At) {
182182
// Cases: a.operator[](i) => a.at(i) and a->operator[](i) => a->at(i)

clang/include/clang/AST/ASTConsumer.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace clang {
2727
class VarDecl;
2828
class FunctionDecl;
2929
class ImportDecl;
30+
class OpenACCRoutineDecl;
3031

3132
/// ASTConsumer - This is an abstract interface that should be implemented by
3233
/// clients that read ASTs. This abstraction layer allows the client to be
@@ -116,6 +117,11 @@ class ASTConsumer {
116117
// variable has been instantiated.
117118
virtual void HandleCXXStaticMemberVarInstantiation(VarDecl *D) {}
118119

120+
/// Callback to handle the end-of-translation unit attachment of OpenACC
121+
/// routine declaration information.
122+
virtual void HandleOpenACCRoutineReference(const FunctionDecl *FD,
123+
const OpenACCRoutineDecl *RD) {}
124+
119125
/// Callback involved at the end of a translation unit to
120126
/// notify the consumer that a vtable for the given C++ class is
121127
/// required.

clang/include/clang/Basic/arm_mve.td

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -783,15 +783,15 @@ let params = T.Unsigned in {
783783
}
784784
let params = T.Float in {
785785
def vminnmq: Intrinsic<Vector, (args Vector:$a, Vector:$b),
786-
(IRIntBase<"minnum", [Vector]> $a, $b)>;
786+
(fminnm $a, $b)>;
787787
def vmaxnmq: Intrinsic<Vector, (args Vector:$a, Vector:$b),
788-
(IRIntBase<"maxnum", [Vector]> $a, $b)>;
788+
(fmaxnm $a, $b)>;
789789
def vminnmaq: Intrinsic<Vector, (args Vector:$a, Vector:$b),
790-
(IRIntBase<"minnum", [Vector]>
790+
(fminnm
791791
(IRIntBase<"fabs", [Vector]> $a),
792792
(IRIntBase<"fabs", [Vector]> $b))>;
793793
def vmaxnmaq: Intrinsic<Vector, (args Vector:$a, Vector:$b),
794-
(IRIntBase<"maxnum", [Vector]>
794+
(fmaxnm
795795
(IRIntBase<"fabs", [Vector]> $a),
796796
(IRIntBase<"fabs", [Vector]> $b))>;
797797
}

clang/include/clang/Basic/arm_mve_defs.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,10 @@ def fsub: strictFPAlt<fsub_node,
589589
IRInt<"vsub", [Vector]>>;
590590
def fmul: strictFPAlt<fmul_node,
591591
IRInt<"vmul", [Vector]>>;
592+
def fminnm : strictFPAlt<IRIntBase<"minnum", [Vector]>,
593+
IRInt<"vminnm", [Vector]>>;
594+
def fmaxnm : strictFPAlt<IRIntBase<"maxnum", [Vector]>,
595+
IRInt<"vmaxnm", [Vector]>>;
592596

593597
// -----------------------------------------------------------------------------
594598
// Convenience lists of parameter types. 'T' is just a container record, so you

clang/include/clang/CIR/CIRGenerator.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ class CIRGenerator : public clang::ASTConsumer {
8181
void HandleTagDeclDefinition(clang::TagDecl *d) override;
8282
void HandleTagDeclRequiredDefinition(const clang::TagDecl *D) override;
8383
void HandleCXXStaticMemberVarInstantiation(clang::VarDecl *D) override;
84+
void
85+
HandleOpenACCRoutineReference(const clang::FunctionDecl *FD,
86+
const clang::OpenACCRoutineDecl *RD) override;
8487
void CompleteTentativeDefinition(clang::VarDecl *d) override;
8588
void HandleVTable(clang::CXXRecordDecl *rd) override;
8689

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,6 +1173,35 @@ def CIR_SwitchOp : CIR_Op<"switch", [
11731173
let hasLLVMLowering = false;
11741174
}
11751175

1176+
//===----------------------------------------------------------------------===//
1177+
// IsConstantOp
1178+
//===----------------------------------------------------------------------===//
1179+
1180+
def CIR_IsConstantOp : CIR_Op<"is_constant", [Pure]> {
1181+
let summary = "Test for manifest compile-time constant";
1182+
let description = [{
1183+
Returns `true` if the argument is known to be a manifest compile-time
1184+
constant otherwise returns `false`. If the argument is a constant expression
1185+
which refers to a global (the address of which _is_ a constant, but not
1186+
manifest during the compile), then the intrinsic evaluates to `false`.
1187+
1188+
This is used to represent `__builtin_constant_p` in cases where the argument
1189+
isn't known to be constant during initial translation of the source code but
1190+
might be proven to be constant after later optimizations.
1191+
1192+
Example:
1193+
```
1194+
%1 = cir.is_constant %2 : !s32i -> !cir.bool
1195+
```
1196+
}];
1197+
let arguments = (ins CIR_AnyType:$val);
1198+
let results = (outs CIR_BoolType:$result);
1199+
1200+
let assemblyFormat = [{
1201+
$val `:` qualified(type($val)) `->` qualified(type($result)) attr-dict
1202+
}];
1203+
}
1204+
11761205
//===----------------------------------------------------------------------===//
11771206
// SwitchFlatOp
11781207
//===----------------------------------------------------------------------===//

clang/include/clang/Options/Options.td

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4870,25 +4870,25 @@ def ggdb3 : Flag<["-"], "ggdb3">, Group<ggdbN_Group>;
48704870
def glldb : Flag<["-"], "glldb">, Group<gTune_Group>;
48714871
def gsce : Flag<["-"], "gsce">, Group<gTune_Group>;
48724872
def gdbx : Flag<["-"], "gdbx">, Group<gTune_Group>;
4873-
// Equivalent to our default dwarf version. Forces usual dwarf emission when
4873+
// Equivalent to our default DWARF version. Forces usual DWARF emission when
48744874
// CodeView is enabled.
48754875
def gdwarf : Flag<["-"], "gdwarf">, Group<g_Group>,
48764876
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
4877-
HelpText<"Generate source-level debug information with the default dwarf version">;
4877+
HelpText<"Generate source-level debug information with the default DWARF version">;
48784878

48794879
let Visibility = [ClangOption, FlangOption] in {
48804880
def gdwarf_2 : Flag<["-"], "gdwarf-2">, Group<g_Group>,
4881-
HelpText<"Generate source-level debug information with dwarf version 2">;
4881+
HelpText<"Generate source-level debug information with DWARF version 2">;
48824882
def gdwarf_3 : Flag<["-"], "gdwarf-3">, Group<g_Group>,
4883-
HelpText<"Generate source-level debug information with dwarf version 3">;
4883+
HelpText<"Generate source-level debug information with DWARF version 3">;
48844884
def gdwarf_4 : Flag<["-"], "gdwarf-4">, Group<g_Group>,
4885-
HelpText<"Generate source-level debug information with dwarf version 4">;
4885+
HelpText<"Generate source-level debug information with DWARF version 4">;
48864886
def gdwarf_5 : Flag<["-"], "gdwarf-5">, Group<g_Group>,
4887-
HelpText<"Generate source-level debug information with dwarf version 5">;
4887+
HelpText<"Generate source-level debug information with DWARF version 5">;
48884888
def gdwarf_6
48894889
: Flag<["-"], "gdwarf-6">,
48904890
Group<g_Group>,
4891-
HelpText<"Generate source-level debug information with dwarf version 6">;
4891+
HelpText<"Generate source-level debug information with DWARF version 6">;
48924892
}
48934893
def gdwarf64 : Flag<["-"], "gdwarf64">, Group<g_Group>,
48944894
Visibility<[ClangOption, CC1Option, CC1AsOption]>,
@@ -4915,25 +4915,28 @@ def gno_heterogeneous_dwarf : Flag<["-"], "gno-heterogeneous-dwarf">,
49154915
HelpText<"Disable DWARF extensions for heterogeneous debugging">,
49164916
Alias<gheterogeneous_dwarf_EQ>, AliasArgs<["disabled"]>;
49174917

4918-
def gcodeview : Flag<["-"], "gcodeview">,
4918+
def gcodeview : Flag<["-"], "gcodeview">, Group<g_Group>,
49194919
HelpText<"Generate CodeView debug information">,
49204920
Visibility<[ClangOption, CC1Option, CC1AsOption, CLOption, DXCOption]>,
49214921
MarshallingInfoFlag<CodeGenOpts<"EmitCodeView">>;
49224922
defm codeview_ghash : BoolOption<"g", "codeview-ghash",
49234923
CodeGenOpts<"CodeViewGHash">, DefaultFalse,
49244924
PosFlag<SetTrue, [], [ClangOption, CC1Option],
49254925
"Emit type record hashes in a .debug$H section">,
4926-
NegFlag<SetFalse>, BothFlags<[], [ClangOption, CLOption, DXCOption]>>;
4926+
NegFlag<SetFalse>, BothFlags<[], [ClangOption, CLOption, DXCOption]>>,
4927+
Group<g_flags_Group>;
49274928
defm codeview_command_line : BoolOption<"g", "codeview-command-line",
49284929
CodeGenOpts<"CodeViewCommandLine">, DefaultTrue,
49294930
PosFlag<SetTrue, [], [ClangOption], "Emit compiler path and command line into CodeView debug information">,
49304931
NegFlag<SetFalse, [], [ClangOption], "Don't emit compiler path and command line into CodeView debug information">,
4931-
BothFlags<[], [ClangOption, CLOption, DXCOption, CC1Option]>>;
4932+
BothFlags<[], [ClangOption, CLOption, DXCOption, CC1Option]>>,
4933+
Group<g_flags_Group>;
49324934
defm inline_line_tables : BoolGOption<"inline-line-tables",
49334935
CodeGenOpts<"NoInlineLineTables">, DefaultFalse,
49344936
NegFlag<SetTrue, [], [ClangOption, CC1Option],
49354937
"Don't emit inline line tables.">,
4936-
PosFlag<SetFalse>, BothFlags<[], [ClangOption, CLOption, DXCOption]>>;
4938+
PosFlag<SetFalse>, BothFlags<[], [ClangOption, CLOption, DXCOption]>>,
4939+
Group<g_flags_Group>;
49374940

49384941
def gfull : Flag<["-"], "gfull">, Group<g_Group>;
49394942
def gused : Flag<["-"], "gused">, Group<g_Group>;
@@ -4958,7 +4961,8 @@ defm strict_dwarf : BoolOption<"g", "strict-dwarf",
49584961
defm omit_unreferenced_methods : BoolGOption<"omit-unreferenced-methods",
49594962
CodeGenOpts<"DebugOmitUnreferencedMethods">, DefaultFalse,
49604963
NegFlag<SetFalse>,
4961-
PosFlag<SetTrue, [], [CC1Option]>, BothFlags<[], [ClangOption, CLOption, DXCOption]>>;
4964+
PosFlag<SetTrue, [], [CC1Option]>, BothFlags<[], [ClangOption, CLOption, DXCOption]>>,
4965+
Group<g_flags_Group>;
49624966
defm column_info : BoolOption<"g", "column-info",
49634967
CodeGenOpts<"DebugColumnInfo">, DefaultTrue,
49644968
NegFlag<SetFalse, [], [ClangOption, CC1Option]>,
@@ -5027,6 +5031,7 @@ defm structor_decl_linkage_names
50275031
"Attach linkage names to C++ constructor/destructor "
50285032
"declarations in DWARF.">,
50295033
BothFlags<[], [ClangOption, CLOption, CC1Option]>>,
5034+
Group<g_flags_Group>,
50305035
DocBrief<[{On some ABIs (e.g., Itanium), constructors and destructors may have multiple variants. Historically, when generating DWARF, Clang did not attach ``DW_AT_linkage_name`` to structor DIEs because there were multiple possible manglings (depending on the structor variant) that could be used. With ``-gstructor-decl-linkage-names``, for ABIs with structor variants, we attach a "unified" mangled name to structor declarations DIEs which debuggers can use to look up all the definitions for a structor declaration. E.g., a "unified" mangled name ``_ZN3FooC4Ev`` may have multiple definitions associated with it such as ``_ZN3FooC1Ev`` and ``_ZN3FooC2Ev``.
50315036

50325037
Enabling this flag results in a better interactive debugging experience (both GDB and LLDB have support for understanding these "unified" linkage names). However, it comes with a significant increase in debug-info size (particularly the `.debug_str` section). As an escape hatch, users can disable this feature using ``-gno-structor-decl-linkage-names``.}]>;
@@ -5035,7 +5040,8 @@ defm key_instructions : BoolGOption<"key-instructions",
50355040
NegFlag<SetFalse>, PosFlag<SetTrue, [], [],
50365041
"Enable Key Instructions, which reduces the jumpiness of debug stepping in optimized C/C++ code"
50375042
" in some debuggers. DWARF only.">,
5038-
BothFlags<[], [ClangOption, CLOption, CC1Option]>>;
5043+
BothFlags<[], [ClangOption, CLOption, CC1Option]>>,
5044+
Group<g_flags_Group>;
50395045
def headerpad__max__install__names : Joined<["-"], "headerpad_max_install_names">;
50405046
def help : Flag<["-", "--"], "help">,
50415047
Visibility<[ClangOption, CC1Option, CC1AsOption,
@@ -8690,7 +8696,7 @@ def main_file_name : Separate<["-"], "main-file-name">,
86908696
Visibility<[CC1Option, CC1AsOption]>,
86918697
MarshallingInfoString<CodeGenOpts<"MainFileName">>;
86928698
def split_dwarf_output : Separate<["-"], "split-dwarf-output">,
8693-
HelpText<"File name to use for split dwarf debug info output">,
8699+
HelpText<"File name to use for split DWARF debug info output">,
86948700
Visibility<[CC1Option, CC1AsOption, FC1Option]>,
86958701
MarshallingInfoString<CodeGenOpts<"SplitDwarfOutput">>;
86968702

@@ -8724,7 +8730,7 @@ def dependent_lib : Joined<["--"], "dependent-lib=">,
87248730
MarshallingInfoStringVector<CodeGenOpts<"DependentLibraries">>;
87258731

87268732
def split_dwarf_file : Separate<["-"], "split-dwarf-file">,
8727-
HelpText<"Name of the split dwarf debug info file to encode in the object file">,
8733+
HelpText<"Name of the split DWARF debug info file to encode in the object file">,
87288734
MarshallingInfoString<CodeGenOpts<"SplitDwarfFile">>;
87298735

87308736
} // let Visibility = [CC1Option, FC1Option]

clang/include/clang/Sema/SemaOpenACC.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,16 @@ class Scope;
3737
class SemaOpenACC : public SemaBase {
3838
public:
3939
using DeclGroupPtrTy = OpaquePtr<DeclGroupRef>;
40+
using RoutineRefListTy = std::pair<FunctionDecl *, OpenACCRoutineDecl *>;
4041

4142
private:
43+
// We save a list of routine clauses that refer to a different function(that
44+
// is, routine-with-a-name) so that we can do the emission at the 'end'. We
45+
// have to do this, since functions can be emitted before they are referenced,
46+
// and the OpenACCRoutineDecl isn't necessarily emitted, as it might be in a
47+
// function/etc. So we do these emits at the end of the TU.
48+
llvm::SmallVector<RoutineRefListTy> RoutineRefList;
49+
4250
struct ComputeConstructInfo {
4351
/// Which type of compute construct we are inside of, which we can use to
4452
/// determine whether we should add loops to the above collection. We can
@@ -752,6 +760,7 @@ class SemaOpenACC : public SemaBase {
752760
};
753761

754762
SemaOpenACC(Sema &S);
763+
void ActOnEndOfTranslationUnit(TranslationUnitDecl *TU);
755764

756765
// Called when we encounter a 'while' statement, before looking at its 'body'.
757766
void ActOnWhileStmt(SourceLocation WhileLoc);

0 commit comments

Comments
 (0)