Skip to content

Commit

Permalink
Merge branch 'release/18.x' into 18rc_docs_clang
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronBallman authored Feb 26, 2024
2 parents d3ae598 + 95b6a7f commit 8018de3
Show file tree
Hide file tree
Showing 21 changed files with 255 additions and 18 deletions.
1 change: 1 addition & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,7 @@ RISC-V Support
for RV64.

- ``__attribute__((rvv_vector_bits(N)))`` is now supported for RVV vbool*_t types.
- ``-mtls-dialect=desc`` is now supported to enable TLS descriptors (TLSDESC).

CUDA/HIP Language Changes
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 2 additions & 0 deletions libcxx/docs/ReleaseNotes/18.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ Improvements and New Features
``${PREFIX}/share/libc++/v1``.

- AddressSanitizer annotations have been added to ``std::basic_string``.
These annotations are enabled for all allocators by default.
It's only enabled for long strings, strings using the small buffer optimization are not annotated.

- The libc++ source code has been formatted with ``clang-format``. This
`discourse thread <https://discourse.llvm.org/t/rfc-clang-formatting-all-of-libc-once-and-for-all>`_
Expand Down
8 changes: 7 additions & 1 deletion libcxx/include/csetjmp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ void longjmp(jmp_buf env, int val);
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>

#include <setjmp.h>
// <setjmp.h> is not provided by libc++
#if __has_include(<setjmp.h>)
# include <setjmp.h>
# ifdef _LIBCPP_SETJMP_H
# error "If libc++ starts defining <setjmp.h>, the __has_include check should move to libc++'s <setjmp.h>"
# endif
#endif

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
4 changes: 4 additions & 0 deletions llvm/docs/CommandGuide/llvm-objcopy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,10 @@ options. For GNU :program:`objcopy` compatibility, the values are all bfdnames.
- `elf64-tradlittlemips`
- `elf32-sparc`
- `elf32-sparcel`
- `elf32-hexagon`
- `elf32-loongarch`
- `elf64-loongarch`
- `elf64-s390`

Additionally, all targets except `binary` and `ihex` can have `-freebsd` as a
suffix.
Expand Down
5 changes: 5 additions & 0 deletions llvm/docs/CommandGuide/llvm-readelf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ OPTIONS
Display the contents of the basic block address map section(s), which contain the
address of each function, along with the relative offset of each basic block.

.. option:: --decompress, -z

Dump decompressed section content when used with ``-x`` or ``-p``.
If the section(s) are not compressed, they are displayed as is.

.. option:: --demangle, -C

Display demangled symbol names in the output.
Expand Down
5 changes: 5 additions & 0 deletions llvm/docs/CommandGuide/llvm-readobj.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ file formats.

Display the address-significance table.

.. option:: --decompress, -z

Dump decompressed section content when used with ``-x`` or ``-p``.
If the section(s) are not compressed, they are displayed as is.

.. option:: --expand-relocs

When used with :option:`--relocs`, display each relocation in an expanded
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Analysis/Loads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ bool llvm::isSafeToLoadUnconditionally(Value *V, Align Alignment, APInt &Size,

if (Size.getBitWidth() > 64)
return false;
const uint64_t LoadSize = Size.getZExtValue();
const TypeSize LoadSize = TypeSize::getFixed(Size.getZExtValue());

// Otherwise, be a little bit aggressive by scanning the local block where we
// want to check to see if the pointer is already being loaded or stored
Expand Down Expand Up @@ -414,11 +414,11 @@ bool llvm::isSafeToLoadUnconditionally(Value *V, Align Alignment, APInt &Size,

// Handle trivial cases.
if (AccessedPtr == V &&
LoadSize <= DL.getTypeStoreSize(AccessedTy))
TypeSize::isKnownLE(LoadSize, DL.getTypeStoreSize(AccessedTy)))
return true;

if (AreEquivalentAddressValues(AccessedPtr->stripPointerCasts(), V) &&
LoadSize <= DL.getTypeStoreSize(AccessedTy))
TypeSize::isKnownLE(LoadSize, DL.getTypeStoreSize(AccessedTy)))
return true;
}
return false;
Expand Down
19 changes: 19 additions & 0 deletions llvm/test/Transforms/VectorCombine/RISCV/load-widening.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
; RUN: opt < %s -passes=vector-combine -S -mtriple=riscv32 -mattr=+v | FileCheck %s
; RUN: opt < %s -passes=vector-combine -S -mtriple=riscv64 -mattr=+v | FileCheck %s

