Skip to content

Commit

Permalink
Merged main:5bfe4b93e15ad38f211c5dec64be0eeaa4c8e914 into amd-gfx:6b1…
Browse files Browse the repository at this point in the history
…d66d572fb

Local branch amd-gfx 6b1d66d Merged main:516a9f5183446d695c701fcdc562d543c9ccb297 into amd-gfx:295897600144
Remote branch main 5bfe4b9 [mlir][arith] Disallow casting tensor dimensions (llvm#93349)
  • Loading branch information
SC llvm team authored and SC llvm team committed May 29, 2024
2 parents 6b1d66d + 5bfe4b9 commit ecb2538
Show file tree
Hide file tree
Showing 462 changed files with 29,963 additions and 2,681 deletions.
6 changes: 5 additions & 1 deletion .ci/monolithic-windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
# see https://github.com/llvm/llvm-project/pull/82393 and
# https://discourse.llvm.org/t/rfc-future-of-windows-pre-commit-ci/76840/40
# for further information.
# We limit the number of parallel compile jobs to 24 control memory
# consumption and improve build reliability.
cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D LLVM_ENABLE_PROJECTS="${projects}" \
-G Ninja \
Expand All @@ -58,7 +60,9 @@ cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
-D MLIR_ENABLE_BINDINGS_PYTHON=ON \
-D CMAKE_EXE_LINKER_FLAGS="/MANIFEST:NO" \
-D CMAKE_MODULE_LINKER_FLAGS="/MANIFEST:NO" \
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO"
-D CMAKE_SHARED_LINKER_FLAGS="/MANIFEST:NO" \
-D LLVM_PARALLEL_COMPILE_JOBS=16 \
-D LLVM_PARALLEL_LINK_JOBS=4

echo "--- ninja"
# Targets are not escaped as they are passed as separate arguments.
Expand Down
107 changes: 107 additions & 0 deletions .github/workflows/restart-preempted-libcxx-jobs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Restart Preempted Libc++ Workflow

# The libc++ builders run on preemptable VMs, which can be shutdown at any time.
# This workflow identifies when a workflow run was canceled due to the VM being preempted,
# and restarts the workflow run.

# We identify a canceled workflow run by checking the annotations of the check runs in the check suite,
# which should contain the message "The runner has received a shutdown signal."

# Note: If a job is both preempted and also contains a non-preemption failure, we do not restart the workflow.

on:
workflow_run:
workflows: [Build and Test libc\+\+]
types:
- completed

permissions:
contents: read

jobs:
restart:
if: github.repository_owner == 'llvm' && (github.event.workflow_run.conclusion == 'failure' || github.event.workflow_run.conclusion == 'cancelled')
name: "Restart Job"
permissions:
statuses: read
checks: read
actions: write
runs-on: ubuntu-latest
steps:
- name: "Restart Job"
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea #v7.0.1
with:
script: |
const failure_regex = /Process completed with exit code 1./
const preemption_regex = /The runner has received a shutdown signal/
console.log('Listing check runs for suite')
const check_suites = await github.rest.checks.listForSuite({
owner: context.repo.owner,
repo: context.repo.repo,
check_suite_id: context.payload.workflow_run.check_suite_id
})
check_run_ids = [];
for (check_run of check_suites.data.check_runs) {
console.log('Checking check run: ' + check_run.id);
console.log(check_run);
if (check_run.status != 'completed') {
console.log('Check run was not completed. Skipping.');
continue;
}
if (check_run.conclusion != 'failure' && check_run.conclusion != 'cancelled') {
console.log('Check run had conclusion: ' + check_run.conclusion + '. Skipping.');
continue;
}
check_run_ids.push(check_run.id);
}
has_preempted_job = false;
for (check_run_id of check_run_ids) {
console.log('Listing annotations for check run: ' + check_run_id);
annotations = await github.rest.checks.listAnnotations({
owner: context.repo.owner,
repo: context.repo.repo,
check_run_id: check_run_id
})
console.log(annotations);
for (annotation of annotations.data) {
if (annotation.annotation_level != 'failure') {
continue;
}
const preemption_match = annotation.message.match(preemption_regex);
if (preemption_match != null) {
console.log('Found preemption message: ' + annotation.message);
has_preempted_job = true;
}
const failure_match = annotation.message.match(failure_regex);
if (failure_match != null) {
// We only want to restart the workflow if all of the failures were due to preemption.
// We don't want to restart the workflow if there were other failures.
console.log('Choosing not to rerun workflow because we found a non-preemption failure');
console.log('Failure message: ' + annotation.message);
return;
}
}
}
if (!has_preempted_job) {
console.log('No preempted jobs found. Not restarting workflow.');
return;
}
console.log("Restarted workflow: " + context.payload.workflow_run.id);
await github.rest.actions.reRunWorkflowFailedJobs({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id
})
12 changes: 10 additions & 2 deletions clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1414,13 +1414,21 @@ IdentifierNamingCheck::getDiagInfo(const NamingCheckId &ID,
}};
}

