Skip to content

Commit 5adba57

Browse files
authored
Merge pull request llvm#140 from AMD-Lightning-Internal/amd/merge/upstream_merge_20250115214213
Amd/merge/upstream merge 20250115214213
2 parents 9c965bd + 3732edf commit 5adba57

File tree

97 files changed

+4779
-3000
lines changed

Some content is hidden

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

97 files changed

+4779
-3000
lines changed

clang/docs/InternalsManual.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,21 @@ Description:
276276
diagnostic instead of having to do things textually. The selected string
277277
does undergo formatting.
278278

279+
**"enum_select format**
280+
281+
Example:
282+
``unknown frobbling of a %enum_select<FrobbleKind>{%VarDecl{variable declaration}|%FuncDecl{function declaration}}0 when blarging``
283+
Class:
284+
Integers
285+
Description:
286+
This format specifier is used exactly like a ``select`` specifier, except it
287+
additionally generates a namespace, enumeration, and enumerator list based on
288+
the format string given. In the above case, a namespace is generated named
289+
``FrobbleKind`` that has an unscoped enumeration with the enumerators
290+
``VarDecl`` and ``FuncDecl`` which correspond to the values 0 and 1. This
291+
permits a clearer use of the ``Diag`` in source code, as the above could be
292+
called as: ``Diag(Loc, diag::frobble) << diag::FrobbleKind::VarDecl``.
293+
279294
**"plural" format**
280295

281296
Example:

clang/include/clang/Basic/Builtins.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4855,6 +4855,12 @@ def HLSLFirstBitHigh : LangBuiltin<"HLSL_LANG"> {
48554855
let Prototype = "void(...)";
48564856
}
48574857

4858+
def HLSLFirstBitLow : LangBuiltin<"HLSL_LANG"> {
4859+
let Spellings = ["__builtin_hlsl_elementwise_firstbitlow"];
4860+
let Attributes = [NoThrow, Const];
4861+
let Prototype = "void(...)";
4862+
}
4863+
48584864
def HLSLFrac : LangBuiltin<"HLSL_LANG"> {
48594865
let Spellings = ["__builtin_hlsl_elementwise_frac"];
48604866
let Attributes = [NoThrow, Const];

clang/include/clang/Basic/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ macro(clang_diag_gen component)
33
-gen-clang-diags-defs -clang-component=${component}
44
SOURCE Diagnostic.td
55
TARGET ClangDiagnostic${component})
6+
7+
clang_tablegen(Diagnostic${component}Enums.inc
8+
-gen-clang-diags-enums -clang-component=${component}
9+
SOURCE Diagnostic.td
10+
TARGET ClangDiagnostic${component}Enums)
611
endmacro(clang_diag_gen)
712

813
clang_diag_gen(Analysis)

clang/include/clang/Basic/DiagnosticAST.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ enum {
2222
#undef DIAG
2323
NUM_BUILTIN_AST_DIAGNOSTICS
2424
};
25+
26+
#define DIAG_ENUM(ENUM_NAME) \
27+
namespace ENUM_NAME { \
28+
enum {
29+
#define DIAG_ENUM_ITEM(IDX, NAME) NAME = IDX,
30+
#define DIAG_ENUM_END() \
31+
} \
32+
; \
33+
}
34+
#include "clang/Basic/DiagnosticASTEnums.inc"
35+
#undef DIAG_ENUM_END
36+
#undef DIAG_ENUM_ITEM
37+
#undef DIAG_ENUM
2538
} // end namespace diag
2639
} // end namespace clang
2740

clang/include/clang/Basic/DiagnosticAnalysis.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ enum {
2222
#undef DIAG
2323
NUM_BUILTIN_ANALYSIS_DIAGNOSTICS
2424
};
25+
#define DIAG_ENUM(ENUM_NAME) \
26+
namespace ENUM_NAME { \
27+
enum {
28+
#define DIAG_ENUM_ITEM(IDX, NAME) NAME = IDX,
29+
#define DIAG_ENUM_END() \
30+
} \
31+
; \
32+
}
33+
#include "clang/Basic/DiagnosticAnalysisEnums.inc"
34+
#undef DIAG_ENUM_END
35+
#undef DIAG_ENUM_ITEM
36+
#undef DIAG_ENUM
2537
} // end namespace diag
2638
} // end namespace clang
2739

