SuccessChanges

Summary

  1. [Sema][AArch64] Support arm_sve_vector_bits attribute (details)
  2. [NFC][DebugInfo] Create InstructionOrdering helper class (1/4) (details)
  3. [DwarfDebug] Improve single location detection in validThroughout (2/4) (details)
  4. [DwarfDebug] Improve multi-BB single location detection in validThroughout (3/4) (details)
  5. [DwarfDebug] Improve validThroughout performance (4/4) (details)
  6. Revert "[DWARF] Add cuttoff guarding quadratic validThroughout behaviour" (details)
  7. [ELF][test] Add test coverage of TLS to gc-sections.s (details)
  8. [NFC][compiler-rt] Factor out __mulv[sdt]i3 implementations to .inc file (details)
  9. [NFC][compiler-rt] Factor out __mulo[sdt]i4 implementations to .inc file (details)
  10. [DSE,MemorySSA] Remove short-cut to check if all paths are covered. (details)
  11. Fix for PS4 bots after 0b7f6cc71a72a85f8a0cbee836a7a8e31876951a (details)
  12. [LLD] [MinGW] Enable dynamicbase by default (details)
  13. [LLD] [COFF] Check the aux section definition size for IMAGE_COMDAT_SELECT_SAME_SIZE (details)
  14. [FPEnv] Allow fneg + strict_fadd -> strict_fsub in DAGCombiner (details)
  15. [AMDGPU] Remove unused variable introduced in r251860 (details)
  16. [CMake][compiler-rt][libunwind] Compile assembly files as ASM not C, unify workarounds (details)
  17. [SyntaxTree][NFC] Append "get" to syntax Nodes accessor names (details)
  18. [SyntaxTree][NFC][Style] Functions start with lowercase (details)
Commit feed5a7239d8ed0ec9f90775080ce8546bf364df by cullen.rhodes
[Sema][AArch64] Support arm_sve_vector_bits attribute

This patch implements the semantics for the 'arm_sve_vector_bits' type
attribute, defined by the Arm C Language Extensions (ACLE) for SVE [1].
The purpose of this attribute is to define vector-length-specific (VLS)
versions of existing vector-length-agnostic (VLA) types.

The semantics were already implemented by D83551, although the
implementation approach has since changed to represent VLSTs as
VectorType in the AST and fixed-length vectors in the IR everywhere
except in function args/returns. This is described in the prototype
patch D85128 demonstrating the new approach.

The semantic changes added in D83551 are changed since the
AttributedType is replaced by VectorType in the AST. Minimal changes
were necessary in the previous patch as the canonical type for both VLA
and VLS was the same (i.e. sizeless), except in constructs such as
globals and structs where sizeless types are unsupported. This patch
reverts the changes that permitted VLS types that were represented as
sizeless types in such circumstances, and adds support for implicit
casting between VLA <-> VLS types as described in section 3.7.3.2 of the
ACLE.

Since the SVE builtin types for bool and uint8 are both represented as
BuiltinType::UChar in VLSTs, two new vector kinds are implemented to
distinguish predicate and data vectors.

[1] https://developer.arm.com/documentation/100987/latest

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D85736
The file was modifiedclang/include/clang/Sema/Overload.h
The file was modifiedclang/lib/AST/JSONNodeDumper.cpp
The file was modifiedclang/include/clang/AST/ASTContext.h
The file was modifiedclang/lib/Sema/SemaOverload.cpp
The file was modifiedclang/test/Sema/attr-arm-sve-vector-bits.c
The file was addedclang/test/SemaCXX/attr-arm-sve-vector-bits.cpp
The file was modifiedclang/include/clang/AST/Type.h
The file was modifiedclang/lib/AST/Type.cpp
The file was modifiedclang/lib/AST/TypePrinter.cpp
The file was modifiedclang/lib/Sema/SemaDecl.cpp
The file was modifiedclang/lib/Sema/SemaType.cpp
The file was modifiedclang/include/clang/Basic/Attr.td
The file was modifiedclang/lib/AST/TextNodeDumper.cpp
The file was modifiedclang/lib/Sema/SemaExpr.cpp
The file was modifiedclang/lib/Sema/SemaExprCXX.cpp
The file was modifiedclang/include/clang/Basic/DiagnosticSemaKinds.td
The file was modifiedclang/include/clang/Sema/Sema.h
The file was modifiedclang/lib/AST/ASTContext.cpp
Commit e048ea7b1a05793df86b931b43faeacf2ae7373d by orlando.hyams
[NFC][DebugInfo] Create InstructionOrdering helper class (1/4)