StringRef IdentifierNamingCheck::getRealFileName(StringRef FileName) const {
auto Iter = RealFileNameCache.try_emplace(FileName);
SmallString<256U> &RealFileName = Iter.first->getValue();
if (!Iter.second)
return RealFileName;
llvm::sys::fs::real_path(FileName, RealFileName);
return RealFileName;
}

const IdentifierNamingCheck::FileStyle &
IdentifierNamingCheck::getStyleForFile(StringRef FileName) const {
if (!GetConfigPerFile)
return *MainFileStyle;

SmallString<128> RealFileName;
llvm::sys::fs::real_path(FileName, RealFileName);
StringRef RealFileName = getRealFileName(FileName);
StringRef Parent = llvm::sys::path::parent_path(RealFileName);
auto Iter = NamingStylesCache.find(Parent);
if (Iter != NamingStylesCache.end())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ class IdentifierNamingCheck final : public RenamerClangTidyCheck {
const NamingCheckFailure &Failure) const override;

const FileStyle &getStyleForFile(StringRef FileName) const;
StringRef getRealFileName(StringRef FileName) const;

/// Find the style kind of a field in an anonymous record.
StyleKind findStyleKindForAnonField(
Expand All @@ -222,6 +223,7 @@ class IdentifierNamingCheck final : public RenamerClangTidyCheck {
/// Stores the style options as a vector, indexed by the specified \ref
/// StyleKind, for a given directory.
mutable llvm::StringMap<FileStyle> NamingStylesCache;
mutable llvm::StringMap<SmallString<256U>> RealFileNameCache;
FileStyle *MainFileStyle;
ClangTidyContext *Context;
const bool GetConfigPerFile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ The following options are described below:

.. code-block:: c++

int doubler(int x) // warns that x is too short
{
return 2 * x;
}
int i = 42; // warns that 'i' is too short

This check does not have any fix suggestions in the general case since
variable names have semantic value.
Expand All @@ -50,7 +47,10 @@ The following options are described below:

.. code-block:: c++

int i = 42; // warns that 'i' is too short
int doubler(int x) // warns that x is too short
{
return 2 * x;
}

This check does not have any fix suggestions in the general case since
variable names have semantic value.
Expand Down
38 changes: 38 additions & 0 deletions clang/docs/InternalsManual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,44 @@ severe that error recovery won't be able to recover sensibly from them (thus
spewing a ton of bogus errors). One example of this class of error are failure
to ``#include`` a file.

Diagnostic Wording
^^^^^^^^^^^^^^^^^^
The wording used for a diagnostic is critical because it is the only way for a
user to know how to correct their code. Use the following suggestions when
wording a diagnostic.

* Diagnostics in Clang do not start with a capital letter and do not end with
punctuation.

* This does not apply to proper nouns like ``Clang`` or ``OpenMP``, to
acronyms like ``GCC`` or ``ARC``, or to language standards like ``C23``
or ``C++17``.
* A trailing question mark is allowed. e.g., ``unknown identifier %0; did
you mean %1?``.

* Appropriately capitalize proper nouns like ``Clang``, ``OpenCL``, ``GCC``,
``Objective-C``, etc and language standard versions like ``C11`` or ``C++11``.
* The wording should be succinct. If necessary, use a semicolon to combine
sentence fragments instead of using complete sentences. e.g., prefer wording
like ``'%0' is deprecated; it will be removed in a future release of Clang``
over wording like ``'%0' is deprecated. It will be removed in a future release
of Clang``.
* The wording should be actionable and avoid using standards terms or grammar
productions that a new user would not be familiar with. e.g., prefer wording
like ``missing semicolon`` over wording like ``syntax error`` (which is not
actionable) or ``expected unqualified-id`` (which uses standards terminology).
* The wording should clearly explain what is wrong with the code rather than
restating what the code does. e.g., prefer wording like ``type %0 requires a
value in the range %1 to %2`` over wording like ``%0 is invalid``.
* The wording should have enough contextual information to help the user
identify the issue in a complex expression. e.g., prefer wording like
``both sides of the %0 binary operator are identical`` over wording like
``identical operands to binary operator``.
* Use single quotes to denote syntactic constructs or command line arguments
named in a diagnostic message. e.g., prefer wording like ``'this' pointer
cannot be null in well-defined C++ code`` over wording like ``this pointer
cannot be null in well-defined C++ code``.

The Format String
^^^^^^^^^^^^^^^^^

Expand Down
8 changes: 8 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,9 @@ Improvements to Clang's diagnostics
- Clang emits a ``-Wparentheses`` warning for expressions with consecutive comparisons like ``x < y < z``.
Fixes #GH20456.

- Clang no longer emits a "declared here" note for a builtin function that has no declaration in source.
Fixes #GH93369.

Improvements to Clang's time-trace
----------------------------------

Expand Down Expand Up @@ -629,6 +632,9 @@ Bug Fixes in This Version
- ``__is_array`` and ``__is_bounded_array`` no longer return ``true`` for
zero-sized arrays. Fixes (#GH54705).

- Correctly reject declarations where a statement is required in C.
Fixes #GH92775

Bug Fixes to Compiler Builtins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -802,6 +808,8 @@ Bug Fixes to C++ Support
- Fixed a regression introduced in Clang 18 causing a static function overloading a non-static function
with the same parameters not to be diagnosed. (Fixes #GH93456).
- Clang now diagnoses unexpanded parameter packs in attributes. (Fixes #GH93269).
- Clang now allows ``@$``` in raw string literals. Fixes (#GH93130).
- Fix an assertion failure when checking invalid ``this`` usage in the wrong context. (Fixes #GH91536).

Bug Fixes to AST Handling
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
32 changes: 19 additions & 13 deletions clang/include/clang/AST/StmtOpenACC.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class OpenACCConstructStmt : public Stmt {
/// The location of the directive statement, from the '#' to the last token of
/// the directive.
SourceRange Range;
/// The location of the directive name.
SourceLocation DirectiveLoc;

/// The list of clauses. This is stored here as an ArrayRef, as this is the
/// most convienient place to access the list, however the list itself should
Expand All @@ -39,8 +41,9 @@ class OpenACCConstructStmt : public Stmt {

protected:
OpenACCConstructStmt(StmtClass SC, OpenACCDirectiveKind K,
SourceLocation Start, SourceLocation End)
: Stmt(SC), Kind(K), Range(Start, End) {}
SourceLocation Start, SourceLocation DirectiveLoc,
SourceLocation End)
: Stmt(SC), Kind(K), Range(Start, End), DirectiveLoc(DirectiveLoc) {}

// Used only for initialization, the leaf class can initialize this to
// trailing storage.
Expand All @@ -59,6 +62,7 @@ class OpenACCConstructStmt : public Stmt {

SourceLocation getBeginLoc() const { return Range.getBegin(); }
SourceLocation getEndLoc() const { return Range.getEnd(); }
SourceLocation getDirectiveLoc() const { return DirectiveLoc; }
ArrayRef<const OpenACCClause *> clauses() const { return Clauses; }

child_range children() {
Expand All @@ -81,9 +85,11 @@ class OpenACCAssociatedStmtConstruct : public OpenACCConstructStmt {

protected:
OpenACCAssociatedStmtConstruct(StmtClass SC, OpenACCDirectiveKind K,
SourceLocation Start, SourceLocation End,
Stmt *AssocStmt)
: OpenACCConstructStmt(SC, K, Start, End), AssociatedStmt(AssocStmt) {}
SourceLocation Start,
SourceLocation DirectiveLoc,
SourceLocation End, Stmt *AssocStmt)
: OpenACCConstructStmt(SC, K, Start, DirectiveLoc, End),
AssociatedStmt(AssocStmt) {}

void setAssociatedStmt(Stmt *S) { AssociatedStmt = S; }
Stmt *getAssociatedStmt() { return AssociatedStmt; }
Expand Down Expand Up @@ -126,10 +132,10 @@ class OpenACCComputeConstruct final
friend class ASTStmtReader;
friend class ASTContext;
OpenACCComputeConstruct(unsigned NumClauses)
: OpenACCAssociatedStmtConstruct(OpenACCComputeConstructClass,
OpenACCDirectiveKind::Invalid,
SourceLocation{}, SourceLocation{},
/*AssociatedStmt=*/nullptr) {
: OpenACCAssociatedStmtConstruct(
OpenACCComputeConstructClass, OpenACCDirectiveKind::Invalid,
SourceLocation{}, SourceLocation{}, SourceLocation{},
/*AssociatedStmt=*/nullptr) {
// We cannot send the TrailingObjects storage to the base class (which holds
// a reference to the data) until it is constructed, so we have to set it
// separately here.
Expand All @@ -141,11 +147,11 @@ class OpenACCComputeConstruct final
}

OpenACCComputeConstruct(OpenACCDirectiveKind K, SourceLocation Start,
SourceLocation End,
SourceLocation DirectiveLoc, SourceLocation End,
ArrayRef<const OpenACCClause *> Clauses,
Stmt *StructuredBlock)
: OpenACCAssociatedStmtConstruct(OpenACCComputeConstructClass, K, Start,
End, StructuredBlock) {
DirectiveLoc, End, StructuredBlock) {
assert(isOpenACCComputeDirectiveKind(K) &&
"Only parallel, serial, and kernels constructs should be "
"represented by this type");
Expand All @@ -169,8 +175,8 @@ class OpenACCComputeConstruct final
unsigned NumClauses);
static OpenACCComputeConstruct *
Create(const ASTContext &C, OpenACCDirectiveKind K, SourceLocation BeginLoc,
SourceLocation EndLoc, ArrayRef<const OpenACCClause *> Clauses,
Stmt *StructuredBlock);
SourceLocation DirectiveLoc, SourceLocation EndLoc,
ArrayRef<const OpenACCClause *> Clauses, Stmt *StructuredBlock);

Stmt *getStructuredBlock() { return getAssociatedStmt(); }
const Stmt *getStructuredBlock() const {
Expand Down
7 changes: 5 additions & 2 deletions clang/include/clang/Basic/Attr.td
Original file line number Diff line number Diff line change
Expand Up @@ -2025,9 +2025,12 @@ def Convergent : InheritableAttr {
def NoInline : DeclOrStmtAttr {
let Spellings = [CustomKeyword<"__noinline__">, GCC<"noinline">,
CXX11<"clang", "noinline">, C23<"clang", "noinline">,
CXX11<"msvc", "noinline">, C23<"msvc", "noinline">,
Declspec<"noinline">];
let Accessors = [Accessor<"isClangNoInline", [CXX11<"clang", "noinline">,
C23<"clang", "noinline">]>];
let Accessors = [Accessor<"isStmtNoInline", [CXX11<"clang", "noinline">,
C23<"clang", "noinline">,
CXX11<"msvc", "noinline">,
C23<"msvc", "noinline">]>];
let Documentation = [NoInlineDocs];
let Subjects = SubjectList<[Function, Stmt], WarnDiag,
"functions and statements">;
Expand Down
4 changes: 4 additions & 0 deletions clang/include/clang/Basic/BuiltinsWebAssembly.def
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ TARGET_BUILTIN(__builtin_wasm_min_f64x2, "V2dV2dV2d", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_max_f64x2, "V2dV2dV2d", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_pmin_f64x2, "V2dV2dV2d", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_pmax_f64x2, "V2dV2dV2d", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_min_f16x8, "V8hV8hV8h", "nc", "half-precision")
TARGET_BUILTIN(__builtin_wasm_max_f16x8, "V8hV8hV8h", "nc", "half-precision")
TARGET_BUILTIN(__builtin_wasm_pmin_f16x8, "V8hV8hV8h", "nc", "half-precision")
TARGET_BUILTIN(__builtin_wasm_pmax_f16x8, "V8hV8hV8h", "nc", "half-precision")

TARGET_BUILTIN(__builtin_wasm_ceil_f32x4, "V4fV4f", "nc", "simd128")
TARGET_BUILTIN(__builtin_wasm_floor_f32x4, "V4fV4f", "nc", "simd128")
Expand Down
Loading

0 comments on commit ecb2538

Please sign in to comment.