Skip to content

Commit 7c11d09

Browse files
SC llvm teamSC llvm team
SC llvm team
authored and
SC llvm team
committed
Merged main:0a369b06e34495966c6c9db427ea52f77a82a0bf into amd-gfx:24ba96a84828
Local branch amd-gfx 24ba96a Merged main:344228ebf45f9bd1f7626fdcd3c0fada0f0c8385 into amd-gfx:d6bc6d5dbcb2 Remote branch main 0a369b0 Reapply "[MachinePipeliner] Fix constraints arent considered in cert… (llvm#97259)
2 parents 24ba96a + 0a369b0 commit 7c11d09

File tree

164 files changed

+3738
-2012
lines changed

Some content is hidden

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

164 files changed

+3738
-2012
lines changed

bolt/lib/Core/BinaryContext.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
2121
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
2222
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
23-
#include "llvm/MC/MCAsmLayout.h"
2423
#include "llvm/MC/MCAssembler.h"
2524
#include "llvm/MC/MCContext.h"
2625
#include "llvm/MC/MCDisassembler/MCDisassembler.h"
@@ -2416,8 +2415,7 @@ BinaryContext::calculateEmittedSize(BinaryFunction &BF, bool FixBranches) {
24162415

24172416
MCAssembler &Assembler =
24182417
static_cast<MCObjectStreamer *>(Streamer.get())->getAssembler();
2419-
MCAsmLayout Layout(Assembler);
2420-
Assembler.layout(Layout);
2418+
Assembler.layout();
24212419

24222420
// Obtain fragment sizes.
24232421
std::vector<uint64_t> FragmentSizes;

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,6 @@ Clang Frontend Potentially Breaking Changes
147147
- The ``hasTypeLoc`` AST matcher will no longer match a ``classTemplateSpecializationDecl``;
148148
existing uses should switch to ``templateArgumentLoc`` or ``hasAnyTemplateArgumentLoc`` instead.
149149

150-
- The comment parser now matches comments to declarations even if there is a
151-
preprocessor macro in between the comment and declaration. This change is
152-
intended to improve Clang's support for parsing documentation comments and
153-
to better conform to Doxygen's behavior.
154-
155-
This has the potential to cause ``-Wdocumentation`` warnings, especially in
156-
cases where a function-like macro has a documentation comment and is followed
157-
immediately by a normal function. The function-like macro's documentation
158-
comments will be attributed to the subsequent function and may cause
159-
``-Wdocumentation`` warnings such as mismatched parameter names, or invalid
160-
return documentation comments.
161-
162-
In cases where the ``-Wdocumentation`` warnings are thrown, the suggested fix
163-
is to document the declaration following the macro so that the warnings are
164-
fixed.
165-
166150
Clang Python Bindings Potentially Breaking Changes
167151
--------------------------------------------------
168152
- Renamed ``CursorKind`` variant 272 from ``OMP_TEAMS_DISTRIBUTE_DIRECTIVE``

clang/docs/tools/clang-formatted-files.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5357,7 +5357,6 @@ llvm/include/llvm/MC/MCAsmInfoELF.h
53575357
llvm/include/llvm/MC/MCAsmInfoGOFF.h
53585358
llvm/include/llvm/MC/MCAsmInfoWasm.h
53595359
llvm/include/llvm/MC/MCAsmInfoXCOFF.h
5360-
llvm/include/llvm/MC/MCAsmLayout.h
53615360
llvm/include/llvm/MC/MCCodeView.h
53625361
llvm/include/llvm/MC/MCContext.h
53635362
llvm/include/llvm/MC/MCFixedLenDisassembler.h

clang/lib/AST/ASTContext.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,9 @@ RawComment *ASTContext::getRawCommentForDeclNoCacheImpl(
284284
StringRef Text(Buffer + CommentEndOffset,
285285
DeclLocDecomp.second - CommentEndOffset);
286286

287-
// There should be no other declarations between comment and declaration.
288-
// Preprocessor directives are implicitly allowed to be between a comment and
289-
// its associated decl.
290-
if (Text.find_last_of(";{}@") != StringRef::npos)
287+
// There should be no other declarations or preprocessor directives between
288+
// comment and declaration.
289+
if (Text.find_last_of(";{}#@") != StringRef::npos)
291290
return nullptr;
292291

293292
return CommentBeforeDecl;

clang/lib/CodeGen/BackendUtil.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
#include "llvm/Transforms/Instrumentation/LowerAllowCheckPass.h"
7777
#include "llvm/Transforms/Instrumentation/MemProfiler.h"
7878
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
79+
#include "llvm/Transforms/Instrumentation/NumericalStabilitySanitizer.h"
7980
#include "llvm/Transforms/Instrumentation/PGOInstrumentation.h"
8081
#include "llvm/Transforms/Instrumentation/SanitizerBinaryMetadata.h"
8182
#include "llvm/Transforms/Instrumentation/SanitizerCoverage.h"
@@ -707,6 +708,9 @@ static void addSanitizers(const Triple &TargetTriple,
707708
MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass()));
708709
}
709710