Group the map and methods used to query instruction ordering for trimVarLocs
(D82129) into a class. This will make it easier to reuse the functionality
upcoming patches.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D86150
The file was modifiedllvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
Commit 0b5a8050ea39355a3876cc6bba9383d91e224e1f by orlando.hyams
[DwarfDebug] Improve single location detection in validThroughout (2/4)

With this patch we're now accounting for two more cases which should be
considered 'valid throughout': First, where RangeEnd is ScopeEnd. Second, where
RangeEnd comes before ScopeEnd when including meta instructions, but are both
preceded by the same non-meta instruction.

CTMark shows a geomean binary size reduction of 1.5% for RelWithDebInfo builds.
`llvm-locstats` (using D85636) shows a very small variable location coverage
change in 2 of 10 binaries, but it is in the order of 10s of bytes which lines
up with my expectations.

I've added a test which checks both of these new cases. The first check in the
test isn't strictly necessary for this patch. But I'm not sure that it is
explicitly tested anywhere else, and is useful for the final patch in the
series.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D86151
The file was modifiedllvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp
The file was addedllvm/test/DebugInfo/X86/single-location-2.mir
The file was modifiedllvm/test/DebugInfo/X86/trim-var-locs.mir
The file was modifiedllvm/include/llvm/CodeGen/DebugHandlerBase.h
The file was modifiedllvm/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp
The file was modifiedllvm/include/llvm/CodeGen/DbgEntityHistoryCalculator.h
The file was modifiedllvm/test/DebugInfo/MIR/AArch64/implicit-def-dead-scope.mir
The file was modifiedllvm/test/DebugInfo/MIR/X86/callsite-stack-value.mir
The file was modifiedllvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Commit 3c491881d2aedf8d305e6ebb6db135ed19cee3a0 by orlando.hyams
[DwarfDebug] Improve multi-BB single location detection in validThroughout (3/4)

With the changes introduced in D86151 we can now check for single locations
which span multiple blocks for inlined scopes and blocks.

D86151 introduced the InstructionOrdering parameter, replacing a scan through
MBB instructions. The functionality to compare instruction positions across
blocks was add there, and this patch just removes the exit checks that were
previously (but no longer) required.

CTMark shows a geomean binary size reduction of 2.2% for RelWithDebInfo builds.
llvm-locstats (using D85636) shows a very small variable location coverage
change in 5 of 10 binaries, but just like in D86151 it is only in the order of
10s of bytes.

Reviewed By: djtodoro

Differential Revision: https://reviews.llvm.org/D86152
The file was modifiedllvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
The file was addedllvm/test/DebugInfo/X86/location-range-inlined-xblock.mir
The file was modifiedllvm/test/DebugInfo/AArch64/inlined-argument.ll
Commit 57d8acac64b87cb4286b00485fb2da7521fc091e by orlando.hyams
[DwarfDebug] Improve validThroughout performance (4/4)

Almost NFC (see end).

The backwards scan in validThroughout significantly contributed to compile time
for a pathological case, causing the 'X86 Assembly Printer' pass to account for
roughly 70% of the run time. This patch guards the loop against running
unnecessarily, bringing the pass contribution down to 4%.

Almost NFC: There is a hack in validThroughout which promotes single constant
value DBG_VALUEs in the prologue to be live throughout the function. We're more
likely to hit this code path with this patch applied. Similarly to the parent
patches there is a small coverage change reported in the order of 10s of bytes.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D86153
The file was modifiedllvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
The file was modifiedllvm/test/DebugInfo/X86/inlined-formal-parameter.ll
Commit b6cca0ec05cfc48f59628f6c4c076756b839f4a2 by orlando.hyams
Revert "[DWARF] Add cuttoff guarding quadratic validThroughout behaviour"

This reverts commit b9d977b0ca60c54f11615ca9d144c9f08b29fd85.

This cutoff is no longer required. The commit 34ffa7fc501 (D86153) introduces a
performance improvement which was tested against the motivating case for this
patch.

Discussed in differential revision: https://reviews.llvm.org/D86153
The file was modifiedllvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
The file was removedllvm/test/DebugInfo/MIR/X86/singlelocation-cutoffs.mir
The file was modifiedllvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
Commit d4e2e2852affa5d49eeac37d47bd108ff7a5f181 by andrew.ng
[ELF][test] Add test coverage of TLS to gc-sections.s

