Skip to content

Commit

Permalink
Merged main:2973febe1087 into amd-gfx:4159e61e2644
Browse files Browse the repository at this point in the history
Local branch amd-gfx 4159e61 Merged main:65c9c9235075 into amd-gfx:41e1ac5101a9
Remote branch main 2973feb [AMDGPU] Force the third source operand of the MAI instructions to VGPR if no AGPRs are used. (llvm#69720)
  • Loading branch information
SC llvm team authored and SC llvm team committed Oct 23, 2023
2 parents 4159e61 + 2973feb commit 71bb954
Show file tree
Hide file tree
Showing 50 changed files with 620 additions and 308 deletions.
3 changes: 0 additions & 3 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,6 @@ New Compiler Flags
the preprocessed text to the output. This can greatly reduce the size of the
preprocessed output, which can be helpful when trying to reduce a test case.

* ``-Wbitfield-conversion`` was added to detect assignments of integral
types to a bitfield that may change the value.

Deprecated Compiler Flags
-------------------------

Expand Down
2 changes: 0 additions & 2 deletions clang/include/clang/Basic/DiagnosticGroups.td
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def SingleBitBitFieldConstantConversion :
def BitFieldConstantConversion : DiagGroup<"bitfield-constant-conversion",
[SingleBitBitFieldConstantConversion]>;
def BitFieldEnumConversion : DiagGroup<"bitfield-enum-conversion">;
def BitFieldConversion : DiagGroup<"bitfield-conversion">;
def BitFieldWidth : DiagGroup<"bitfield-width">;
def CompoundTokenSplitByMacro : DiagGroup<"compound-token-split-by-macro">;
def CompoundTokenSplitBySpace : DiagGroup<"compound-token-split-by-space">;
Expand Down Expand Up @@ -936,7 +935,6 @@ def Conversion : DiagGroup<"conversion",
ConstantConversion,
EnumConversion,
BitFieldEnumConversion,
BitFieldConversion,
FloatConversion,
Shorten64To32,
IntConversion,
Expand Down
3 changes: 0 additions & 3 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -6191,9 +6191,6 @@ def warn_signed_bitfield_enum_conversion : Warning<
"signed bit-field %0 needs an extra bit to represent the largest positive "
"enumerators of %1">,
InGroup<BitFieldEnumConversion>, DefaultIgnore;
def warn_bitfield_too_small_for_integral_type : Warning<
"conversion from %2 (%3 bits) to bit-field %0 (%1 bits) may change value">,
InGroup<BitFieldConversion>, DefaultIgnore;
def note_change_bitfield_sign : Note<
"consider making the bitfield type %select{unsigned|signed}0">;

Expand Down
65 changes: 62 additions & 3 deletions clang/lib/Headers/llvm_libc_wrappers/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
#error "This file is for GPU offloading compilation only"
#endif

// FIXME: The GNU headers provide C++ standard compliant headers when in C++
// mode and the LLVM libc does not. We cannot enable memchr, strchr, strchrnul,
// strpbrk, strrchr, strstr, or strcasestr until this is addressed.
#include_next <string.h>

#if __has_include(<llvm-libc-decls/string.h>)
Expand All @@ -26,8 +23,70 @@

#pragma omp begin declare target

// The GNU headers provide C++ standard compliant headers when in C++ mode and
// the LLVM libc does not. We need to manually provide the definitions using the
// same prototypes.
#if defined(__cplusplus) && defined(__GLIBC__) && \
defined(__CORRECT_ISO_CPP_STRING_H_PROTO)

#ifndef __LIBC_ATTRS
#define __LIBC_ATTRS
#endif

extern "C" {
void *memccpy(void *__restrict, const void *__restrict, int,
size_t) __LIBC_ATTRS;
int memcmp(const void *, const void *, size_t) __LIBC_ATTRS;
void *memcpy(void *__restrict, const void *__restrict, size_t) __LIBC_ATTRS;
void *memmem(const void *, size_t, const void *, size_t) __LIBC_ATTRS;
void *memmove(void *, const void *, size_t) __LIBC_ATTRS;
void *mempcpy(void *__restrict, const void *__restrict, size_t) __LIBC_ATTRS;
void *memset(void *, int, size_t) __LIBC_ATTRS;
char *stpcpy(char *__restrict, const char *__restrict) __LIBC_ATTRS;
char *stpncpy(char *__restrict, const char *__restrict, size_t) __LIBC_ATTRS;
char *strcat(char *__restrict, const char *__restrict) __LIBC_ATTRS;
int strcmp(const char *, const char *) __LIBC_ATTRS;
int strcoll(const char *, const char *) __LIBC_ATTRS;
char *strcpy(char *__restrict, const char *__restrict) __LIBC_ATTRS;
size_t strcspn(const char *, const char *) __LIBC_ATTRS;
char *strdup(const char *) __LIBC_ATTRS;
size_t strlen(const char *) __LIBC_ATTRS;
char *strncat(char *, const char *, size_t) __LIBC_ATTRS;
int strncmp(const char *, const char *, size_t) __LIBC_ATTRS;
char *strncpy(char *__restrict, const char *__restrict, size_t) __LIBC_ATTRS;
char *strndup(const char *, size_t) __LIBC_ATTRS;
size_t strnlen(const char *, size_t) __LIBC_ATTRS;
size_t strspn(const char *, const char *) __LIBC_ATTRS;
char *strtok(char *__restrict, const char *) __LIBC_ATTRS;
char *strtok_r(char *__restrict, const char *__restrict,
char **__restrict) __LIBC_ATTRS;
size_t strxfrm(char *__restrict, const char *__restrict, size_t) __LIBC_ATTRS;
}

extern "C++" {
char *strstr(char *, const char *) noexcept __LIBC_ATTRS;
const char *strstr(const char *, const char *) noexcept __LIBC_ATTRS;
char *strpbrk(char *, const char *) noexcept __LIBC_ATTRS;
const char *strpbrk(const char *, const char *) noexcept __LIBC_ATTRS;
char *strrchr(char *, int) noexcept __LIBC_ATTRS;
const char *strrchr(const char *, int) noexcept __LIBC_ATTRS;
char *strchr(char *, int) noexcept __LIBC_ATTRS;
const char *strchr(const char *, int) noexcept __LIBC_ATTRS;
char *strchrnul(char *, int) noexcept __LIBC_ATTRS;
const char *strchrnul(const char *, int) noexcept __LIBC_ATTRS;
char *strcasestr(char *, const char *) noexcept __LIBC_ATTRS;
const char *strcasestr(const char *, const char *) noexcept __LIBC_ATTRS;
void *memrchr(void *__s, int __c, size_t __n) noexcept __LIBC_ATTRS;
const void *memrchr(const void *__s, int __c, size_t __n) noexcept __LIBC_ATTRS;
void *memchr(void *__s, int __c, size_t __n) noexcept __LIBC_ATTRS;
const void *memchr(const void *__s, int __c, size_t __n) noexcept __LIBC_ATTRS;
}

#else
#include <llvm-libc-decls/string.h>

#endif

#pragma omp end declare target

#undef __LIBC_ATTRS
Expand Down
13 changes: 1 addition & 12 deletions clang/lib/Sema/SemaChecking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14332,18 +14332,6 @@ static bool AnalyzeBitFieldAssignment(Sema &S, FieldDecl *Bitfield, Expr *Init,
S.Diag(WidthExpr->getExprLoc(), diag::note_widen_bitfield)
<< BitsNeeded << ED << WidthExpr->getSourceRange();
}
} else if (OriginalInit->getType()->isIntegralType(S.Context)) {
IntRange LikelySourceRange =
GetExprRange(S.Context, Init, S.isConstantEvaluatedContext(),
/*Approximate=*/true);

if (LikelySourceRange.Width > FieldWidth) {
Expr *WidthExpr = Bitfield->getBitWidth();
S.Diag(InitLoc, diag::warn_bitfield_too_small_for_integral_type)
<< Bitfield << FieldWidth << OriginalInit->getType()
<< LikelySourceRange.Width;
S.Diag(WidthExpr->getExprLoc(), diag::note_declared_at);
}
}

