Skip to content

Commit 89b53e6

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:3ff67d8c8069b9f42efcbe90ad7edeb6d8117a31 into amd-gfx:fb6383d383cb
Local branch amd-gfx fb6383d Merged main:d9c31ee9568277e4303715736b40925e41503596 into amd-gfx:a79be10fda42 Remote branch main 3ff67d8 [HLSL] Fix for build break introduced by llvm#85662 (llvm#85839)
2 parents fb6383d + 3ff67d8 commit 89b53e6

File tree

302 files changed

+18836
-3381
lines changed

Some content is hidden

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

302 files changed

+18836
-3381
lines changed

.github/workflows/llvm-tests.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
BASELINE_REF: ${{ steps.vars.outputs.BASELINE_REF }}
4343
ABI_HEADERS: ${{ steps.vars.outputs.ABI_HEADERS }}
4444
BASELINE_VERSION_MAJOR: ${{ steps.vars.outputs.BASELINE_VERSION_MAJOR }}
45+
BASELINE_VERSION_MINOR: ${{ steps.vars.outputs.BASELINE_VERSION_MINOR }}
4546
LLVM_VERSION_MAJOR: ${{ steps.version.outputs.LLVM_VERSION_MAJOR }}
4647
LLVM_VERSION_MINOR: ${{ steps.version.outputs.LLVM_VERSION_MINOR }}
4748
LLVM_VERSION_PATCH: ${{ steps.version.outputs.LLVM_VERSION_PATCH }}
@@ -58,7 +59,14 @@ jobs:
5859
- name: Setup Variables
5960
id: vars
6061
run: |
61-
if [ ${{ steps.version.outputs.LLVM_VERSION_MINOR }} -ne 0 ] || [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
62+
# C++ ABI:
63+
# 18.1.0 we aren't doing ABI checks.
64+
# 18.1.1 We want to check 18.1.0.
65+
# C ABI:
66+
# 18.1.0 We want to check 17.0.x
67+
# 18.1.1 We want to check 18.1.0
68+
echo "BASELINE_VERSION_MINOR=1" >> "$GITHUB_OUTPUT"
69+
if [ ${{ steps.version.outputs.LLVM_VERSION_PATCH }} -eq 0 ]; then
6270
{
6371
echo "BASELINE_VERSION_MAJOR=$(( ${{ steps.version.outputs.LLVM_VERSION_MAJOR }} - 1))"
6472
echo "ABI_HEADERS=llvm-c"
@@ -82,7 +90,7 @@ jobs:
8290
include:
8391
- name: build-baseline
8492
llvm_version_major: ${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}
85-
ref: llvmorg-${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}.0.0
93+
ref: llvmorg-${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MAJOR }}.${{ needs.abi-dump-setup.outputs.BASELINE_VERSION_MINOR }}.0
8694
repo: llvm/llvm-project
8795
- name: build-latest
8896
llvm_version_major: ${{ needs.abi-dump-setup.outputs.LLVM_VERSION_MAJOR }}

clang/docs/ReleaseNotes.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,9 @@ Bug Fixes in This Version
284284
for variables created through copy initialization having side-effects in C++17 and later.
285285
Fixes (#GH64356) (#GH79518).
286286

287+
- Fix value of predefined macro ``__FUNCTION__`` in MSVC compatibility mode.
288+
Fixes (#GH66114).
289+
287290
- Clang now emits errors for explicit specializations/instatiations of lambda call
288291
operator.
289292
Fixes (#GH83267).
@@ -454,6 +457,26 @@ Android Support
454457
Windows Support
455458
^^^^^^^^^^^^^^^
456459

460+
- Clang-cl now supports function targets with intrinsic headers. This allows
461+
for runtime feature detection of intrinsics. Previously under clang-cl
462+
``immintrin.h`` and similar intrinsic headers would only include the intrinsics
463+
if building with that feature enabled at compile time, e.g. ``avxintrin.h``
464+
would only be included if AVX was enabled at compile time. This was done to work
465+
around include times from MSVC STL including ``intrin.h`` under clang-cl.
466+
Clang-cl now provides ``intrin0.h`` for MSVC STL and therefore all intrinsic
467+
features without requiring enablement at compile time.
468+
Fixes: (`#53520 <https://github.com/llvm/llvm-project/issues/53520>`_)
469+
470+
- Improved compile times with MSVC STL. MSVC provides ``intrin0.h`` which is a
471+
header that only includes intrinsics that are used by MSVC STL to avoid the
472+
use of ``intrin.h``. MSVC STL when compiled under clang uses ``intrin.h``
473+
instead. Clang-cl now provides ``intrin0.h`` for the same compiler throughput
474+
purposes as MSVC. Clang-cl also provides ``yvals_core.h`` to redefine
475+
``_STL_INTRIN_HEADER`` to expand to ``intrin0.h`` instead of ``intrin.h``.
476+
This also means that if all intrinsic features are enabled at compile time
477+
including STL headers will no longer slow down compile times since ``intrin.h``
478+
is not included from MSVC STL.
479+
457480
LoongArch Support
458481
^^^^^^^^^^^^^^^^^
459482

clang/include/clang/AST/Expr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2045,7 +2045,8 @@ class PredefinedExpr final
20452045
}
20462046

20472047
static std::string ComputeName(PredefinedIdentKind IK,
2048-
const Decl *CurrentDecl);
2048+
const Decl *CurrentDecl,
2049+
bool ForceElaboratedPrinting = false);
20492050

20502051
SourceLocation getBeginLoc() const { return getLocation(); }
20512052
SourceLocation getEndLoc() const { return getLocation(); }

clang/include/clang/AST/Type.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,6 +2245,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
22452245
bool isHalfType() const; // OpenCL 6.1.1.1, NEON (IEEE 754-2008 half)
22462246
bool isFloat16Type() const; // C11 extension ISO/IEC TS 18661
22472247
bool isFloat32Type() const;
2248+
bool isDoubleType() const;
22482249
bool isBFloat16Type() const;
22492250
bool isFloat128Type() const;
22502251
bool isIbm128Type() const;
@@ -7457,6 +7458,10 @@ inline bool Type::isFloat32Type() const {
74577458
return isSpecificBuiltinType(BuiltinType::Float);
74587459
}
74597460

7461+
inline bool Type::isDoubleType() const {
7462+
return isSpecificBuiltinType(BuiltinType::Double);
7463+
}
7464+
74607465
inline bool Type::isBFloat16Type() const {
74617466
return isSpecificBuiltinType(BuiltinType::BFloat16);
74627467
}

clang/include/clang/Basic/DiagnosticCommonKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ def warn_target_unrecognized_env : Warning<
356356
def warn_knl_knm_isa_support_removed : Warning<
357357
"KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.">,
358358
InGroup<DiagGroup<"knl-knm-isa-support-removed">>;
359+
def err_target_unsupported_abi_with_fpu : Error<
360+
"'%0' ABI is not supported with FPU">;
359361

360362
// Source manager
361363
def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal;

clang/include/clang/Basic/DiagnosticFrontendKinds.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ def err_builtin_needs_feature : Error<"%0 needs target feature %1">;
281281
def err_function_needs_feature : Error<
282282
"always_inline function %1 requires target feature '%2', but would "
283283
"be inlined into function %0 that is compiled without support for '%2'">;
284+
285+
let CategoryName = "Codegen ABI Check" in {
284286
def err_function_always_inline_attribute_mismatch : Error<
285287
"always_inline function %1 and its caller %0 have mismatching %2 attributes">;
286288
def err_function_always_inline_new_za : Error<
@@ -292,6 +294,10 @@ def warn_avx_calling_convention
292294
InGroup<DiagGroup<"psabi">>;
293295
def err_avx_calling_convention : Error<warn_avx_calling_convention.Summary>;
294296

297+
def err_target_unsupported_type_for_abi
298+
: Error<"%0 requires %1 type support, but ABI '%2' does not support it">;
299+
}
300+
295301
def err_alias_to_undefined : Error<
296302
"%select{alias|ifunc}0 must point to a defined "
297303
"%select{variable or |}1function">;

clang/include/clang/Basic/DiagnosticIDs.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ class DiagnosticIDs : public RefCountedBase<DiagnosticIDs> {
278278
/// category.
279279
static bool isARCDiagnostic(unsigned DiagID);
280280

281+
/// Return true if a given diagnostic is a codegen-time ABI check.
282+
static bool isCodegenABICheckDiagnostic(unsigned DiagID);
283+
281284
/// Enumeration describing how the emission of a diagnostic should
282285
/// be treated when it occurs during C++ template argument deduction.
283286
enum SFINAEResponse {

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6441,11 +6441,6 @@ def flang_deprecated_no_hlfir : Flag<["-"], "flang-deprecated-no-hlfir">,
64416441
Flags<[HelpHidden]>, Visibility<[FlangOption, FC1Option]>,
64426442
HelpText<"Do not use HLFIR lowering (deprecated)">;
64436443

6444-
def flang_experimental_polymorphism : Flag<["-"], "flang-experimental-polymorphism">,
6445-
Flags<[HelpHidden]>, Visibility<[FlangOption, FC1Option]>,
6446-
HelpText<"Enable Fortran 2003 polymorphism (experimental)">;
6447-
6448-
64496444
//===----------------------------------------------------------------------===//
64506445
// FLangOption + CoreOption + NoXarchOption
64516446
//===----------------------------------------------------------------------===//

clang/lib/AST/DeclPrinter.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,16 @@ static void printExplicitSpecifier(ExplicitSpecifier ES, llvm::raw_ostream &Out,
679679
Out << Proto;
680680
}
681681

682+
static void MaybePrintTagKeywordIfSupressingScopes(PrintingPolicy &Policy,
683+
QualType T,
684+
llvm::raw_ostream &Out) {
685+
StringRef prefix = T->isClassType() ? "class "
686+
: T->isStructureType() ? "struct "
687+
: T->isUnionType() ? "union "
688+
: "";
689+
Out << prefix;
690+
}
691+
682692
void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
683693
if (!D->getDescribedFunctionTemplate() &&
684694
!D->isFunctionTemplateSpecialization())
@@ -855,6 +865,10 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
855865
Out << Proto << " -> ";
856866
Proto.clear();
857867
}
868+
if (!Policy.SuppressTagKeyword && Policy.SuppressScope &&
869+
!Policy.SuppressUnwrittenScope)
870+
MaybePrintTagKeywordIfSupressingScopes(Policy, AFT->getReturnType(),
871+
Out);
858872
AFT->getReturnType().print(Out, Policy, Proto);
859873
Proto.clear();
860874
}
@@ -1022,6 +1036,9 @@ void DeclPrinter::VisitVarDecl(VarDecl *D) {
10221036
? D->getIdentifier()->deuglifiedName()
10231037
: D->getName();
10241038

1039+
if (!Policy.SuppressTagKeyword && Policy.SuppressScope &&
1040+
!Policy.SuppressUnwrittenScope)
1041+
MaybePrintTagKeywordIfSupressingScopes(Policy, T, Out);
10251042
printDeclType(T, Name);
10261043

10271044
// Print the attributes that should be placed right before the end of the

clang/lib/AST/Expr.cpp

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,8 @@ StringRef PredefinedExpr::getIdentKindName(PredefinedIdentKind IK) {
676676
// FIXME: Maybe this should use DeclPrinter with a special "print predefined
677677
// expr" policy instead.
678678
std::string PredefinedExpr::ComputeName(PredefinedIdentKind IK,
679-
const Decl *CurrentDecl) {
679+
const Decl *CurrentDecl,
680+
bool ForceElaboratedPrinting) {
680681
ASTContext &Context = CurrentDecl->getASTContext();
681682

682683
if (IK == PredefinedIdentKind::FuncDName) {
@@ -724,10 +725,21 @@ std::string PredefinedExpr::ComputeName(PredefinedIdentKind IK,
724725
return std::string(Out.str());
725726
}
726727
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(CurrentDecl)) {
727-
if (IK != PredefinedIdentKind::PrettyFunction &&
728+
const auto &LO = Context.getLangOpts();
729+
bool IsFuncOrFunctionInNonMSVCCompatEnv =
730+
((IK == PredefinedIdentKind::Func ||
731+
IK == PredefinedIdentKind ::Function) &&
732+
!LO.MSVCCompat);
733+
bool IsLFunctionInMSVCCommpatEnv =
734+
IK == PredefinedIdentKind::LFunction && LO.MSVCCompat;
735+
bool IsFuncOrFunctionOrLFunctionOrFuncDName =
736+
IK != PredefinedIdentKind::PrettyFunction &&
728737
IK != PredefinedIdentKind::PrettyFunctionNoVirtual &&
729738
IK != PredefinedIdentKind::FuncSig &&
730-
IK != PredefinedIdentKind::LFuncSig)
739+
IK != PredefinedIdentKind::LFuncSig;
740+
if ((ForceElaboratedPrinting &&
741+
(IsFuncOrFunctionInNonMSVCCompatEnv || IsLFunctionInMSVCCommpatEnv)) ||
742+
(!ForceElaboratedPrinting && IsFuncOrFunctionOrLFunctionOrFuncDName))
731743
return FD->getNameAsString();
732744

733745
SmallString<256> Name;
@@ -755,6 +767,8 @@ std::string PredefinedExpr::ComputeName(PredefinedIdentKind IK,
755767
PrintingPolicy Policy(Context.getLangOpts());
756768
PrettyCallbacks PrettyCB(Context.getLangOpts());
757769
Policy.Callbacks = &PrettyCB;
770+
if (IK == PredefinedIdentKind::Function && ForceElaboratedPrinting)
771+
Policy.SuppressTagKeyword = !LO.MSVCCompat;
758772
std::string Proto;
759773
llvm::raw_string_ostream POut(Proto);
760774

@@ -782,6 +796,12 @@ std::string PredefinedExpr::ComputeName(PredefinedIdentKind IK,
782796

783797
FD->printQualifiedName(POut, Policy);
784798

799+
if (IK == PredefinedIdentKind::Function) {
800+
POut.flush();
801+
Out << Proto;
802+
return std::string(Name);
803+
}
804+
785805
POut << "(";
786806
if (FT) {
787807
for (unsigned i = 0, e = Decl->getNumParams(); i != e; ++i) {

clang/lib/AST/TypePrinter.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,6 +1635,17 @@ void TypePrinter::printElaboratedBefore(const ElaboratedType *T,
16351635
if (T->getKeyword() != ElaboratedTypeKeyword::None)
16361636
OS << " ";
16371637
NestedNameSpecifier *Qualifier = T->getQualifier();
1638+
if (!Policy.SuppressTagKeyword && Policy.SuppressScope &&
1639+
!Policy.SuppressUnwrittenScope) {
1640+
bool OldTagKeyword = Policy.SuppressTagKeyword;
1641+
bool OldSupressScope = Policy.SuppressScope;
1642+
Policy.SuppressTagKeyword = true;
1643+
Policy.SuppressScope = false;
1644+
printBefore(T->getNamedType(), OS);
1645+
Policy.SuppressTagKeyword = OldTagKeyword;
1646+
Policy.SuppressScope = OldSupressScope;
1647+
return;
1648+
}
16381649
if (Qualifier)
16391650
Qualifier->print(OS, Policy);
16401651
}
@@ -2260,10 +2271,15 @@ printTo(raw_ostream &OS, ArrayRef<TA> Args, const PrintingPolicy &Policy,
22602271
} else {
22612272
if (!FirstArg)
22622273
OS << Comma;
2263-
// Tries to print the argument with location info if exists.
2264-
printArgument(Arg, Policy, ArgOS,
2265-
TemplateParameterList::shouldIncludeTypeForArgument(
2266-
Policy, TPL, ParmIndex));
2274+
if (!Policy.SuppressTagKeyword &&
2275+
Argument.getKind() == TemplateArgument::Type &&
2276+
isa<TagType>(Argument.getAsType()))
2277+
OS << Argument.getAsType().getAsString();
2278+
else
2279+
// Tries to print the argument with location info if exists.
2280+
printArgument(Arg, Policy, ArgOS,
2281+
TemplateParameterList::shouldIncludeTypeForArgument(
2282+
Policy, TPL, ParmIndex));
22672283
}
22682284
StringRef ArgString = ArgOS.str();
22692285

0 commit comments

Comments
 (0)