711+
if (LangOpts.Sanitize.has(SanitizerKind::NumericalStability))
712+
MPM.addPass(NumericalStabilitySanitizerPass());
713+
710714
auto ASanPass = [&](SanitizerMask Mask, bool CompileKernel) {
711715
if (LangOpts.Sanitize.has(Mask)) {
712716
bool UseGlobalGC = asanUseGlobalsGC(TargetTriple, CodeGenOpts);

clang/lib/Headers/amxcomplexintrin.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,24 +107,6 @@
107107
/// The 2nd source tile. Max size is 1024 Bytes.
108108
#define _tile_cmmrlfp16ps(dst, a, b) __builtin_ia32_tcmmrlfp16ps(dst, a, b)
109109

110-
/// Perform matrix multiplication of two tiles containing complex elements and
111-
/// accumulate the results into a packed single precision tile.
112-
///
113-
/// \param m
114-
/// The number of rows in the first tile and the number of rows in the result
115-
/// tile.
116-
/// \param n
117-
/// The number of columns in the second tile and the number of columns in the
118-
/// result tile.
119-
/// \param k
120-
/// The number of columns in the first tile and the number of rows in the
121-
/// second tile.
122-
/// \param dst
123-
/// Pointer to the destination tile where the result will be stored.
124-
/// \param src1
125-
/// Pointer to the first source tile.
126-
/// \param src2
127-
/// Pointer to the second source tile.
128110
static __inline__ _tile1024i __DEFAULT_FN_ATTRS_COMPLEX
129111
_tile_cmmimfp16ps_internal(unsigned short m, unsigned short n, unsigned short k,
130112
_tile1024i dst, _tile1024i src1, _tile1024i src2) {

clang/lib/Headers/ia32intrin.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -533,13 +533,6 @@ __rdtscp(unsigned int *__A) {
533533
/// \see __rdpmc
534534
#define _rdpmc(A) __rdpmc(A)
535535

536-
/// Invalidates the contents of the processor's internal caches.
537-
/// This function writes back and invalidates all modified cache lines in
538-
/// the processor.
539-
///
540-
/// \headerfile <x86intrin.h>
541-
///
542-
/// This intrinsic corresponds to the \c WBINVD instruction.
543536
static __inline__ void __DEFAULT_FN_ATTRS
544537
_wbinvd(void) {
545538
__builtin_ia32_wbinvd();

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -671,30 +671,58 @@ void DiagnoseHLSLAvailability::HandleFunctionOrMethodRef(FunctionDecl *FD,
671671

672672
void DiagnoseHLSLAvailability::RunOnTranslationUnit(
673673
const TranslationUnitDecl *TU) {
674+
674675
// Iterate over all shader entry functions and library exports, and for those
675676
// that have a body (definiton), run diag scan on each, setting appropriate
676677
// shader environment context based on whether it is a shader entry function
677-
// or an exported function.
678-
for (auto &D : TU->decls()) {
679-
const FunctionDecl *FD = llvm::dyn_cast<FunctionDecl>(D);
680-
if (!FD || !FD->isThisDeclarationADefinition())
681-
continue;
678+
// or an exported function. Exported functions can be in namespaces and in
679+
// export declarations so we need to scan those declaration contexts as well.
680+
llvm::SmallVector<const DeclContext *, 8> DeclContextsToScan;
681+
DeclContextsToScan.push_back(TU);
682+
683+
while (!DeclContextsToScan.empty()) {
684+
const DeclContext *DC = DeclContextsToScan.pop_back_val();
685+
for (auto &D : DC->decls()) {
686+
// do not scan implicit declaration generated by the implementation
687+
if (D->isImplicit())
688+
continue;
689+
690+
// for namespace or export declaration add the context to the list to be
691+
// scanned later
692+
if (llvm::dyn_cast<NamespaceDecl>(D) || llvm::dyn_cast<ExportDecl>(D)) {
693+
DeclContextsToScan.push_back(llvm::dyn_cast<DeclContext>(D));
694+
continue;
695+
}
682696

683-
// shader entry point
684-
auto ShaderAttr = FD->getAttr<HLSLShaderAttr>();
685-
if (ShaderAttr) {
686-
SetShaderStageContext(ShaderAttr->getType());
687-
RunOnFunction(FD);
688-
continue;
689-
}
690-
// exported library function with definition
691-
// FIXME: tracking issue #92073
692-
#if 0
693-
if (FD->getFormalLinkage() == Linkage::External) {
694-
SetUnknownShaderStageContext();
695-
RunOnFunction(FD);
697+
// skip over other decls or function decls without body
698+
const FunctionDecl *FD = llvm::dyn_cast<FunctionDecl>(D);
699+
if (!FD || !FD->isThisDeclarationADefinition())
700+
continue;
701+
702+
// shader entry point
703+
if (HLSLShaderAttr *ShaderAttr = FD->getAttr<HLSLShaderAttr>()) {
704+
SetShaderStageContext(ShaderAttr->getType());
705+
RunOnFunction(FD);
706+
continue;
707+
}
708+
// exported library function
709+
// FIXME: replace this loop with external linkage check once issue #92071
710+
// is resolved
711+
bool isExport = FD->isInExportDeclContext();
712+
if (!isExport) {
713+
for (const auto *Redecl : FD->redecls()) {
714+
if (Redecl->isInExportDeclContext()) {
715+
isExport = true;
716+
break;
717+
}
718+
}
719+
}
720+
if (isExport) {
721+
SetUnknownShaderStageContext();
722+
RunOnFunction(FD);
723+
continue;
724+
}
696725
}
697-
#endif
698726
}
699727
}
700728

@@ -707,8 +735,7 @@ void DiagnoseHLSLAvailability::RunOnFunction(const FunctionDecl *FD) {
707735
// For any CallExpr found during the traversal add it's callee to the top of
708736
// the stack to be processed next. Functions already processed are stored in
709737
// ScannedDecls.
710-
const FunctionDecl *FD = DeclsToScan.back();
711-
DeclsToScan.pop_back();
738+
const FunctionDecl *FD = DeclsToScan.pop_back_val();
712739

713740
// Decl was already scanned
714741
const unsigned ScannedStages = GetScannedStages(FD);

clang/test/CodeGen/no-skipped-passes-O0-opt-bisect.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// RUN: %clang_cc1 -triple x86_64-linux-gnu -O0 %s -fdebug-pass-manager -emit-llvm -o /dev/null -fsanitize=local-bounds 2>&1 | FileCheck %s
1010
// RUN: %clang_cc1 -triple x86_64-linux-gnu -O0 %s -fdebug-pass-manager -emit-llvm -o /dev/null -fsanitize=dataflow 2>&1 | FileCheck %s
1111
// RUN: %clang_cc1 -triple x86_64-linux-gnu -O0 %s -fdebug-pass-manager -emit-llvm -o /dev/null -fsanitize-coverage-trace-pc-guard 2>&1 | FileCheck %s
12+
// RUN: %clang_cc1 -triple x86_64-linux-gnu -O0 %s -fdebug-pass-manager -emit-llvm -o /dev/null -fsanitize=numerical 2>&1 | FileCheck %s
1213
// RUN: %clang_cc1 -triple x86_64-linux-gnu -O0 %s -fdebug-pass-manager -emit-llvm -o /dev/null -fmemory-profile 2>&1 | FileCheck %s
1314

1415
// RUN: %clang_cc1 -triple x86_64-linux-gnu -mllvm -opt-bisect-limit=0 %s -fdebug-pass-manager -emit-llvm -o /dev/null 2>&1 | FileCheck %s

clang/test/CodeGen/nsan-basic.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// RUN: %clang_cc1 -triple x86_64 -emit-llvm -o - -fsanitize=numerical %s | FileCheck %s
2+
3+
// CHECK: Function Attrs: noinline nounwind optnone sanitize_numerical_stability
4+
float add(float x, float y) {
5+
float z = x + y;
6+
return z;
7+
}

clang/test/CodeGen/sanitizer-module-constructor.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=address -O3 -emit-llvm -fdebug-pass-manager -o - %s 2>&1 | FileCheck %s
22
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=thread -O3 -emit-llvm -fdebug-pass-manager -o - %s 2>&1 | FileCheck %s
33
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=memory -O3 -emit-llvm -fdebug-pass-manager -o - %s 2>&1 | FileCheck %s
4+
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsanitize=numerical -O3 -emit-llvm -fdebug-pass-manager -o - %s 2>&1 | FileCheck %s
45

56
// This is regression test for PR42877
67

clang/test/Index/annotate-comments.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ void isdoxy45(void);
204204
/// Ggg. IS_DOXYGEN_END
205205
void isdoxy46(void);
206206

207-
/// isdoxy47 IS_DOXYGEN_SINGLE
207+
/// IS_DOXYGEN_NOT_ATTACHED
208208
#define FOO
209-
void isdoxy47(void);
209+
void notdoxy47(void);
210210

211211
/// IS_DOXYGEN_START Aaa bbb
212212
/// \param ccc
@@ -330,7 +330,6 @@ void isdoxy54(int);
330330
// CHECK: annotate-comments.cpp:185:6: FunctionDecl=isdoxy44:{{.*}} BriefComment=[IS_DOXYGEN_START Aaa bbb ccc.]
331331
// CHECK: annotate-comments.cpp:195:6: FunctionDecl=isdoxy45:{{.*}} BriefComment=[Ddd eee. Fff.]
332332
// CHECK: annotate-comments.cpp:205:6: FunctionDecl=isdoxy46:{{.*}} BriefComment=[Ddd eee. Fff.]
333-
// CHECK: annotate-comments.cpp:209:6: FunctionDecl=isdoxy47:{{.*}} isdoxy47 IS_DOXYGEN_SINGLE
334333
// CHECK: annotate-comments.cpp:214:6: FunctionDecl=isdoxy48:{{.*}} BriefComment=[IS_DOXYGEN_START Aaa bbb]
335334
// CHECK: annotate-comments.cpp:218:6: FunctionDecl=isdoxy49:{{.*}} BriefComment=[IS_DOXYGEN_START Aaa]
336335
// CHECK: annotate-comments.cpp:222:6: FunctionDecl=isdoxy50:{{.*}} BriefComment=[Returns ddd IS_DOXYGEN_END]

clang/test/SemaHLSL/Availability/avail-diag-default-lib.hlsl

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,55 @@ class MyClass
110110
}
111111
};
112112

113+
// Exported function without body, not used
114+
export void exportedFunctionUnused(float f);
115+
116+
// Exported function with body, without export, not used
117+
void exportedFunctionUnused(float f) {
118+
// expected-error@#exportedFunctionUnused_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
119+
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
120+
float A = fx(f); // #exportedFunctionUnused_fx_call
121+
122+
// API with shader-stage-specific availability in unused exported library function
123+
// - no errors expected because the actual shader stage this function
124+
// will be used in not known at this time
125+
float B = fy(f);
126+
float C = fz(f);
127+
}
128+
129+
// Exported function with body - called from main() which is a compute shader entry point
130+
export void exportedFunctionUsed(float f) {
131+
// expected-error@#exportedFunctionUsed_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
132+
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
133+
float A = fx(f); // #exportedFunctionUsed_fx_call
134+
135+
// expected-error@#exportedFunctionUsed_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
136+
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
137+
float B = fy(f); // #exportedFunctionUsed_fy_call
138+
139+
// expected-error@#exportedFunctionUsed_fz_call {{'fz' is unavailable}}
140+
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
141+
float C = fz(f); // #exportedFunctionUsed_fz_call
142+
}
143+
144+
namespace A {
145+
namespace B {
146+
export {
147+
void exportedFunctionInNS(float x) {
148+
// expected-error@#exportedFunctionInNS_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
149+
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
150+
float A = fx(x); // #exportedFunctionInNS_fx_call
151+
152+
// API with shader-stage-specific availability in exported library function
153+
// - no errors expected because the actual shader stage this function
154+
// will be used in not known at this time
155+
float B = fy(x);
156+
float C = fz(x);
157+
}
158+
}
159+
}
160+
}
161+
113162
// Shader entry point without body
114163
[shader("compute")]
115164
[numthreads(4,1,1)]
@@ -126,5 +175,6 @@ float main() {
126175
float c = C.makeF();
127176
float d = test((float)1.0);
128177
float e = test((half)1.0);
178+
exportedFunctionUsed(1.0f);
129179
return a * b * c;
130180
}

clang/test/SemaHLSL/Availability/avail-diag-relaxed-lib.hlsl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,37 @@ class MyClass
110110
}
111111
};
112112

113+
// Exported function without body, not used
114+
export void exportedFunctionUnused(float f);
115+
116+
// Exported function with body, without export, not used
117+
void exportedFunctionUnused(float f) {
118+
// expected-warning@#exportedFunctionUnused_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
119+
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
120+
float A = fx(f); // #exportedFunctionUnused_fx_call
121+
122+
// API with shader-stage-specific availability in unused exported library function
123+
// - no errors expected because the actual shader stage this function
124+
// will be used in not known at this time
125+
float B = fy(f);
126+
float C = fz(f);
127+
}
128+
129+
// Exported function with body - called from main() which is a compute shader entry point
130+
export void exportedFunctionUsed(float f) {
131+
// expected-warning@#exportedFunctionUsed_fx_call {{'fx' is only available on Shader Model 6.5 or newer}}
132+
// expected-note@#fx {{'fx' has been marked as being introduced in Shader Model 6.5 here, but the deployment target is Shader Model 6.0}}
133+
float A = fx(f); // #exportedFunctionUsed_fx_call
134+
135+
// expected-warning@#exportedFunctionUsed_fy_call {{'fy' is only available in compute environment on Shader Model 6.5 or newer}}
136+
// expected-note@#fy {{'fy' has been marked as being introduced in Shader Model 6.5 in compute environment here, but the deployment target is Shader Model 6.0 compute environment}}
137+
float B = fy(f); // #exportedFunctionUsed_fy_call
138+
139+
// expected-warning@#exportedFunctionUsed_fz_call {{'fz' is unavailable}}
140+
// expected-note@#fz {{'fz' has been marked as being introduced in Shader Model 6.5 in mesh environment here, but the deployment target is Shader Model 6.0 compute environment}}
141+
float C = fz(f); // #exportedFunctionUsed_fz_call
142+
}
143+
113144
// Shader entry point without body
114145
[shader("compute")]
115146
[numthreads(4,1,1)]
@@ -126,5 +157,6 @@ float main() {
126157
float c = C.makeF();
127158
float d = test((float)1.0);
128159
float e = test((half)1.0);
160+
exportedFunctionUsed(1.0f);
129161
return a * b * c;
130162
}

0 commit comments

Comments
 (0)