clang/include/clang/Basic/DiagnosticComment.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ enum {
2222
#undef DIAG
2323
NUM_BUILTIN_COMMENT_DIAGNOSTICS
2424
};
25+
26+
#define DIAG_ENUM(ENUM_NAME) \
27+
namespace ENUM_NAME { \
28+
enum {
29+
#define DIAG_ENUM_ITEM(IDX, NAME) NAME = IDX,
30+
#define DIAG_ENUM_END() \
31+
} \
32+
; \
33+
}
34+
#include "clang/Basic/DiagnosticCommentEnums.inc"
35+
#undef DIAG_ENUM_END
36+
#undef DIAG_ENUM_ITEM
37+
#undef DIAG_ENUM
2538
} // end namespace diag
2639
} // end namespace clang
2740

clang/include/clang/Basic/DiagnosticCrossTU.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ enum {
2222
#undef DIAG
2323
NUM_BUILTIN_CROSSTU_DIAGNOSTICS
2424
};
25+
26+
#define DIAG_ENUM(ENUM_NAME) \
27+
namespace ENUM_NAME { \
28+
enum {
29+
#define DIAG_ENUM_ITEM(IDX, NAME) NAME = IDX,
30+
#define DIAG_ENUM_END() \
31+
} \
32+
; \
33+
}
34+
#include "clang/Basic/DiagnosticCrossTUEnums.inc"
35+
#undef DIAG_ENUM_END
36+
#undef DIAG_ENUM_ITEM
37+
#undef DIAG_ENUM
2538
} // end namespace diag
2639
} // end namespace clang
2740

clang/include/clang/Basic/DiagnosticDriver.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ enum {
2222
#undef DIAG
2323
NUM_BUILTIN_DRIVER_DIAGNOSTICS
2424
};
25+
26+
#define DIAG_ENUM(ENUM_NAME) \
27+
namespace ENUM_NAME { \
28+
enum {
29+
#define DIAG_ENUM_ITEM(IDX, NAME) NAME = IDX,
30+
#define DIAG_ENUM_END() \
31+
} \
32+
; \
33+
}
34+
#include "clang/Basic/DiagnosticDriverEnums.inc"
35+
#undef DIAG_ENUM_END
36+
#undef DIAG_ENUM_ITEM
37+
#undef DIAG_ENUM
2538
} // end namespace diag
2639
} // end namespace clang
2740

clang/include/clang/Basic/DiagnosticFrontend.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ enum {
2222
#undef DIAG
2323
NUM_BUILTIN_FRONTEND_DIAGNOSTICS
2424
};
25+
26+
#define DIAG_ENUM(ENUM_NAME) \
27+
namespace ENUM_NAME { \
28+
enum {
29+
#define DIAG_ENUM_ITEM(IDX, NAME) NAME = IDX,
30+
#define DIAG_ENUM_END() \
31+
} \
32+
; \
33+
}
34+
#include "clang/Basic/DiagnosticFrontendEnums.inc"
35+
#undef DIAG_ENUM_END
36+
#undef DIAG_ENUM_ITEM
37+
#undef DIAG_ENUM
2538
} // end namespace diag
2639
} // end namespace clang
2740

clang/include/clang/Basic/DiagnosticInstallAPI.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ enum {
2121
#undef DIAG
2222
NUM_BUILTIN_INSTALLAPI_DIAGNOSTICS
2323
};
24+
25+
#define DIAG_ENUM(ENUM_NAME) \
26+
namespace ENUM_NAME { \
27+
enum {
28+
#define DIAG_ENUM_ITEM(IDX, NAME) NAME = IDX,
29+
#define DIAG_ENUM_END() \
30+
} \
31+
; \
32+
}
33+
#include "clang/Basic/DiagnosticInstallAPIEnums.inc"
34+
#undef DIAG_ENUM_END
35+
#undef DIAG_ENUM_ITEM
36+
#undef DIAG_ENUM
2437
} // namespace diag
2538
} // namespace clang
2639
#endif // LLVM_CLANG_BASIC_DIAGNOSTICINSTALLAPI_H