Differential Revision: https://reviews.llvm.org/D86639
The file was modifiedlld/test/ELF/gc-sections.s
Commit 182d14db07f19e7a9cafc2d7218315bf65a55c0b by atrosinenko
[NFC][compiler-rt] Factor out __mulv[sdt]i3 implementations to .inc file

The existing implementations are almost identical except for width of the
integer type.

Factor them out to int_mulv_impl.inc for better maintainability.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D86277
The file was modifiedcompiler-rt/lib/builtins/mulvti3.c
The file was modifiedcompiler-rt/lib/builtins/mulvsi3.c
The file was addedcompiler-rt/lib/builtins/int_mulv_impl.inc
The file was modifiedcompiler-rt/lib/builtins/mulvdi3.c
Commit fce035eae980fd8f58a4f18ef95e2b2ee1f2bbcd by atrosinenko
[NFC][compiler-rt] Factor out __mulo[sdt]i4 implementations to .inc file

The existing implementations are almost identical except for width of the
integer type.

Factor them out to int_mulo_impl.inc for better maintainability.

This patch is almost identical to D86277.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D86289
The file was modifiedcompiler-rt/lib/builtins/muloti4.c
The file was modifiedcompiler-rt/lib/builtins/mulodi4.c
The file was addedcompiler-rt/lib/builtins/int_mulo_impl.inc
The file was modifiedcompiler-rt/lib/builtins/mulosi4.c
Commit bb024c3c4e03458ae30721cb5e9cf9832dba56d7 by flo
[DSE,MemorySSA] Remove short-cut to check if all paths are covered.

The post-order number early continue does not work in some cases, e.g.
if a path from EarlierAccess to an exit includes a node that dominates
EarlierAccess in a cycle.

The short-cut only has very minor impact on compile-time, so it seems
straight-forward to remove it for now:

http://llvm-compile-time-tracker.com/compare.php?from=062412e79fcfedf2cf004433e42036b0333e3f83&to=d7386016a77ce1387bdbbf360f1de157faea9d31&stat=instructions

Fixes PR47285.
The file was modifiedllvm/test/Transforms/DeadStoreElimination/MSSA/pr47285-not-overwritten-on-all-exit-paths.ll
The file was modifiedllvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
Commit c17718e0ff2628a22323863077dc2e024634ccfc by russell.gallop
Fix for PS4 bots after 0b7f6cc71a72a85f8a0cbee836a7a8e31876951a
The file was modifiedllvm/test/MachineVerifier/test_g_memcpy.mir
The file was modifiedllvm/test/MachineVerifier/test_g_memset.mir
Commit e72403f96de7f1c681acd5968f72aa986412dfce by martin
[LLD] [MinGW] Enable dynamicbase by default

This matches lld-link's own default.