define void @fixed_load_scalable_src(ptr %p) {
; CHECK-LABEL: define void @fixed_load_scalable_src(
; CHECK-SAME: ptr [[P:%.*]]) #[[ATTR0:[0-9]+]] {
; CHECK-NEXT: entry:
; CHECK-NEXT: store <vscale x 4 x i16> zeroinitializer, ptr [[P]], align 8
; CHECK-NEXT: [[TMP0:%.*]] = load <4 x i16>, ptr [[P]], align 8
; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x i16> [[TMP0]], <4 x i16> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison>
; CHECK-NEXT: ret void
;
entry:
store <vscale x 4 x i16> zeroinitializer, ptr %p
%0 = load <4 x i16>, ptr %p
%1 = shufflevector <4 x i16> %0, <4 x i16> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 poison, i32 poison, i32 poison, i32 poison>
ret void
}
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-cov/mcdc-general-none.test
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
// Test html output.
// RUN: llvm-cov show --show-mcdc-summary --show-mcdc %S/Inputs/mcdc-general.o -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs %S/Inputs/mcdc-general.cpp -format html -o %t.html.dir
// RUN: FileCheck -check-prefix=HTML -input-file=%t.html.dir/coverage/tmp/mcdc-general.cpp.html %s
// HTML-COUNT-4: MC/DC Decision Region (<span class='line-number'><a name='L{{[0-9]+}}' href='#L{{[0-9]+}}'><span>
// HTML-COUNT-4: MC/DC Decision Region (<span class='line-number'><a href='#L{{[0-9]+}}'><span>

// RUN: FileCheck -check-prefix HTML-INDEX -input-file %t.html.dir/index.html %s
// HTML-INDEX-LABEL: <table>
Expand Down
2 changes: 1 addition & 1 deletion llvm/test/tools/llvm-cov/mcdc-general.test
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
// Test html output.
// RUN: llvm-cov show --show-mcdc-summary --show-mcdc %S/Inputs/mcdc-general.o -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs %S/Inputs/mcdc-general.cpp -format html -o %t.html.dir
// RUN: FileCheck -check-prefix=HTML -input-file=%t.html.dir/coverage/tmp/mcdc-general.cpp.html %s
// HTML-COUNT-4: MC/DC Decision Region (<span class='line-number'><a name='L{{[0-9]+}}' href='#L{{[0-9]+}}'><span>
// HTML-COUNT-4: MC/DC Decision Region (<span class='line-number'><a href='#L{{[0-9]+}}'><span>

// RUN: FileCheck -check-prefix HTML-INDEX -input-file %t.html.dir/index.html %s
// HTML-INDEX-LABEL: <table>
Expand Down
32 changes: 32 additions & 0 deletions llvm/test/tools/llvm-readobj/ELF/decompress-zlib-unsupported.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# UNSUPPORTED: zlib
# RUN: yaml2obj %s -o %t
# RUN: llvm-readobj -z -p .a -x .b %t 2>&1 | FileCheck %s -DFILE=%t

# CHECK: String dump of section '.a':
# CHECK-NEXT: warning: '[[FILE]]': LLVM was not built with LLVM_ENABLE_ZLIB or did not find zlib at build time
# CHECK-NEXT: [ 0] .
# CHECK-NEXT: [ 8] .
# CHECK-NEXT: [ 10] .
# CHECK-NEXT: [ 18] x.c.
# CHECK-NEXT: [ 1e] .
# CHECK-NEXT: [ 20] .
# CHECK-NEXT: Hex dump of section '.b':
# CHECK-NEXT: warning: '[[FILE]]': LLVM was not built with LLVM_ENABLE_ZLIB or did not find zlib at build time
# CHECK-NEXT: 0x00000000 01000000 00000000 01000000 00000000 ................
# CHECK-NEXT: 0x00000010 01000000 00000000 789c6304 00000200 ........x.c.....
# CHECK-NEXT: 0x00000020 02 .

--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Sections:
- Name: .a
Type: SHT_PROGBITS
Flags: [SHF_COMPRESSED]
Content: 010000000000000001000000000000000100000000000000789c63040000020002
- Name: .b
Type: SHT_PROGBITS
Flags: [SHF_COMPRESSED]
Content: 010000000000000001000000000000000100000000000000789c63040000020002
76 changes: 76 additions & 0 deletions llvm/test/tools/llvm-readobj/ELF/decompress-zlib.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# REQUIRES: zlib
## Test --decompress/-z.