return false;
Expand Down Expand Up @@ -15241,6 +15229,7 @@ static void CheckImplicitConversion(Sema &S, Expr *E, QualType T,

if (LikelySourceRange.Width > TargetRange.Width) {
// If the source is a constant, use a default-on diagnostic.
// TODO: this should happen for bitfield stores, too.
Expr::EvalResult Result;
if (E->EvaluateAsInt(Result, S.Context, Expr::SE_AllowSideEffects,
S.isConstantEvaluatedContext())) {
Expand Down
42 changes: 0 additions & 42 deletions clang/test/SemaCXX/bitfield-width.c

This file was deleted.

16 changes: 16 additions & 0 deletions libc/config/gpu/entrypoints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,48 @@ set(TARGET_LIBC_ENTRYPOINTS

# string.h entrypoints
libc.src.string.bcmp
libc.src.string.bcopy
libc.src.string.bzero
libc.src.string.index
libc.src.string.memccpy
libc.src.string.memchr
libc.src.string.memcmp
libc.src.string.memcpy
libc.src.string.memmem
libc.src.string.memmove
libc.src.string.mempcpy
libc.src.string.memrchr
libc.src.string.memset
libc.src.string.rindex
libc.src.string.stpcpy
libc.src.string.stpncpy
libc.src.string.strcasecmp
libc.src.string.strcasestr
libc.src.string.strcat
libc.src.string.strchr
libc.src.string.strchrnul
libc.src.string.strcmp
libc.src.string.strcoll
libc.src.string.strcpy
libc.src.string.strcspn
libc.src.string.strdup
libc.src.string.strlcat
libc.src.string.strlcpy
libc.src.string.strlen
libc.src.string.strncasecmp
libc.src.string.strncat
libc.src.string.strncmp
libc.src.string.strncpy
libc.src.string.strndup
libc.src.string.strnlen
libc.src.string.strpbrk
libc.src.string.strrchr
libc.src.string.strsep
libc.src.string.strspn
libc.src.string.strstr
libc.src.string.strtok
libc.src.string.strtok_r
libc.src.string.strxfrm

# stdlib.h entrypoints
libc.src.stdlib.abs
Expand Down
27 changes: 19 additions & 8 deletions libc/docs/gpu/support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,37 +45,48 @@ string.h
Function Name Available RPC Required
============= ========= ============
bcmp |check|
bcopy |check|
bzero |check|
index |check|
memccpy |check|
memchr
memchr |check|
memcmp |check|
memcpy |check|
memmem |check|
memmove |check|
mempcpy |check|
memrchr
memrchr |check|
memset |check|
rindex |check|
stpcpy |check|
stpncpy |check|
strcasecmp |check|
strcasestr |check|
strcat |check|
strchr
strchr |check|
strchrnul |check|
strcmp |check|
strcoll |check|
strcpy |check|
strcspn |check|
strdup |check|
strlcat |check|
strlcpy |check|
strlen |check|
strncasecmp |check|
strncat |check|
strncmp |check|
strncpy |check|
strndup |check|
strnlen |check|
strpbrk
strrchr
strpbrk |check|
strrchr |check|
strsep |check|
strspn |check|
strstr
strstr |check|
strtok |check|
strtok_r |check|
strdup
strndup
strxfrm |check|
============= ========= ============

stdlib.h
Expand Down
2 changes: 1 addition & 1 deletion lld/test/wasm/init-fini-no-gc.ll
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ entry:
}

define hidden i32 @__cxa_atexit(i32 %func, i32 %arg, i32 %dso_handle) {
ret i32 0
ret i32 %func
}

@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [
Expand Down
35 changes: 18 additions & 17 deletions lld/test/wasm/init-fini.ll
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ entry:
declare hidden void @externCtor()
declare hidden void @externDtor()
declare hidden void @__wasm_call_ctors()

define i32 @__cxa_atexit(i32 %func, i32 %arg, i32 %dso_handle) {
ret i32 0
}
declare i32 @__cxa_atexit(i32 %func, i32 %arg, i32 %dso_handle)

define hidden void @_start() {
entry:
Expand Down Expand Up @@ -57,13 +54,17 @@ entry:
; CHECK: - Type: IMPORT
; CHECK-NEXT: Imports:
; CHECK-NEXT: - Module: env
; CHECK-NEXT: Field: externDtor
; CHECK-NEXT: Field: __cxa_atexit
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: SigIndex: 0
; CHECK-NEXT: - Module: env
; CHECK-NEXT: Field: externDtor
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: SigIndex: 1
; CHECK-NEXT: - Module: env
; CHECK-NEXT: Field: externCtor
; CHECK-NEXT: Kind: FUNCTION
; CHECK-NEXT: SigIndex: 0
; CHECK-NEXT: SigIndex: 1
; CHECK: - Type: ELEM
; CHECK-NEXT: Segments:
; CHECK-NEXT: - Offset:
Expand All @@ -72,31 +73,31 @@ entry:
; CHECK-NEXT: Functions: [ 9, 11, 13, 17, 19, 21 ]
; CHECK-NEXT: - Type: CODE
; CHECK-NEXT: Functions:
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 10031004100A100F1012100F10141003100C100F10161001100E0B
; CHECK-NEXT: Body: 10041005100A100F1012100F10141004100C100F10161002100E0B
; CHECK: - Index: 22
; CHECK-NEXT: Locals:
; CHECK-NEXT: Body: 02404186808080004100418088808000108780808000450D0000000B0B
; CHECK-NEXT: Body: 02404186808080004100418088808000108080808000450D0000000B0B
; CHECK-NEXT: - Type: CUSTOM
; CHECK-NEXT: Name: name
; CHECK-NEXT: FunctionNames:
; CHECK-NEXT: - Index: 0
; CHECK-NEXT: Name: externDtor
; CHECK-NEXT: Name: __cxa_atexit
; CHECK-NEXT: - Index: 1
; CHECK-NEXT: Name: externCtor
; CHECK-NEXT: Name: externDtor
; CHECK-NEXT: - Index: 2
; CHECK-NEXT: Name: __wasm_call_ctors
; CHECK-NEXT: Name: externCtor
; CHECK-NEXT: - Index: 3
; CHECK-NEXT: Name: func1
; CHECK-NEXT: Name: __wasm_call_ctors
; CHECK-NEXT: - Index: 4
; CHECK-NEXT: Name: func2
; CHECK-NEXT: Name: func1
; CHECK-NEXT: - Index: 5
; CHECK-NEXT: Name: func3
; CHECK-NEXT: Name: func2
; CHECK-NEXT: - Index: 6
; CHECK-NEXT: Name: func4
; CHECK-NEXT: Name: func3
; CHECK-NEXT: - Index: 7
; CHECK-NEXT: Name: __cxa_atexit
; CHECK-NEXT: Name: func4
; CHECK-NEXT: - Index: 8
; CHECK-NEXT: Name: _start
; CHECK-NEXT: - Index: 9
Expand Down
6 changes: 3 additions & 3 deletions lldb/bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
${lldb_python_target_dir}
"plugins"
FILES
"${LLDB_SOURCE_DIR}/examples/python/scripted_process/scripted_process.py"
"${LLDB_SOURCE_DIR}/examples/python/scripted_process/scripted_platform.py")
"${LLDB_SOURCE_DIR}/examples/python/templates/scripted_process.py"
"${LLDB_SOURCE_DIR}/examples/python/templates/scripted_platform.py")

if(APPLE)
create_python_package(
${swig_target}
${lldb_python_target_dir} "macosx"
FILES "${LLDB_SOURCE_DIR}/examples/python/crashlog.py"
"${LLDB_SOURCE_DIR}/examples/python/scripted_process/crashlog_scripted_process.py"
"${LLDB_SOURCE_DIR}/examples/python/crashlog_scripted_process.py"
"${LLDB_SOURCE_DIR}/examples/darwin/heap_find/heap.py")

create_python_package(
Expand Down

0 comments on commit 71bb954

Please sign in to comment.