Add a new command line option --no-dynamicbase for disabling it.
(Unfortunately, GNU ld doesn't yet have a matching --no-dynamicbase
option, as that's the default there.)

Differential Revision: https://reviews.llvm.org/D86654
The file was modifiedlld/test/MinGW/driver.test
The file was modifiedlld/MinGW/Driver.cpp
The file was modifiedlld/MinGW/Options.td
Commit df8f3bf6266569545b0b80eccbd990fecb94b3ee by martin
[LLD] [COFF] Check the aux section definition size for IMAGE_COMDAT_SELECT_SAME_SIZE

Binutils generated sections seem to be padded to a multiple of 16 bytes,
but the aux section definition contains the original, unpadded section
length.

The size check used for IMAGE_COMDAT_SELECT_SAME_SIZE previously
only checked the size of the section itself. When checking the
currently processed object file against the previously chosen
comdat section, we easily have access to the aux section definition
of the currently processed section, but we have to iterate over the
symbols of the previously selected object file to find the section
definition of the previously picked section. (We don't want to
inflate SectionChunk to carry more data, for something that is only
needed in corner cases.) Only do this when the mingw flag is set.

This fixes statically linking clang-built C++ object files against
libstdc++ built with GCC, if the object files contain e.g. typeinfo.

Differential Revision: https://reviews.llvm.org/D86659
The file was modifiedlld/COFF/InputFiles.h
The file was modifiedlld/COFF/InputFiles.cpp
The file was addedlld/test/COFF/Inputs/comdat-llvm.yaml
The file was addedlld/test/COFF/comdat-gcc-compatibility-size.test
The file was addedlld/test/COFF/Inputs/comdat-binutils.yaml
Commit 0ec098e22ba9c882ea2a9885d5d5f5dc4e4073ed by kevin.neal
[FPEnv] Allow fneg + strict_fadd -> strict_fsub in DAGCombiner

This is the first of a set of DAGCombiner changes enabling strictfp
optimizations. I want to test to waters with this to make sure changes
like these are acceptable for the strictfp case- this particular change
should preserve exception ordering and result precision perfectly, and
many other possible changes appear to be able to as well.

Copied from regular fadd combines but modified to preserve ordering via
the chain, this change allows strict_fadd x, (fneg y) to become
struct_fsub x, y and strict_fadd (fneg x), y to become strict_fsub y, x.

Differential Revision: https://reviews.llvm.org/D85548
The file was addedllvm/test/CodeGen/X86/strict-fadd-combines.ll
The file was modifiedllvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
The file was modifiedllvm/test/CodeGen/AMDGPU/strict_fadd.f32.ll
Commit 45eeb8c2a937ee5179754d3d14e10e3425d2b538 by jay.foad
[AMDGPU] Remove unused variable introduced in r251860
The file was modifiedllvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
Commit 45344cf7ac5b848f77825ffa37b0cb3b69b9b07b by raul
[CMake][compiler-rt][libunwind] Compile assembly files as ASM not C, unify workarounds

It isn't very wise to pass an assembly file to the compiler and tell it to compile as a C file and hope that the compiler recognizes it as assembly instead.
Simply don't mark the file as C and CMake will recognize the rest.

This was attempted earlier in https://reviews.llvm.org/D85706, but reverted due to architecture issues on Apple.
Subsequent digging revealed a similar change was done earlier for libunwind in https://reviews.llvm.org/rGb780df052dd2b246a760d00e00f7de9ebdab9d09.
Afterwards workarounds were added for MinGW and Apple:
* https://reviews.llvm.org/rGb780df052dd2b246a760d00e00f7de9ebdab9d09
* https://reviews.llvm.org/rGd4ded05ba851304b26a437896bc3962ef56f62cb

The workarounds in libunwind and compiler-rt are unified and comments added pointing to each other.
The workaround is updated to only be used for MinGW for CMake versions before 3.17, which fixed the issue (https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4287).

Additionally fixed Clang not being passed as the assembly compiler for compiler-rt runtime build.

Example error:
[525/634] Building C object lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o
FAILED: lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o
/opt/tooling/drive/host/bin/clang --target=aarch64-linux-gnu -I/opt/tooling/drive/llvm/compiler-rt/lib/tsan/.. -isystem /opt/tooling/drive/toolchain/opt/drive/toolchain/include -x c -Wall -Wno-unused-parameter -fno-lto -fPIC -fno-builtin -fno-exceptions -fomit-frame-pointer -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -O3 -gline-tables-only -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -Wno-non-virtual-dtor -fPIE -fno-rtti -Wframe-larger-than=530 -Wglobal-constructors --sysroot=. -MD -MT lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o -MF lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o.d -o lib/tsan/CMakeFiles/clang_rt.tsan-aarch64.dir/rtl/tsan_rtl_aarch64.S.o -c /opt/tooling/drive/llvm/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S
/opt/tooling/drive/llvm/compiler-rt/lib/tsan/rtl/tsan_rtl_aarch64.S:29:1: error: expected identifier or '('
.section .text
^
1 error generated.

Differential Revision: https://reviews.llvm.org/D86308
The file was modifiedlibunwind/src/CMakeLists.txt
The file was modifiedclang/runtime/CMakeLists.txt
The file was modifiedcompiler-rt/cmake/Modules/AddCompilerRT.cmake
Commit fda3fa822cb6812c8db63f7cee4a8387e71e66ff by ecaldas
[SyntaxTree][NFC] Append "get" to syntax Nodes accessor names

Differential Revision: https://reviews.llvm.org/D86679
The file was modifiedclang/lib/Tooling/Syntax/Nodes.cpp
The file was modifiedclang/include/clang/Tooling/Syntax/Nodes.h
Commit ac87a0b5873cc14b23eeb25a0586b26cc5c2c33f by ecaldas
[SyntaxTree][NFC][Style] Functions start with lowercase

Differential Revision: https://reviews.llvm.org/D86682
The file was modifiedclang/lib/Tooling/Syntax/BuildTree.cpp