# RUN: yaml2obj %s -o %t

# RUN: llvm-readelf -z -x .strings -x .not_null_terminated %t | FileCheck %s --check-prefix=HEX
# RUN: llvm-readobj --decompress -p .strings -p .not_null_terminated %t | FileCheck %s --check-prefix=STR

# HEX: Hex dump of section '.strings':
# HEX-NEXT: 0x00000000 68657265 00617265 00736f6d 65007374 here.are.some.st
# HEX-NEXT: 0x00000010 72696e67 7300 rings.
# HEX: Hex dump of section '.not_null_terminated':
# HEX-NEXT: 0x00000000 6e6f006e 756c6c no.null

# STR: String dump of section '.strings':
# STR-NEXT: [ 0] here
# STR-NEXT: [ 5] are
# STR-NEXT: [ 9] some
# STR-NEXT: [ e] strings
# STR-EMPTY:
# STR-NEXT: String dump of section '.not_null_terminated':
# STR-NEXT: [ 0] no
# STR-NEXT: [ 3] null{{$}}
# STR-NOT: {{.}}

# RUN: llvm-readobj -x .strings -p .not_null_terminated %t | FileCheck %s --check-prefix=COMPRESSED

# COMPRESSED: String dump of section '.not_null_terminated':
# COMPRESSED-NEXT: [ 0] no
# COMPRESSED-NEXT: [ 3] null
# COMPRESSED-NEXT: Hex dump of section '.strings':
# COMPRESSED-NEXT: 0x00000000 01000000 00000000 16000000 00000000 ................
# COMPRESSED-NEXT: 0x00000010 00000000 00000000 789ccb48 2d4a6548 ........x..H-JeH
# COMPRESSED-NEXT: 0x00000020 04e2e2fc 5c205152 9499975e cc000058 ....\ QR...^...X
# COMPRESSED-NEXT: 0x00000030 2e079b ...

# RUN: llvm-readelf -z -p .invalid1 -x .invalid2 -x .invalid3 %t 2>&1 | FileCheck %s -DFILE=%t --check-prefix=INVALID

# INVALID: String dump of section '.invalid1':
# INVALID-NEXT: warning: '[[FILE]]': corrupted compressed section header
# INVALID-NEXT: [ 0] .
# INVALID-NEXT: Hex dump of section '.invalid2':
# INVALID-NEXT: warning: '[[FILE]]': zlib error: Z_DATA_ERROR
# INVALID-NEXT: 0x00000000 01000000 00000000 16000000 00000000 ................
# INVALID-NEXT: 0x00000010 00000000 00000000 78 ........x
# INVALID-EMPTY:
# INVALID-NEXT: Hex dump of section '.invalid3':
# INVALID-NEXT: warning: '[[FILE]]': unsupported compression type (3)
# INVALID-NEXT: 0x00000000 03000000 00000000 04000000 00000000 ................
# INVALID-NEXT: 0x00000010 00000000 00000000 789c6360 ........x.c`

--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Sections:
- Name: .strings
Type: SHT_PROGBITS
Flags: [SHF_COMPRESSED]
Content: 010000000000000016000000000000000000000000000000789ccb482d4a654804e2e2fc5c2051529499975ecc0000582e079b
- Name: .not_null_terminated
Type: SHT_PROGBITS
Content: 6e6f006e756c6c
- Name: .invalid1
Type: SHT_PROGBITS
Flags: [SHF_COMPRESSED]
Content: 01
- Name: .invalid2
Type: SHT_PROGBITS
Flags: [SHF_COMPRESSED]
Content: 01000000000000001600000000000000000000000000000078
- Name: .invalid3
Type: SHT_PROGBITS
Flags: [SHF_COMPRESSED]
Content: 030000000000000004000000000000000000000000000000789c6360
31 changes: 31 additions & 0 deletions llvm/test/tools/llvm-readobj/ELF/decompress-zstd-unsupported.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# UNSUPPORTED: zstd
# RUN: yaml2obj %s -o %t
# RUN: llvm-readobj -z -p .a -x .b %t 2>&1 | FileCheck %s -DFILE=%t

