Skip to content

Commit 4632ea4

Browse files
author
Jenkins
committed
merge main into amd-staging
Change-Id: Ibcd11a4bcf026ae9244631b875963ea820f2fff5
2 parents 22ff0d6 + 4986510 commit 4632ea4

Some content is hidden

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

45 files changed

+4030
-2178
lines changed

clang/lib/AST/ByteCode/Program.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,13 @@ Record *Program::getOrCreateRecord(const RecordDecl *RD) {
284284
if (!RD->isCompleteDefinition())
285285
return nullptr;
286286

287-
// Deduplicate records.
288-
if (auto It = Records.find(RD); It != Records.end())
287+
// Return an existing record if available. Otherwise, we insert nullptr now
288+
// and replace that later, so recursive calls to this function with the same
289+
// RecordDecl don't run into infinite recursion.
290+
auto [It, Inserted] = Records.try_emplace(RD);
291+
if (!Inserted)
289292
return It->second;
290293

291-
// We insert nullptr now and replace that later, so recursive calls
292-
// to this function with the same RecordDecl don't run into
293-
// infinite recursion.
294-
Records.insert({RD, nullptr});
295-
296294
// Number of bytes required by fields and base classes.
297295
unsigned BaseSize = 0;
298296
// Number of bytes required by virtual base.

clang/lib/StaticAnalyzer/Core/CheckerManager.cpp

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,10 @@ void CheckerManager::runCheckersOnASTDecl(const Decl *D, AnalysisManager& mgr,
6666
assert(D);
6767

6868
unsigned DeclKind = D->getKind();
69-
CachedDeclCheckers *checkers = nullptr;
70-
CachedDeclCheckersMapTy::iterator CCI = CachedDeclCheckersMap.find(DeclKind);
71-
if (CCI != CachedDeclCheckersMap.end()) {
72-
checkers = &(CCI->second);
73-
} else {
69+
auto [CCI, Inserted] = CachedDeclCheckersMap.try_emplace(DeclKind);
70+
CachedDeclCheckers *checkers = &(CCI->second);
71+
if (Inserted) {
7472
// Find the checkers that should run for this Decl and cache them.
75-
checkers = &CachedDeclCheckersMap[DeclKind];
7673
for (const auto &info : DeclCheckers)
7774
if (info.IsForDeclFn(D))
7875
checkers->push_back(info.CheckFn);
@@ -896,14 +893,13 @@ CheckerManager::getCachedStmtCheckersFor(const Stmt *S, bool isPreVisit) {
896893
assert(S);
897894

898895
unsigned Key = (S->getStmtClass() << 1) | unsigned(isPreVisit);
899-
CachedStmtCheckersMapTy::iterator CCI = CachedStmtCheckersMap.find(Key);
900-
if (CCI != CachedStmtCheckersMap.end())
901-
return CCI->second;
902-
903-
// Find the checkers that should run for this Stmt and cache them.
904-
CachedStmtCheckers &Checkers = CachedStmtCheckersMap[Key];
905-
for (const auto &Info : StmtCheckers)
906-
if (Info.IsPreVisit == isPreVisit && Info.IsForStmtFn(S))
907-
Checkers.push_back(Info.CheckFn);
896+
auto [CCI, Inserted] = CachedStmtCheckersMap.try_emplace(Key);
897+
CachedStmtCheckers &Checkers = CCI->second;
898+
if (Inserted) {
899+
// Find the checkers that should run for this Stmt and cache them.
900+
for (const auto &Info : StmtCheckers)
901+
if (Info.IsPreVisit == isPreVisit && Info.IsForStmtFn(S))
902+
Checkers.push_back(Info.CheckFn);
903+
}
908904
return Checkers;
909905
}

libc/newhdrgen/yaml/gpu/rpc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ functions:
1616
- name: rpc_host_call
1717
standards:
1818
- GPUExtensions
19-
return_type: void
19+
return_type: unsigned long long
2020
arguments:
2121
- type: void *
2222
- type: void *

libc/spec/gpu_ext.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def GPUExtensions : StandardSpec<"GPUExtensions"> {
77
[
88
FunctionSpec<
99
"rpc_host_call",
10-
RetValSpec<VoidType>,
10+
RetValSpec<UnsignedLongLongType>,
1111
[ArgSpec<VoidPtr>, ArgSpec<VoidPtr>, ArgSpec<SizeTType>]
1212
>,
1313
]

libc/src/gpu/rpc_host_call.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ namespace LIBC_NAMESPACE_DECL {
1717

1818
// This calls the associated function pointer on the RPC server with the given
1919
// arguments. We expect that the pointer here is a valid pointer on the server.
20-
LLVM_LIBC_FUNCTION(void, rpc_host_call, (void *fn, void *data, size_t size)) {
20+
LLVM_LIBC_FUNCTION(unsigned long long, rpc_host_call,
21+
(void *fn, void *data, size_t size)) {
2122
rpc::Client::Port port = rpc::client.open<RPC_HOST_CALL>();
2223
port.send_n(data, size);
2324
port.send([=](rpc::Buffer *buffer) {
2425
buffer->data[0] = reinterpret_cast<uintptr_t>(fn);
2526
});
26-
port.recv([](rpc::Buffer *) {});
27+
unsigned long long ret;
28+
port.recv([&](rpc::Buffer *buffer) {
29+
ret = static_cast<unsigned long long>(buffer->data[0]);
30+
});
2731
port.close();
32+
return ret;
2833
}
2934

3035
} // namespace LIBC_NAMESPACE_DECL

libc/src/gpu/rpc_host_call.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
namespace LIBC_NAMESPACE_DECL {
1616

17-
void rpc_host_call(void *fn, void *buffer, size_t size);
17+
unsigned long long rpc_host_call(void *fn, void *buffer, size_t size);
1818

1919
} // namespace LIBC_NAMESPACE_DECL
2020

libc/src/string/memory_utils/aarch64/inline_memcmp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#ifndef LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMCMP_H
99
#define LIBC_SRC_STRING_MEMORY_UTILS_X86_64_INLINE_MEMCMP_H
1010

11-
#include "src/__support/macros/config.h" // LIBC_INLINE
11+
#include "src/__support/macros/attributes.h" // LIBC_INLINE
1212
#include "src/__support/macros/optimization.h" // LIBC_UNLIKELY
1313
#include "src/string/memory_utils/op_aarch64.h"
1414
#include "src/string/memory_utils/op_generic.h"

libc/src/string/memory_utils/aarch64/inline_memcpy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMCPY_H
99
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMCPY_H
1010

11-
#include "src/__support/macros/config.h" // LIBC_INLINE
11+
#include "src/__support/macros/attributes.h" // LIBC_INLINE
1212
#include "src/string/memory_utils/op_builtin.h"
1313
#include "src/string/memory_utils/utils.h"
1414

libc/src/string/memory_utils/aarch64/inline_memmove.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#ifndef LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMMOVE_H
99
#define LIBC_SRC_STRING_MEMORY_UTILS_AARCH64_INLINE_MEMMOVE_H
1010

11-
#include "src/__support/macros/config.h" // LIBC_INLINE
11+
#include "src/__support/macros/attributes.h" // LIBC_INLINE
1212
#include "src/string/memory_utils/op_aarch64.h" // aarch64::kNeon
1313
#include "src/string/memory_utils/op_builtin.h"
1414
#include "src/string/memory_utils/op_generic.h"

libc/src/string/memory_utils/generic/aligned_access.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_GENERIC_ALIGNED_ACCESS_H
1414
#define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_GENERIC_ALIGNED_ACCESS_H
1515

16-
#include "src/__support/macros/config.h" // LIBC_INLINE
16+
#include "src/__support/macros/attributes.h" // LIBC_INLINE
1717
#include "src/string/memory_utils/generic/byte_per_byte.h"
1818
#include "src/string/memory_utils/op_generic.h" // generic::splat
1919
#include "src/string/memory_utils/utils.h" // Ptr, CPtr

0 commit comments

Comments
 (0)