clang/include/clang/Basic/DiagnosticLex.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ enum {
2222
#undef DIAG
2323
NUM_BUILTIN_LEX_DIAGNOSTICS
2424
};
25+
#define DIAG_ENUM(ENUM_NAME) \
26+
namespace ENUM_NAME { \
27+
enum {
28+
#define DIAG_ENUM_ITEM(IDX, NAME) NAME = IDX,
29+
#define DIAG_ENUM_END() \
30+
} \
31+
; \
32+
}
33+
#include "clang/Basic/DiagnosticLexEnums.inc"
34+
#undef DIAG_ENUM_END
35+
#undef DIAG_ENUM_ITEM
36+
#undef DIAG_ENUM
2537
} // end namespace diag
2638
} // end namespace clang
2739

clang/include/clang/Basic/DiagnosticParse.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ enum {
2222
#undef DIAG
2323
NUM_BUILTIN_PARSE_DIAGNOSTICS
2424
};
25+
26+
#define DIAG_ENUM(ENUM_NAME) \
27+
namespace ENUM_NAME { \
28+
enum {
29+
#define DIAG_ENUM_ITEM(IDX, NAME) NAME = IDX,
30+
#define DIAG_ENUM_END() \
31+
} \
32+
; \
33+
}
34+
#include "clang/Basic/DiagnosticParseEnums.inc"
35+
#undef DIAG_ENUM_END
36+
#undef DIAG_ENUM_ITEM
37+
#undef DIAG_ENUM
2538
} // end namespace diag
2639
} // end namespace clang
2740

clang/include/clang/Basic/DiagnosticRefactoring.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ enum {
2222
#undef DIAG
2323
NUM_BUILTIN_REFACTORING_DIAGNOSTICS
2424
};
25+
26+
#define DIAG_ENUM(ENUM_NAME) \
27+
namespace ENUM_NAME { \
28+
enum {
29+
#define DIAG_ENUM_ITEM(IDX, NAME) NAME = IDX,
30+
#define DIAG_ENUM_END() \
31+
} \
32+
; \
33+
}
34+
#include "clang/Basic/DiagnosticRefactoringEnums.inc"
35+
#undef DIAG_ENUM_END
36+
#undef DIAG_ENUM_ITEM
37+
#undef DIAG_ENUM
2538
} // end namespace diag
2639
} // end namespace clang
2740

clang/include/clang/Basic/DiagnosticSema.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ enum {
2222
#undef DIAG
2323
NUM_BUILTIN_SEMA_DIAGNOSTICS
2424
};
25+
26+
#define DIAG_ENUM(ENUM_NAME) \
27+
namespace ENUM_NAME { \
28+
enum {
29+
#define DIAG_ENUM_ITEM(IDX, NAME) NAME = IDX,
30+
#define DIAG_ENUM_END() \
31+
} \
32+
; \
33+
}
34+
#include "clang/Basic/DiagnosticSemaEnums.inc"
35+
#undef DIAG_ENUM_END
36+
#undef DIAG_ENUM_ITEM
37+
#undef DIAG_ENUM
2538
} // end namespace diag
2639
} // end namespace clang
2740

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,9 +617,11 @@ def err_ambiguous_inherited_constructor : Error<
617617
"constructor of %0 inherited from multiple base class subobjects">;
618618
def note_ambiguous_inherited_constructor_using : Note<
619619
"inherited from base class %0 here">;
620-
def note_using_decl_class_member_workaround : Note<
621-
"use %select{an alias declaration|a typedef declaration|a reference|"
622-
"a const variable|a constexpr variable}0 instead">;
620+
def note_using_decl_class_member_workaround
621+
: Note<"use %enum_select<MemClassWorkaround>{%AliasDecl{an alias "
622+
"declaration}|%TypedefDecl{a typedef declaration}|%ReferenceDecl{a "
623+
"reference}|%ConstVar{a const variable}|%ConstexprVar{a constexpr "
624+
"variable}}0 instead">;
623625
def err_using_decl_can_not_refer_to_namespace : Error<
624626
"using declaration cannot refer to a namespace">;
625627
def note_namespace_using_decl : Note<