# CHECK: String dump of section '.a':
# CHECK-NEXT: warning: '[[FILE]]': LLVM was not built with LLVM_ENABLE_ZSTD or did not find zstd at build time
# CHECK-NEXT: [ 0] .
# CHECK-NEXT: [ 8] .
# CHECK-NEXT: [ 10] .
# CHECK-NEXT: [ 18] (./. ..
# CHECK-NEXT: [ 21] .
# CHECK-NEXT: Hex dump of section '.b':
# CHECK-NEXT: warning: '[[FILE]]': LLVM was not built with LLVM_ENABLE_ZSTD or did not find zstd at build time
# CHECK-NEXT: 0x00000000 02000000 00000000 01000000 00000000 ................
# CHECK-NEXT: 0x00000010 01000000 00000000 28b52ffd 20010900 ........(./. ...
# CHECK-NEXT: 0x00000020 0001 ..

--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Sections:
- Name: .a
Type: SHT_PROGBITS
Flags: [SHF_COMPRESSED]
Content: 02000000000000000100000000000000010000000000000028b52ffd200109000001
- Name: .b
Type: SHT_PROGBITS
Flags: [SHF_COMPRESSED]
Content: 02000000000000000100000000000000010000000000000028b52ffd200109000001
28 changes: 28 additions & 0 deletions llvm/test/tools/llvm-readobj/ELF/decompress-zstd.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# REQUIRES: zstd
## Test --decompress/-z for zstd.

# RUN: yaml2obj %s -o %t

# RUN: llvm-readelf -z -x .strings %t | FileCheck %s --check-prefix=HEX
# RUN: llvm-readobj --decompress -p .strings %t | FileCheck %s --check-prefix=STR

# HEX: Hex dump of section '.strings':
# HEX-NEXT: 0x00000000 68657265 00617265 00736f6d 65007374 here.are.some.st
# HEX-NEXT: 0x00000010 72696e67 7300 rings.

# STR: String dump of section '.strings':
# STR-NEXT: [ 0] here
# STR-NEXT: [ 5] are
# STR-NEXT: [ 9] some
# STR-NEXT: [ e] strings

--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Sections:
- Name: .strings
Type: SHT_PROGBITS
Flags: [SHF_COMPRESSED]
Content: 02000000000000001600000000000000000000000000000028b52ffd2016b10000686572650061726500736f6d6500737472696e677300
2 changes: 1 addition & 1 deletion llvm/tools/llvm-cov/SourceCoverageView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ bool SourceCoverageView::shouldRenderRegionMarkers(

bool SourceCoverageView::hasSubViews() const {
return !ExpansionSubViews.empty() || !InstantiationSubViews.empty() ||
!BranchSubViews.empty();
!BranchSubViews.empty() || !MCDCSubViews.empty();
}

std::unique_ptr<SourceCoverageView>
Expand Down
9 changes: 5 additions & 4 deletions llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ tr:hover {
tr:last-child {
border-bottom: none;
}
tr:has(> td >a:target) > td.code > pre {
background-color: #ffa;
}
)";

const char *EndHeader = "</head>";
Expand Down Expand Up @@ -990,15 +993,13 @@ void SourceCoverageViewHTML::renderMCDCView(raw_ostream &OS, MCDCView &MRV,
std::string ColNoStr = Twine(DecisionRegion.ColumnStart).str();
std::string TargetName = "L" + LineNoStr;
OS << tag("span",
a("#" + TargetName, tag("span", LineNoStr + ":" + ColNoStr),
TargetName),
a("#" + TargetName, tag("span", LineNoStr + ":" + ColNoStr)),
"line-number") +
") to (";
LineNoStr = utostr(uint64_t(DecisionRegion.LineEnd));
ColNoStr = utostr(uint64_t(DecisionRegion.ColumnEnd));
OS << tag("span",
a("#" + TargetName, tag("span", LineNoStr + ":" + ColNoStr),
TargetName),
a("#" + TargetName, tag("span", LineNoStr + ":" + ColNoStr)),
"line-number") +
")\n\n";

Expand Down
3 changes: 2 additions & 1 deletion llvm/tools/llvm-cov/SourceCoverageViewText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ void SourceCoverageViewText::renderMCDCView(raw_ostream &OS, MCDCView &MRV,
colored_ostream(OS, raw_ostream::RED,
getOptions().Colors && Record.getPercentCovered() < 100.0,
/*Bold=*/false, /*BG=*/true)
<< format("%0.2f", Record.getPercentCovered()) << "%\n";
<< format("%0.2f", Record.getPercentCovered()) << "%";
OS << "\n";
renderLinePrefix(OS, ViewDepth);
OS << "\n";
}
Expand Down
Loading

0 comments on commit 8018de3

Please sign in to comment.