Skip to content

Commit

Permalink
merge main into amd-staging
Browse files Browse the repository at this point in the history
Change-Id: I235fe52e2ca4bba74bc2da7e57d8231c7fa53401
  • Loading branch information
Jenkins committed May 29, 2024
2 parents fab307f + 7832769 commit 0c9bbb8
Show file tree
Hide file tree
Showing 342 changed files with 3,152 additions and 1,689 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
105 changes: 105 additions & 0 deletions .github/workflows/restart-preempted-libcxx-jobs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
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);
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
})
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
3 changes: 3 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,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
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
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
3 changes: 1 addition & 2 deletions clang/include/clang/Basic/CharInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ LLVM_READONLY inline bool isHexDigit(unsigned char c) {
/// Note that '_' is both a punctuation character and an identifier character!
LLVM_READONLY inline bool isPunctuation(unsigned char c) {
using namespace charinfo;
return (InfoTable[c] &
(CHAR_UNDER | CHAR_PERIOD | CHAR_PUNCT | CHAR_PUNCT)) != 0;
return (InfoTable[c] & (CHAR_UNDER | CHAR_PERIOD | CHAR_PUNCT)) != 0;
}

/// Return true if this character is an ASCII printable character; that is, a
Expand Down
10 changes: 7 additions & 3 deletions clang/include/clang/Parse/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -467,15 +467,18 @@ class Parser : public CodeCompletionHandler {

/// Flags describing a context in which we're parsing a statement.
enum class ParsedStmtContext {
/// This context permits declarations in language modes where declarations
/// are not statements.
AllowDeclarationsInC = 0x1,
/// This context permits standalone OpenMP directives.
AllowStandaloneOpenMPDirectives = 0x1,
AllowStandaloneOpenMPDirectives = 0x2,
/// This context is at the top level of a GNU statement expression.
InStmtExpr = 0x2,
InStmtExpr = 0x4,

/// The context of a regular substatement.
SubStmt = 0,
/// The context of a compound-statement.
Compound = AllowStandaloneOpenMPDirectives,
Compound = AllowDeclarationsInC | AllowStandaloneOpenMPDirectives,

LLVM_MARK_AS_BITMASK_ENUM(InStmtExpr)
};
Expand Down Expand Up @@ -3656,6 +3659,7 @@ class Parser : public CodeCompletionHandler {
struct OpenACCDirectiveParseInfo {
OpenACCDirectiveKind DirKind;
SourceLocation StartLoc;
SourceLocation DirLoc;
SourceLocation EndLoc;
SmallVector<OpenACCClause *> Clauses;
// TODO OpenACC: As we implement support for the Atomic, Routine, Cache, and
Expand Down
3 changes: 2 additions & 1 deletion clang/include/clang/Sema/SemaOpenACC.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ class SemaOpenACC : public SemaBase {
/// Called after the construct has been parsed, but clauses haven't been
/// parsed. This allows us to diagnose not-implemented, as well as set up any
/// state required for parsing the clauses.
void ActOnConstruct(OpenACCDirectiveKind K, SourceLocation StartLoc);
void ActOnConstruct(OpenACCDirectiveKind K, SourceLocation DirLoc);

/// Called after the directive, including its clauses, have been parsed and
/// parsing has consumed the 'annot_pragma_openacc_end' token. This DOES
Expand All @@ -400,6 +400,7 @@ class SemaOpenACC : public SemaBase {
/// declaration group or associated statement.
StmtResult ActOnEndStmtDirective(OpenACCDirectiveKind K,
SourceLocation StartLoc,
SourceLocation DirLoc,
SourceLocation EndLoc,
ArrayRef<OpenACCClause *> Clauses,
StmtResult AssocStmt);
Expand Down
13 changes: 6 additions & 7 deletions clang/lib/AST/StmtOpenACC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ OpenACCComputeConstruct::CreateEmpty(const ASTContext &C, unsigned NumClauses) {
return Inst;
}

OpenACCComputeConstruct *
OpenACCComputeConstruct::Create(const ASTContext &C, OpenACCDirectiveKind K,
SourceLocation BeginLoc, SourceLocation EndLoc,
ArrayRef<const OpenACCClause *> Clauses,
Stmt *StructuredBlock) {
OpenACCComputeConstruct *OpenACCComputeConstruct::Create(
const ASTContext &C, OpenACCDirectiveKind K, SourceLocation BeginLoc,
SourceLocation DirLoc, SourceLocation EndLoc,
ArrayRef<const OpenACCClause *> Clauses, Stmt *StructuredBlock) {
void *Mem = C.Allocate(
OpenACCComputeConstruct::totalSizeToAlloc<const OpenACCClause *>(
Clauses.size()));
auto *Inst = new (Mem)
OpenACCComputeConstruct(K, BeginLoc, EndLoc, Clauses, StructuredBlock);
auto *Inst = new (Mem) OpenACCComputeConstruct(K, BeginLoc, DirLoc, EndLoc,
Clauses, StructuredBlock);
return Inst;
}
Loading

0 comments on commit 0c9bbb8

Please sign in to comment.