clang/include/clang/Basic/DiagnosticSerialization.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ enum {
2222
#undef DIAG
2323
NUM_BUILTIN_SERIALIZATION_DIAGNOSTICS
2424
};
25+
26+
#define DIAG_ENUM(ENUM_NAME) \
27+
namespace ENUM_NAME { \
28+
enum {
29+
#define DIAG_ENUM_ITEM(IDX, NAME) NAME = IDX,
30+
#define DIAG_ENUM_END() \
31+
} \
32+
; \
33+
}
34+
#include "clang/Basic/DiagnosticSerializationEnums.inc"
35+
#undef DIAG_ENUM_END
36+
#undef DIAG_ENUM_ITEM
37+
#undef DIAG_ENUM
2538
} // end namespace diag
2639
} // end namespace clang
2740

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19313,14 +19313,21 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
1931319313
"hlsl.dot4add.u8packed");
1931419314
}
1931519315
case Builtin::BI__builtin_hlsl_elementwise_firstbithigh: {
19316-
1931719316
Value *X = EmitScalarExpr(E->getArg(0));
1931819317

1931919318
return Builder.CreateIntrinsic(
1932019319
/*ReturnType=*/ConvertType(E->getType()),
1932119320
getFirstBitHighIntrinsic(CGM.getHLSLRuntime(), E->getArg(0)->getType()),
1932219321
ArrayRef<Value *>{X}, nullptr, "hlsl.firstbithigh");
1932319322
}
19323+
case Builtin::BI__builtin_hlsl_elementwise_firstbitlow: {
19324+
Value *X = EmitScalarExpr(E->getArg(0));
19325+
19326+
return Builder.CreateIntrinsic(
19327+
/*ReturnType=*/ConvertType(E->getType()),
19328+
CGM.getHLSLRuntime().getFirstBitLowIntrinsic(), ArrayRef<Value *>{X},
19329+
nullptr, "hlsl.firstbitlow");
19330+
}
1932419331
case Builtin::BI__builtin_hlsl_lerp: {
1932519332
Value *X = EmitScalarExpr(E->getArg(0));
1932619333
Value *Y = EmitScalarExpr(E->getArg(1));

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,8 +1958,8 @@ void CGDebugInfo::CollectRecordNestedType(
19581958
if (isa<InjectedClassNameType>(Ty))
19591959
return;
19601960
SourceLocation Loc = TD->getLocation();
1961-
llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateFile(Loc));
1962-
elements.push_back(nestedType);
1961+
if (llvm::DIType *nestedType = getOrCreateType(Ty, getOrCreateFile(Loc)))
1962+
elements.push_back(nestedType);
19631963
}
19641964

19651965
void CGDebugInfo::CollectRecordFields(

clang/lib/CodeGen/CGHLSLRuntime.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class CGHLSLRuntime {
9999
GENERATE_HLSL_INTRINSIC_FUNCTION(WaveReadLaneAt, wave_readlane)
100100
GENERATE_HLSL_INTRINSIC_FUNCTION(FirstBitUHigh, firstbituhigh)
101101
GENERATE_HLSL_INTRINSIC_FUNCTION(FirstBitSHigh, firstbitshigh)
102+
GENERATE_HLSL_INTRINSIC_FUNCTION(FirstBitLow, firstbitlow)
102103
GENERATE_HLSL_INTRINSIC_FUNCTION(NClamp, nclamp)
103104
GENERATE_HLSL_INTRINSIC_FUNCTION(SClamp, sclamp)
104105
GENERATE_HLSL_INTRINSIC_FUNCTION(UClamp, uclamp)

clang/lib/Driver/ToolChains/Arch/ARM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ llvm::ARM::FPUKind arm::getARMTargetFeatures(const Driver &D,
647647
(void)getARMFPUFeatures(D, WaFPU->first, Args, WaFPU->second, Features);
648648
} else if (FPUArg) {
649649
FPUKind = getARMFPUFeatures(D, FPUArg, Args, FPUArg->getValue(), Features);
650-
} else if (Triple.isAndroid() && getARMSubArchVersionNumber(Triple) >= 7) {
650+
} else if (Triple.isAndroid() && getARMSubArchVersionNumber(Triple) == 7) {
651651
const char *AndroidFPU = "neon";
652652
FPUKind = llvm::ARM::parseFPU(AndroidFPU);
653653
if (!llvm::ARM::getFPUFeatures(FPUKind, Features))

clang/lib/Driver/ToolChains/HIPAMD.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ void AMDGCN::Linker::constructLinkAndEmitSpirvCommand(
185185
llvm::opt::ArgStringList TrArgs{
186186
"--spirv-max-version=1.6",
187187
"--spirv-ext=+all",
188-
"--spirv-allow-extra-diexpressions",
189188
"--spirv-allow-unknown-intrinsics",
190189
"--spirv-lower-const-expr",
191190
"--spirv-preserve-auxdata",

0 commit comments

Comments
 (0)