Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
Automatic merge of https://github.com/llvm/llvm-project main into cla…
Browse files Browse the repository at this point in the history
…ngd-powerpc (2023-11-21 05-04)
  • Loading branch information
BenjaminGrayNp1 committed Nov 21, 2023
2 parents f74fb74 + 8460206 commit a57f122
Show file tree
Hide file tree
Showing 352 changed files with 12,991 additions and 8,338 deletions.
13 changes: 13 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@

/lldb/ @JDevlieghere

/mlir/include/mlir/Interfaces/TilingInterface.* @MaheshRavishankar

/mlir/lib/Dialect/Linalg/Transforms/DecomposeLinalgOps.cpp @MaheshRavishankar
/mlir/lib/Dialect/Linalg/Transforms/DropUnitDims.cpp @MaheshRavishankar
/mlir/lib/Dialect/Linalg/Transforms/ElementwiseOpFusion.cpp @MaheshRavishankar
/mlir/lib/Dialect/MemRef/Transforms/EmulateNarrowType.cpp @MaheshRavishankar
/mlir/lib/Dialect/Vector/Transforms/VectorEmulateNarrowType.cpp @MaheshRavishankar
/mlir/lib/Interfaces/TilingInterface.* @MaheshRavishankar

# Transform Dialect in MLIR.
/mlir/include/mlir/Dialect/Transform/* @ftynse
/mlir/lib/Dialect/Transform/* @ftynse

# SPIR-V in MLIR.
/mlir/**/SPIRV/ @antiagainst @kuhar
/mlir/**/SPIRVTo*/ @antiagainst @kuhar
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/libcxx-build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ env:
jobs:
stage1:
runs-on:
group: libcxx-runners-16
group: libcxx-runners-8
continue-on-error: false
strategy:
fail-fast: true
Expand Down Expand Up @@ -163,10 +163,10 @@ jobs:
machine: libcxx-runners-8
std_modules: 'ON'
- config: 'generic-asan'
machine: libcxx-runners-16
machine: libcxx-runners-8
std_modules: 'OFF'
- config: 'generic-tsan'
machine: libcxx-runners-16
machine: libcxx-runners-8
std_modules: 'OFF'
- config: 'generic-ubsan'
machine: libcxx-runners-8
Expand Down
61 changes: 33 additions & 28 deletions bolt/lib/Core/Exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,18 @@ void BinaryFunction::parseLSDA(ArrayRef<uint8_t> LSDASectionData,
uint64_t Offset = getLSDAAddress() - LSDASectionAddress;
assert(Data.isValidOffset(Offset) && "wrong LSDA address");

uint8_t LPStartEncoding = Data.getU8(&Offset);
uint64_t LPStart = 0;
// Convert to offset if LPStartEncoding is typed absptr DW_EH_PE_absptr
if (std::optional<uint64_t> MaybeLPStart = Data.getEncodedPointer(
&Offset, LPStartEncoding, Offset + LSDASectionAddress))
LPStart = (LPStartEncoding && 0xFF == 0) ? *MaybeLPStart
: *MaybeLPStart - Address;
const uint8_t LPStartEncoding = Data.getU8(&Offset);
uint64_t LPStart = Address;
if (LPStartEncoding != dwarf::DW_EH_PE_omit) {
std::optional<uint64_t> MaybeLPStart = Data.getEncodedPointer(
&Offset, LPStartEncoding, Offset + LSDASectionAddress);
if (!MaybeLPStart) {
errs() << "BOLT-ERROR: unsupported LPStartEncoding: "
<< (unsigned)LPStartEncoding << '\n';
exit(1);
}
LPStart = *MaybeLPStart;
}

const uint8_t TTypeEncoding = Data.getU8(&Offset);
LSDATypeEncoding = TTypeEncoding;
Expand Down Expand Up @@ -175,38 +180,38 @@ void BinaryFunction::parseLSDA(ArrayRef<uint8_t> LSDASectionData,
uint64_t LandingPad = *Data.getEncodedPointer(
&CallSitePtr, CallSiteEncoding, CallSitePtr + LSDASectionAddress);
uint64_t ActionEntry = Data.getULEB128(&CallSitePtr);

uint64_t LPOffset = LPStart + LandingPad;
uint64_t LPAddress = Address + LPOffset;

// Verify if landing pad code is located outside current function
// Support landing pad to builtin_unreachable
if (LPAddress < Address || LPAddress > Address + getSize()) {
BinaryFunction *Fragment =
BC.getBinaryFunctionContainingAddress(LPAddress);
assert(Fragment != nullptr &&
"BOLT-ERROR: cannot find landing pad fragment");
BC.addInterproceduralReference(this, Fragment->getAddress());
BC.processInterproceduralReferences();
assert(isParentOrChildOf(*Fragment) &&
"BOLT-ERROR: cannot have landing pads in different functions");
setHasIndirectTargetToSplitFragment(true);
BC.addFragmentsToSkip(this);
return;
}
if (LandingPad)
LandingPad += LPStart;

if (opts::PrintExceptions) {
outs() << "Call Site: [0x" << Twine::utohexstr(RangeBase + Start)
<< ", 0x" << Twine::utohexstr(RangeBase + Start + Length)
<< "); landing pad: 0x" << Twine::utohexstr(LPOffset)
<< "); landing pad: 0x" << Twine::utohexstr(LandingPad)
<< "; action entry: 0x" << Twine::utohexstr(ActionEntry) << "\n";
outs() << " current offset is " << (CallSitePtr - CallSiteTableStart)
<< '\n';
}

// Create a handler entry if necessary.
MCSymbol *LPSymbol = nullptr;
if (LPOffset) {
if (LandingPad) {
// Verify if landing pad code is located outside current function
// Support landing pad to builtin_unreachable
if (LandingPad < Address || LandingPad > Address + getSize()) {
BinaryFunction *Fragment =
BC.getBinaryFunctionContainingAddress(LandingPad);
assert(Fragment != nullptr &&
"BOLT-ERROR: cannot find landing pad fragment");
BC.addInterproceduralReference(this, Fragment->getAddress());
BC.processInterproceduralReferences();
assert(isParentOrChildOf(*Fragment) &&
"BOLT-ERROR: cannot have landing pads in different functions");
setHasIndirectTargetToSplitFragment(true);
BC.addFragmentsToSkip(this);
return;
}

const uint64_t LPOffset = LandingPad - getAddress();
if (!getInstructionAtOffset(LPOffset)) {
if (opts::Verbosity >= 1)
errs() << "BOLT-WARNING: landing pad " << Twine::utohexstr(LPOffset)
Expand Down
4 changes: 2 additions & 2 deletions bolt/test/lsda.cpp → bolt/test/lsda-section-name.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// This test check that LSDA section named by .gcc_except_table.main is
// disassembled by BOLT.

// RUN: %clang++ %cxxflags -O3 -flto=thin -no-pie -c %s -o %t.o
// RUN: %clang++ %cxxflags -flto=thin -no-pie -fuse-ld=lld %t.o -o %t.exe \
// RUN: %clang++ %cxxflags -O3 -no-pie -c %s -o %t.o
// RUN: %clang++ %cxxflags -no-pie -fuse-ld=lld %t.o -o %t.exe \
// RUN: -Wl,-q -Wl,--script=%S/Inputs/lsda.ldscript
// RUN: llvm-readelf -SW %t.exe | FileCheck %s
// RUN: llvm-bolt %t.exe -o %t.bolt
Expand Down
91 changes: 91 additions & 0 deletions bolt/test/runtime/X86/exceptions-lpstart-zero.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# RUN: %clangxx %cflags -no-pie %s -o %t.exe -Wl,-q
# RUN: llvm-bolt %t.exe -o %t.exe.bolt
# RUN: %t.exe.bolt

# REQUIRES: system-linux

## Test that BOLT properly handles LPStart when LPStartEncoding is different
## from DW_EH_PE_omit.

# The test case compiled with -O1 from:
#
# int main() {
# try {
# throw 42;
# } catch (...) {
# return 0;
# }
# return 1;
# }
#
# The exception table was modified with udata4 LPStartEncoding and sdata4
# CallSiteEncoding.

.text
.globl main # -- Begin function main
.p2align 4, 0x90
.type main,@function
main: # @main
.Lfunc_begin0:
.cfi_startproc
.cfi_personality 3, __gxx_personality_v0
.cfi_lsda 3, .Lexception0
# %bb.0:
pushq %rax
.cfi_def_cfa_offset 16
movl $4, %edi
callq __cxa_allocate_exception
movl $42, (%rax)
.Ltmp0:
movl $_ZTIi, %esi
movq %rax, %rdi
xorl %edx, %edx
callq __cxa_throw
.Ltmp1:
# %bb.1:
.LBB0_2:
.Ltmp2:
movq %rax, %rdi
callq __cxa_begin_catch
callq __cxa_end_catch
xorl %eax, %eax
popq %rcx
.cfi_def_cfa_offset 8
retq
.Lfunc_end0:
.size main, .Lfunc_end0-main
.cfi_endproc
.section .gcc_except_table,"a",@progbits
.p2align 2
GCC_except_table0:
.Lexception0:
.byte 3 # @LPStart Encoding = udata4
.long 0
.byte 3 # @TType Encoding = udata4
.uleb128 .Lttbase0-.Lttbaseref0
.Lttbaseref0:
.byte 11 # Call site Encoding = sdata4
.uleb128 .Lcst_end0-.Lcst_begin0
.Lcst_begin0:
.long .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 <<
.long .Ltmp0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Ltmp0
.long 0 # has no landing pad
.byte 0 # On action: cleanup
.long .Ltmp0-.Lfunc_begin0 # >> Call Site 2 <<
.long .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1
.long .Ltmp2 # jumps to .Ltmp2
.byte 1 # On action: 1
.long .Ltmp1-.Lfunc_begin0 # >> Call Site 3 <<
.long .Lfunc_end0-.Ltmp1 # Call between .Ltmp1 and .Lfunc_end0
.long 0 # has no landing pad
.byte 0 # On action: cleanup
.Lcst_end0:
.byte 1 # >> Action Record 1 <<
# Catch TypeInfo 1
.byte 0 # No further actions
.p2align 2
# >> Catch TypeInfos <<
.long 0 # TypeInfo 1
.Lttbase0:
.p2align 2
# -- End function
42 changes: 42 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ C23 Feature Support
- Clang now supports ``<stdckdint.h>`` which defines several macros for performing
checked integer arithmetic. It is also exposed in pre-C23 modes.

- Completed the implementation of
`N2508 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2508.pdf>`_. We
previously implemented allowing a label at the end of a compound statement,
and now we've implemented allowing a label to be followed by a declaration
instead of a statement.

Non-comprehensive list of changes in this release
-------------------------------------------------

Expand Down Expand Up @@ -311,6 +317,23 @@ Attribute Changes in Clang
should be a coroutine. A non-coroutine function marked with ``[[clang::coro_wrapper]]``
is still allowed to return the such a type. This is helpful for analyzers to recognize coroutines from the function signatures.

- Clang now supports ``[[clang::code_align(N)]]`` as an attribute which can be
applied to a loop and specifies the byte alignment for a loop. This attribute
accepts a positive integer constant initialization expression indicating the
number of bytes for the minimum alignment boundary. Its value must be a power
of 2, between 1 and 4096(inclusive).

.. code-block:: c++

void Array(int *array, size_t n) {
[[clang::code_align(64)]] for (int i = 0; i < n; ++i) array[i] = 0;
}
template<int A>
void func() {
[[clang::code_align(A)]] for(;;) { }
}

Improvements to Clang's diagnostics
-----------------------------------
- Clang constexpr evaluator now prints template arguments when displaying
Expand Down Expand Up @@ -566,8 +589,27 @@ Bug Fixes in This Version
Fixes (`#67687 <https://github.com/llvm/llvm-project/issues/67687>`_)
- Fix crash from constexpr evaluator evaluating uninitialized arrays as rvalue.
Fixes (`#67317 <https://github.com/llvm/llvm-project/issues/67317>`_)
- Clang now properly diagnoses use of stand-alone OpenMP directives after a
label (including ``case`` or ``default`` labels).

Before:

.. code-block:: c++

label:
#pragma omp barrier // ok

After:

.. code-block:: c++

label:
#pragma omp barrier // error: '#pragma omp barrier' cannot be an immediate substatement

- Fixed an issue that a benign assertion might hit when instantiating a pack expansion
inside a lambda. (`#61460 <https://github.com/llvm/llvm-project/issues/61460>`_)
- Fix crash during instantiation of some class template specializations within class
templates. Fixes (`#70375 <https://github.com/llvm/llvm-project/issues/70375>`_)

Bug Fixes to Compiler Builtins
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
12 changes: 12 additions & 0 deletions clang/include/clang/Basic/Attr.td
Original file line number Diff line number Diff line change
Expand Up @@ -4313,3 +4313,15 @@ def PreferredType: InheritableAttr {
let Args = [TypeArgument<"Type", 1>];
let Documentation = [PreferredTypeDocumentation];
}

def CodeAlign: StmtAttr {
let Spellings = [Clang<"code_align">];
let Subjects = SubjectList<[ForStmt, CXXForRangeStmt, WhileStmt, DoStmt],
ErrorDiag, "'for', 'while', and 'do' statements">;
let Args = [ExprArgument<"Alignment">];
let Documentation = [CodeAlignAttrDocs];
let AdditionalMembers = [{
static constexpr int MinimumAlignment = 1;
static constexpr int MaximumAlignment = 4096;
}];
}
41 changes: 41 additions & 0 deletions clang/include/clang/Basic/AttrDocs.td
Original file line number Diff line number Diff line change
Expand Up @@ -7540,3 +7540,44 @@ Note: ``a_promise_type::get_return_object`` is exempted from this analysis as it
implementation detail of any coroutine library.
}];
}

def CodeAlignAttrDocs : Documentation {
let Category = DocCatVariable;
let Heading = "clang::code_align";
let Content = [{
The ``clang::code_align(N)`` attribute applies to a loop and specifies the byte
alignment for a loop. The attribute accepts a positive integer constant
initialization expression indicating the number of bytes for the minimum
alignment boundary. Its value must be a power of 2, between 1 and 4096
(inclusive).

.. code-block:: c++

void foo() {
int var = 0;
[[clang::code_align(16)]] for (int i = 0; i < 10; ++i) var++;
}

void Array(int *array, size_t n) {
[[clang::code_align(64)]] for (int i = 0; i < n; ++i) array[i] = 0;
}

void count () {
int a1[10], int i = 0;
[[clang::code_align(32)]] while (i < 10) { a1[i] += 3; }
}

void check() {
int a = 10;
[[clang::code_align(8)]] do {
a = a + 1;
} while (a < 20);
}

template<int A>
void func() {
[[clang::code_align(A)]] for(;;) { }
}

}];
}
6 changes: 6 additions & 0 deletions clang/include/clang/Basic/DiagnosticParseKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ def note_missing_selector_name : Note<
def note_force_empty_selector_name : Note<
"or insert whitespace before ':' to use %0 as parameter name "
"and have an empty entry in the selector">;
def ext_c_label_followed_by_declaration : ExtWarn<
"label followed by a declaration is a C23 extension">,
InGroup<C23>;
def warn_c23_compat_label_followed_by_declaration : Warning<
"label followed by a declaration is incompatible with C standards before "
"C23">, InGroup<CPre23Compat>, DefaultIgnore;
def ext_c_label_end_of_compound_statement : ExtWarn<
"label at end of compound statement is a C23 extension">,
InGroup<C23>;
Expand Down
7 changes: 6 additions & 1 deletion clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -10025,6 +10025,11 @@ def err_duplicate_case_differing_expr : Error<
def warn_case_empty_range : Warning<"empty case range specified">;
def warn_missing_case_for_condition :
Warning<"no case matching constant switch condition '%0'">;
def err_loop_attr_conflict : Error<
"conflicting loop attribute %0">;
def err_attribute_power_of_two_in_range : Error<
"%0 attribute requires an integer argument which is a constant power of two "
"between %1 and %2 inclusive; provided argument was %3">;

def warn_def_missing_case : Warning<"%plural{"
"1:enumeration value %1 not explicitly handled in switch|"
Expand Down Expand Up @@ -11592,7 +11597,7 @@ def err_coro_invalid_addr_of_label : Error<
"the GNU address of label extension is not allowed in coroutines."
>;
def err_coroutine_return_type : Error<
"function returns a type %0 makred with [[clang::coro_return_type]] but is neither a coroutine nor a coroutine wrapper; "
"function returns a type %0 marked with [[clang::coro_return_type]] but is neither a coroutine nor a coroutine wrapper; "
"non-coroutines should be marked with [[clang::coro_wrapper]] to allow returning coroutine return type"
>;
} // end of coroutines issue category
Expand Down
Loading

0 comments on commit a57f122

Please sign in to comment.