platform/upstream/llvm.git
2 years ago[Driver] Add CLANG_DEFAULT_PIE_ON_LINUX to emulate GCC --enable-default-pie
Fangrui Song [Tue, 14 Dec 2021 18:08:59 +0000 (10:08 -0800)]
[Driver] Add CLANG_DEFAULT_PIE_ON_LINUX to emulate GCC --enable-default-pie

In 2015-05, GCC added the configure option `--enable-default-pie`. When enabled,

* in the absence of -fno-pic/-fpie/-fpic (and their upper-case variants), -fPIE is the default.
* in the absence of -no-pie/-pie/-shared/-static/-static-pie, -pie is the default.

This has been adopted by all(?) major distros.

I think default PIE is the majority in the Linux world, but
--disable-default-pie users is not that uncommon because GCC upstream hasn't
switched the default yet (https://gcc.gnu.org/PR103398).

This patch add CLANG_DEFAULT_PIE_ON_LINUX which allows distros to use default PIE.
The option is justified as its adoption can be very high among Linux distros
to make Clang default match GCC, and is likely a future-new-default, at which
point we will remove CLANG_DEFAULT_PIE_ON_LINUX.
The lit feature `default-pie-on-linux` can be handy to exclude default PIE sensitive tests.

Reviewed By: foutrelis, sylvestre.ledru, thesamesam

Differential Revision: https://reviews.llvm.org/D113372

2 years ago[llvm] [Debuginfo] Add llvm-debuginfod-find tool and end-to-end-tests.
Noah Shutty [Tue, 14 Dec 2021 17:29:17 +0000 (17:29 +0000)]
[llvm] [Debuginfo] Add llvm-debuginfod-find tool and end-to-end-tests.

This implements the `llvm-debuginfod-find` tool, which wraps the Debuginfod library (D112758) to query debuginfod servers for artifacts according to the [[ https://www.mankier.com/8/debuginfod#Webapi | specification ]].

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D112759

2 years agoOnly define LLVM_EXTERNAL_VISIBILITY when building libLLVM dylib
Ben Langmuir [Fri, 10 Dec 2021 19:49:04 +0000 (11:49 -0800)]
Only define LLVM_EXTERNAL_VISIBILITY when building libLLVM dylib

When building LLVM static libraries, we should not make symbols more
visible than CMAKE_CXX_VISIBILITY_PRESET, since the goal may be to have
a purely hidden llvm embedded in another library. Instead, we only
define LLVM_EXTERNAL_VISIBILITY for the dynamic library build (when
LLVM_BUILD_LLVM_DYLIB=YES).

Differential Revision: https://reviews.llvm.org/D113610

2 years ago[RISCV] Add mayRaiseFPException to RISCV scalar FP instructions.
Craig Topper [Tue, 14 Dec 2021 17:32:58 +0000 (09:32 -0800)]
[RISCV] Add mayRaiseFPException to RISCV scalar FP instructions.

FRM dependency will be added in a future patch.

Reviewed By: arcbbb

Differential Revision: https://reviews.llvm.org/D115540

2 years ago[ELF] Remove needsPltAddr in favor of needsCopy
Fangrui Song [Tue, 14 Dec 2021 17:52:43 +0000 (09:52 -0800)]
[ELF] Remove needsPltAddr in favor of needsCopy

needsPltAddr is equivalent to `needsCopy && isFunc`. In many places, it is
equivalent to `needsCopy` because the non-STT_FUNC cases are ruled out.

Reviewed By: ikudrin, peter.smith

Differential Revision: https://reviews.llvm.org/D115603

2 years ago[RISCV] Add a table for extension implications.
Craig Topper [Tue, 14 Dec 2021 17:17:50 +0000 (09:17 -0800)]
[RISCV] Add a table for extension implications.

This a proof of concept for a suggestion I proposed in D108694.

Reviewed By: eopXD

Differential Revision: https://reviews.llvm.org/D115668

2 years ago[DebugInfo][dsymutil] Keep locations for function-local globals
Ellis Hoag [Tue, 14 Dec 2021 06:03:23 +0000 (22:03 -0800)]
[DebugInfo][dsymutil] Keep locations for function-local globals

In debug info, we expect variables to have location info if they are used and we don't want location info for functions that are not used. However, if an unused function is inlined, we could have the scenario where a function is not in the final binary but its static variable is in the final binary. Ensure that variables in the final binary have location debug info even if their scope was inlined.

Also add `--implicit-check-not` to a test for clarity.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D115565

2 years ago[gn build] Reland 5082c330138: (semimanually) port ebc31d2.
Kirill Stoimenov [Tue, 14 Dec 2021 17:17:57 +0000 (17:17 +0000)]
[gn build] Reland 5082c330138: (semimanually) port ebc31d2.

2 years agoRevert "[lldb] Introduce a FreeBSDKernel plugin for vmcores"
Michał Górny [Tue, 14 Dec 2021 17:17:32 +0000 (18:17 +0100)]
Revert "[lldb] Introduce a FreeBSDKernel plugin for vmcores"

This reverts commit aedb328a4dc9cb48ee3cf3198281649ea2c4f532.
I have failed to make the new tests conditional to the presence
of libfbsdvmcore.

2 years ago[RISCV] Convert (splat_vector (load)) to vlse with 0 stride.
Craig Topper [Tue, 14 Dec 2021 16:58:16 +0000 (08:58 -0800)]
[RISCV] Convert (splat_vector (load)) to vlse with 0 stride.

We already do this for splat nodes that carry a VL, but not for
splats that use VLMAX.

Reviewed By: frasercrmck

Differential Revision: https://reviews.llvm.org/D115483

2 years ago[lldb] Introduce a FreeBSDKernel plugin for vmcores
Michał Górny [Wed, 1 Dec 2021 22:04:59 +0000 (23:04 +0100)]
[lldb] Introduce a FreeBSDKernel plugin for vmcores

Introduce a FreeBSDKernel plugin that provides the ability to read
FreeBSD kernel core dumps.  The plugin utilizes libfbsdvmcore to provide
support for both "full memory dump" and minidump formats across variety
of architectures supported by FreeBSD.  It provides the ability to read
kernel memory, as well as the crashed thread status with registers
on arm64, i386 and x86_64.

Differential Revision: https://reviews.llvm.org/D114911

2 years agoDisable issue labeler in LLVM forks
Alexander Batashev [Tue, 14 Dec 2021 17:01:52 +0000 (20:01 +0300)]
Disable issue labeler in LLVM forks

LLVM forks may use GitHub Actions as well as the upstream projects,
but they do not necessarily follow the same development processes.
Disable automatic issue labeling for forks, so that it does not
interfere with downstream repo automation.

Reviewed By: tstellar

Differential Revision: https://reviews.llvm.org/D115708

2 years ago[LoopUnroll] Disable loop unroll when user explicitly asks for unroll-and-jam
Zaara Syeda [Tue, 14 Dec 2021 16:45:43 +0000 (16:45 +0000)]
[LoopUnroll] Disable loop unroll when user explicitly asks for unroll-and-jam

If a loop isn't forced to be unrolled, we want to avoid unrolling it when there
is an explicit unroll-and-jam pragma. This is to prevent automatic unrolling
from interfering with the user requested transformation.

Differential Revision: https://reviews.llvm.org/D114886

2 years agoAdd FMF to hasPoisonGeneratingFlags/dropPoisonGeneratingFlags
Philip Reames [Tue, 14 Dec 2021 16:09:00 +0000 (08:09 -0800)]
Add FMF to hasPoisonGeneratingFlags/dropPoisonGeneratingFlags

These flags are documented as generating poison values for particular input values. As such, we should really be consistent about their handling with how we handle nsw/nuw/exact/inbounds.

Differential Revision: https://reviews.llvm.org/D115460

2 years ago[WebAssembly] Custom optimization for truncate
Jing Bao [Tue, 14 Dec 2021 16:42:38 +0000 (08:42 -0800)]
[WebAssembly] Custom optimization for truncate

When possible, optimize TRUNCATE to generate Wasm SIMD narrow
instructions (i16x8.narrow_i32x4_u, i8x16.narrow_i16x8_u), rather than generate
lots of extract_lane and replace_lane.

Closes #50350.

2 years ago[libc++] Remove C++ version guards in the dylib.
Mark de Wever [Mon, 13 Dec 2021 17:30:41 +0000 (18:30 +0100)]
[libc++] Remove C++ version guards in the dylib.

The library is always build using C++20 so these guards are not needed.

Reviewed By: #libc, Quuxplusone, ldionne

Differential Revision: https://reviews.llvm.org/D115644

2 years ago[mlir][sparse] fixed typos
Aart Bik [Mon, 13 Dec 2021 20:51:34 +0000 (12:51 -0800)]
[mlir][sparse] fixed typos

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D115667

2 years ago[mlir][sparse] speed up sparse tensor file I/O by more than 2x
Aart Bik [Tue, 14 Dec 2021 04:41:42 +0000 (20:41 -0800)]
[mlir][sparse] speed up sparse tensor file I/O by more than 2x

data point using the 3-dim tensor nell-2.tns

MLIR:
READ FILE INTO COO: 24424.369294 ms ---> improves to ----> 9638.501044 ms
SORT COO BEFORE PACK: 762.834831 ms
PACK COO TO TENSOR: 1243.376245 ms

TACO:
b file read: 13270.9 ms
b pack: 7137.74 ms
b size: (12092 x 9184 x 28818), 925300328 bytes

https://github.com/llvm/llvm-project/issues/52679

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D115696

2 years ago[InstCombine] prevent infinite looping from opposing cmp and select transforms (PR52684)
Sanjay Patel [Tue, 14 Dec 2021 15:46:25 +0000 (10:46 -0500)]
[InstCombine] prevent infinite looping from opposing cmp and select transforms (PR52684)

As noted in the code comment, we might want to simply give up on this select
transform completely (given how many exceptions there are already and the
risk of future conflicts), but for now, carve out one more bailout to
avoid an infinite loop.

Fixes #52684:
https://github.com/llvm/llvm-project/issues/52684

2 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Mon, 13 Dec 2021 20:41:32 +0000 (15:41 -0500)]
[InstCombine] regenerate test checks; NFC

2 years ago[InstCombine] convert static function to internal class function; NFC
Sanjay Patel [Mon, 13 Dec 2021 20:18:10 +0000 (15:18 -0500)]
[InstCombine] convert static function to internal class function; NFC

The transform can require an optional shuffle instruction to be sound,
so we need to use Builder to create all values and then replace the
original instruction with whatever that final value is.

2 years ago[benchmark] Delete BUILD files
Mircea Trofin [Tue, 14 Dec 2021 16:07:29 +0000 (08:07 -0800)]
[benchmark] Delete BUILD files

Bazel support is through utils/bazel, and the BUILD files in `benchmark`
just complicate downstream integrates for bazel based builds.

Differential Revision: https://reviews.llvm.org/D115733

2 years ago[libc++] Fix wrongly non-inline basic_string::shrink_to_fit
Louis Dionne [Mon, 13 Dec 2021 19:15:21 +0000 (14:15 -0500)]
[libc++] Fix wrongly non-inline basic_string::shrink_to_fit

As explained in https://stackoverflow.com/a/70339311/627587, the fact
that shrink_to_fit wasn't defined as inline lead to issues when explicitly
instantiating basic_string. While explicit instantiations are always
somewhat brittle, this one was clearly a bug on our end.

Differential Revision: https://reviews.llvm.org/D115656

2 years ago[AArch64] Convert sra(X, elt_size(X)-1) to cmlt(X, 0)
Alexandros Lamprineas [Tue, 14 Dec 2021 15:29:44 +0000 (15:29 +0000)]
[AArch64] Convert sra(X, elt_size(X)-1) to cmlt(X, 0)

CMLT has twice the execution throughput of SSHR on Arm out-of-order cores.

Differential Revision: https://reviews.llvm.org/D115457

2 years ago[lldb/python] Plug SBStructuredData leaks
Pavel Labath [Fri, 26 Nov 2021 08:46:31 +0000 (09:46 +0100)]
[lldb/python] Plug SBStructuredData leaks

This applies the from D114259 to the SBStructuredData class.

2 years ago[AArch64][SVE] Instcombine SDIV to ASRD
Matt Devereau [Thu, 9 Dec 2021 15:32:35 +0000 (15:32 +0000)]
[AArch64][SVE] Instcombine SDIV to ASRD

Instcombine SDIV to ASRD when the third operand of SDIV is a power of 2

Differential Revision: https://reviews.llvm.org/D115448

2 years ago[ASan] Shared optimized callbacks implementation.
Kirill Stoimenov [Tue, 14 Dec 2021 01:02:03 +0000 (01:02 +0000)]
[ASan] Shared optimized callbacks implementation.

This change moves optimized callbacks from each .o file to compiler-rt. Instead of using code generation it uses direct assembly implementation. Please note that the 'or' version is not implemented and it will produce unresolved external if somehow 'or' version is requested.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D114558

2 years agoTest commit
Zaara Syeda [Tue, 14 Dec 2021 15:36:17 +0000 (15:36 +0000)]
Test commit

2 years ago[X86] combineOr - don't demand operand elements if the other operand element is ...
Simon Pilgrim [Tue, 14 Dec 2021 14:52:38 +0000 (14:52 +0000)]
[X86] combineOr - don't demand operand elements if the other operand element is 'allones'

If either operand has an element with allbits set, then we don't need the equivalent element from the other operand, as allbits are guaranteed to be set.

2 years ago[X86] combineOr - pull out repeated SDLoc(). NFCI.
Simon Pilgrim [Mon, 13 Dec 2021 22:16:46 +0000 (22:16 +0000)]
[X86] combineOr - pull out repeated SDLoc(). NFCI.

2 years ago[SLP][NFC]Update test checks, NFC.
Alexey Bataev [Tue, 14 Dec 2021 15:34:37 +0000 (07:34 -0800)]
[SLP][NFC]Update test checks, NFC.

2 years ago[AMDGPU] Regenerate checks in high-bits-zeroed-16-bit-ops.mir
Jay Foad [Tue, 14 Dec 2021 15:16:36 +0000 (15:16 +0000)]
[AMDGPU] Regenerate checks in high-bits-zeroed-16-bit-ops.mir

2 years ago[AArch64][SVE] Replace mask pointers in fixed-length-fp-vselect test
Matt Devereau [Mon, 13 Dec 2021 17:09:39 +0000 (17:09 +0000)]
[AArch64][SVE] Replace mask pointers in fixed-length-fp-vselect test

Replace mask pointer parameters with fcmp for better quality codegen

Differential Revision: https://reviews.llvm.org/D115641

2 years ago[clang-format] add support for cppm files
mydeveloperday [Tue, 14 Dec 2021 14:55:38 +0000 (14:55 +0000)]
[clang-format] add support for cppm files

C++20 Modules current style is to assign a new file suffix .cppm.

https://github.com/llvm/llvm-project/issues/52658

Ensure git-clang-format can handle that as a default extension

Reviewed By: ChuanqiXu, HazardyKnusperkeks, curdeius

Differential Revision: https://reviews.llvm.org/D115625

Fixes: #52658

2 years ago[clang-format] FixNamespaceComments does not understand namespace aliases
mydeveloperday [Tue, 14 Dec 2021 14:45:26 +0000 (14:45 +0000)]
[clang-format] FixNamespaceComments does not understand namespace aliases

https://github.com/llvm/llvm-project/issues/35876

Ensure a namespace alias doesn't get incorrectly identifier as a namespace

Reviewed By: HazardyKnusperkeks, curdeius, owenpan

Differential Revision: https://reviews.llvm.org/D115647

Fixes: #35876

2 years agoRevert "[MemoryLocation] Handle memset_pattern{4,8,16} in getForDest."
Florian Hahn [Tue, 14 Dec 2021 14:48:47 +0000 (14:48 +0000)]
Revert "[MemoryLocation] Handle memset_pattern{4,8,16} in getForDest."

This reverts commit ac60263ad173dbd2eba6e0c8d892d8c3dcc5306c.

It looks like the test fails on certain non-Darwin system, even though
the triple is explicitly set to macos. Revert while I investigate.

2 years ago[InlineAdvisor] Add option to control deferred inlining (NFC)
Nikita Popov [Tue, 14 Dec 2021 14:42:33 +0000 (15:42 +0100)]
[InlineAdvisor] Add option to control deferred inlining (NFC)

This change is split out from D115497 to add the option
independently from the switch of the default value.

2 years ago[LangRef] Remove incorrect vector alignment rules
Fraser Cormack [Mon, 25 Oct 2021 14:47:50 +0000 (15:47 +0100)]
[LangRef] Remove incorrect vector alignment rules

The LangRef incorrectly says that if no exact match is found when
seeking alignment for a vector type, the largest vector type smaller
than the sought-after vector type. This is incorrect as vector types
require an exact match, else they fall back to reporting the natural
alignment.

The corrected rule was not added in its place, as rules for other types
(e.g., floating-point types) aren't documented.

A unit test was added to demonstrate this.

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D112463

2 years ago[libc++] Make __swap_allocator constexpr
Nikolas Klauser [Tue, 14 Dec 2021 11:59:11 +0000 (12:59 +0100)]
[libc++] Make __swap_allocator constexpr

Make `__swap_allocator` constexpr

Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D115719

2 years ago[MemoryLocation] Handle memset_pattern{4,8,16} in getForDest.
Florian Hahn [Tue, 14 Dec 2021 14:41:28 +0000 (14:41 +0000)]
[MemoryLocation] Handle memset_pattern{4,8,16} in getForDest.

memset_pattern{4,8,16} writes to the first argument. Use getForDest
to return the corresponding MemoryLocation.

Reviewed By: ab

Differential Revision: https://reviews.llvm.org/D114906

2 years ago[libc++] Make __compressed_pair fully constexpr
Nikolas Klauser [Tue, 14 Dec 2021 01:11:09 +0000 (02:11 +0100)]
[libc++] Make __compressed_pair fully constexpr

Make `__compressed_pair` fully constexpr

Reviewed By: ldionne, #libc, nilayvaish

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D115687

2 years ago[llvm-objcopy] Fix handling of MIPS64 little endian files
Simon Atanasyan [Mon, 13 Dec 2021 14:53:30 +0000 (17:53 +0300)]
[llvm-objcopy] Fix handling of MIPS64 little endian files

MIPS64 little endian target has a "special" encoding of `r_info`
relocation record field. Instead of one 64-bit little endian number, it
is a little endian 32-bit number followed by a 32-bit big endian number.
For correct reading and writing such fields we must provide information
about target machine into the corresponding routine. This patch does
this for the `llvm-objcopy` tool and fix handling of MIPS64 little
endian files.

The bug was reported in the issue #52647.

Differential Revision: https://reviews.llvm.org/D115635

2 years ago[SLP]Improve multinode analysis.
Alexey Bataev [Tue, 6 Apr 2021 15:35:52 +0000 (08:35 -0700)]
[SLP]Improve multinode analysis.

Changes the preliminary multinode analysis:
1. Introduced scores for reversed loads/extractelements.
2. Improved shallow score calculation.
3. Lowered the cost of external uses (no need to consider it several times, just ones).
4. The initial lane for analysis is the one with the minimal possible
   reorderings.

These changes in general shall reduce compile time and improve the
reordering in many cases.

Part of D57059.

Differential Revision: https://reviews.llvm.org/D101109

2 years ago[Flang][NFC] Convert static to static inline for a function
Kiran Chandramohan [Tue, 14 Dec 2021 13:21:26 +0000 (13:21 +0000)]
[Flang][NFC] Convert static to static inline for a function

Reviewed By: clementval

Differential Revision: https://reviews.llvm.org/D115619

2 years agoRevert unnecessary and incorrect change made to GraphWriter
Jamie Schmeiser [Tue, 14 Dec 2021 13:42:35 +0000 (08:42 -0500)]
Revert unnecessary and incorrect change made to GraphWriter

Summary:
As pointed out in https://github.com/llvm/llvm-project/issues/52610, the
changes to GraphWriter made in https://reviews.llvm.org/D87202 introduced
some bad code and the changes are actually unnecessary for
-print-changed=dot-cfg. The code in question is guarded by a call to
DefaultDOTGraphTraits::hasEdgeDestLabels() which is always false when the
graph writer is called for -print-changed=dot-cfg. Revert this section of
the changes.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By:jrtc27(Jessica Clarke), xgupta(Shivam Gupta)
Differential Revision: https://reviews.llvm.org/D115649

2 years ago[IR] Make VPIntrinsic::getDeclarationForParams() opaque pointer compatible
Nikita Popov [Mon, 13 Dec 2021 14:30:55 +0000 (15:30 +0100)]
[IR] Make VPIntrinsic::getDeclarationForParams() opaque pointer compatible

The vp.load and vp.gather intrinsics require the intrinsic return
type to determine the correct function signature. With opaque pointers,
it cannot be derived from the parameter pointee types.

Differential Revision: https://reviews.llvm.org/D115632

2 years ago[OpenMPIRBuilder] Support opaque pointers in reduction handling
Nikita Popov [Mon, 13 Dec 2021 15:23:15 +0000 (16:23 +0100)]
[OpenMPIRBuilder] Support opaque pointers in reduction handling

Make the reduction handling in OpenMPIRBuilder compatible with
opaque pointers by explicitly storing the element type in ReductionInfo,
and also passing it to the atomic reduction callback, as at least
the ones in the test need the type there.

This doesn't make things fully compatible yet, there are other
uses of element types in this class. I also left one
getPointerElementType() call in mlir, because I'm not familiar
with that area.

Differential Revison: https://reviews.llvm.org/D115638

2 years ago[ARM] Add AddrModeT2_i8neg addressing mode support for frame lowering.
David Green [Tue, 14 Dec 2021 12:49:27 +0000 (12:49 +0000)]
[ARM] Add AddrModeT2_i8neg addressing mode support for frame lowering.

As reported from a failing firefox build, we can sometimes get frame
indices with negative offsets from a t2LDRi8. This adds support for
them, to prevent the crash.

2 years ago[mlir][linalg][bufferize] Debug output as IR attributes
Matthias Springer [Tue, 14 Dec 2021 12:21:15 +0000 (21:21 +0900)]
[mlir][linalg][bufferize] Debug output as IR attributes

Instead of printing analysis debug information to stderr, annotate the IR. This makes it easier to understand decisions made by the analysis, especially in larger input IR.

Differential Revision: https://reviews.llvm.org/D115575

2 years ago[VE] MUL,SUB,OR,XOR v256i32|64 isel
Simon Moll [Tue, 14 Dec 2021 12:23:34 +0000 (13:23 +0100)]
[VE] MUL,SUB,OR,XOR v256i32|64 isel

v256i32|i64 isel patterns and tests.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D115643

2 years ago[bazel] Port debuginfod rules
Benjamin Kramer [Tue, 14 Dec 2021 12:12:39 +0000 (13:12 +0100)]
[bazel] Port debuginfod rules

Needed after 34491ca7291c

2 years ago[AArch64] Add a tablegen pattern for UZP1.
Alexandros Lamprineas [Tue, 14 Dec 2021 11:28:22 +0000 (11:28 +0000)]
[AArch64] Add a tablegen pattern for UZP1.

Converts concat_vectors(V64 (trunc V128), V64 (trunc V128)), which
would otherwise be lowered as xtn followed by xtn2, to uzp1.

Differential Revision: https://reviews.llvm.org/D115435

2 years ago[libc++][NFC] Remove goto from std::string
Nikolas Klauser [Tue, 14 Dec 2021 00:20:53 +0000 (01:20 +0100)]
[libc++][NFC] Remove goto from std::string

Remove `goto` from `std::string`

Reviewed By: Quuxplusone, ldionne, #libc, nilayvaish

Spies: nilayvaish, libcxx-commits

Differential Revision: https://reviews.llvm.org/D115598

2 years ago[AArch64][SVE] Fix handling of stack protection with SVE
John Brawn [Tue, 14 Dec 2021 11:11:41 +0000 (11:11 +0000)]
[AArch64][SVE] Fix handling of stack protection with SVE

Fix a couple of things that were causing stack protection to not work
correctly in functions that have scalable vectors on the stack:
 * Use TypeSize when determining if accesses to a variable are
   considered out-of-bounds so that the behaviour is correct for
   scalable vectors.
 * When stack protection is enabled move the stack protector location
   to the top of the SVE locals, so that any overflow in them (or the
   other locals which are below that) will be detected.

Fixes: https://github.com/llvm/llvm-project/issues/51137

Differential Revision: https://reviews.llvm.org/D111631

2 years ago[CodeGen] Add std:: qualifier
Nikita Popov [Tue, 14 Dec 2021 11:17:55 +0000 (12:17 +0100)]
[CodeGen] Add std:: qualifier

Hopefully addresses the buildbot failures.

2 years ago[CodeGen] Require use of Address::invalid() for invalid address (NFC)
Nikita Popov [Mon, 13 Dec 2021 13:23:21 +0000 (14:23 +0100)]
[CodeGen] Require use of Address::invalid() for invalid address (NFC)

This no longer allows creating an invalid Address through the regular
constructor. There were only two places that did this (AggValueSlot
and EHCleanupScope) which did this by converting a potential nullptr
into an Address. I've fixed both of these by directly storing an
Address instead.

This is intended as a bit of preliminary cleanup for D103465.

Differential Revision: https://reviews.llvm.org/D115630

2 years ago[X86] Use bundle for CALL_RVMARKER expansion.
Florian Hahn [Tue, 14 Dec 2021 10:53:22 +0000 (10:53 +0000)]
[X86] Use bundle for CALL_RVMARKER expansion.

This patch updates expandCALL_RVMARKER to wrap the call, marker and
objc runtime call in an instruction bundle. This ensures later passes,
like machine block placement, cannot break them up.

On AArch64, the instruction sequence is already wrapped in a bundle.
Keeping the whole instruction sequence together is highly desirable for
performance and outweighs potential other benefits from breaking the
sequence up.

Reviewed By: ahatanak

Differential Revision: https://reviews.llvm.org/D115230

2 years ago[clang][deps] Remove hard-coded resource directory from tests
Jan Svoboda [Mon, 13 Dec 2021 12:22:08 +0000 (13:22 +0100)]
[clang][deps] Remove hard-coded resource directory from tests

Dependency scanner test for resource directory deduction doesn't account for LLVM builds with custom `CLANG_RESOURCE_DIR`.

This patch ensures we don't hardcode the default behavior into the test and take into account the actual value. This is done by running `%clang -print-resource-dir` and using that as the expected value in test assertions.
New comment also clarifies this is different from running that command as part of the dependency scan.

Reviewed By: mgorny

Differential Revision: https://reviews.llvm.org/D115628

2 years ago[mlir] Split std.rank into tensor.rank and memref.rank.
Alexander Belyaev [Tue, 14 Dec 2021 08:35:14 +0000 (09:35 +0100)]
[mlir] Split std.rank into tensor.rank and memref.rank.

Move `std.rank` similarly to how `std.dim` was moved to TensorOps and MemRefOps.

Differential Revision: https://reviews.llvm.org/D115665

2 years ago[mlir] Implement `DataLayoutTypeInterface` for `LLVMArrayType`
Markus Böck [Tue, 14 Dec 2021 07:52:02 +0000 (08:52 +0100)]
[mlir] Implement `DataLayoutTypeInterface` for `LLVMArrayType`

Implementation of the interface allows querying the size and alignments of an LLVMArrayType as well as query the size and alignment of a struct containing an LLVMArrayType.
The implementation should yield the same results as llvm::DataLayout, including support for over aligned element types.
There is no customization point for adjusting an arrays alignment; it is simply taken from the element type.

Differential Revision: https://reviews.llvm.org/D115704

2 years ago[OpenMP][libomp] Fix compile errors with new KMP_HW_SUBSET changes
Jonathan Peyton [Tue, 14 Dec 2021 07:32:22 +0000 (08:32 +0100)]
[OpenMP][libomp] Fix compile errors with new KMP_HW_SUBSET changes

Add missing guards around x86-specific code.

Reviewed By: kaz7

Differential Revision: https://reviews.llvm.org/D115664

2 years ago[llvm] Use llvm::reverse (NFC)
Kazu Hirata [Tue, 14 Dec 2021 05:54:51 +0000 (21:54 -0800)]
[llvm] Use llvm::reverse (NFC)

2 years ago[RISCV] Add rs2 encoding to the FPUnaryOp_r and FPUnaryOp_r_frm template arguments.
Craig Topper [Tue, 14 Dec 2021 05:38:40 +0000 (21:38 -0800)]
[RISCV] Add rs2 encoding to the FPUnaryOp_r and FPUnaryOp_r_frm template arguments.

Instead of having unary instruction include a 'let' in their class
body, add rs2val as a template parameter. Then we can use a let
in FPUnaryOp_r and FPUnaryOp_r_frm. This reduces the overall
verbosity of the FP files.

Reviewed By: achieveartificialintelligence

Differential Revision: https://reviews.llvm.org/D115537

2 years ago[RISCV] Support named opcodes in .insn directive.
Nelson Chu [Tue, 14 Dec 2021 04:59:02 +0000 (20:59 -0800)]
[RISCV] Support named opcodes in .insn directive.

This patch is one of the TODO of commit, 283879793dc787225992496587581ec77b6b0610

We build the GenericTable for these opcodes, and also extend class RISCVOpcode, to store the names of opcodes.  Then we call the parseInsnDirectiveOpcode to parse the opcode filed in .insn directive.  We only allow users to write the recognized opcode names, or just write the immediate values in the 7 bits range.

Documentation: https://sourceware.org/binutils/docs-2.37/as/RISC_002dV_002dFormats.html

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D115224

2 years agoReland [ELF] Split scanRelocations into scanRelocations/postScanRelocations
Fangrui Song [Tue, 14 Dec 2021 04:11:24 +0000 (20:11 -0800)]
Reland [ELF] Split scanRelocations into scanRelocations/postScanRelocations

(Fixed an issue about GOT on a copy relocated alias.)

The idea is to make scanRelocations mark some actions are needed (GOT/PLT/etc)
and postpone the real work to postScanRelocations. It gives some flexibility:

* Make it feasible to support .plt.got (PR32938): we need to know whether GLOB_DAT and JUMP_SLOT are both needed.
* Make non-preemptible IFUNC handling slightly cleaner: avoid setting/clearing sym.gotInIgot
* -z nocopyrel: report all copy relocation places for one symbol
* Make GOT deduplication feasible
* Make parallel relocation scanning feasible (if we can avoid all stateful operations and make Symbol attributes atomic), but parallelism may not be the appealing choice

Since this patch moves a large chunk of code out of ELFT templates. My x86-64
executable is actually a few hundred bytes smaller.

For ppc32-ifunc-nonpreemptible-pic.s: I remove absolute relocation references to non-preemptible ifunc
because absolute relocation references are incorrect in -fpie mode.

Reviewed By: peter.smith, ikudrin

Differential Revision: https://reviews.llvm.org/D114783

2 years ago[ELF] Improve test for copy relocations on aliases
Fangrui Song [Tue, 14 Dec 2021 04:04:24 +0000 (20:04 -0800)]
[ELF] Improve test for copy relocations on aliases

2 years ago[LegalizeVectorOps] code refactor for LegalizeOp; NFC
Chen Zheng [Mon, 13 Dec 2021 15:00:06 +0000 (15:00 +0000)]
[LegalizeVectorOps] code refactor for LegalizeOp; NFC

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D115636

2 years agoRevert "[ELF] Split scanRelocations into scanRelocations/postScanRelocations"
Fangrui Song [Tue, 14 Dec 2021 03:29:53 +0000 (19:29 -0800)]
Revert "[ELF] Split scanRelocations into scanRelocations/postScanRelocations"

This reverts commit fc33861d48a95aa4682ce3b6e44732e5c8bbd092.

`replaceWithDefined` should copy needsGot, otherwise an alias for a copy
relocated symbol may not have GOT entry if its needsGot was originally true.

2 years agoDWARFVerifier: Verbosely dump DIEs in verifier reports
David Blaikie [Tue, 14 Dec 2021 03:00:38 +0000 (19:00 -0800)]
DWARFVerifier: Verbosely dump DIEs in verifier reports

Seems helpful when you're dealing with invalid/problematic DWARF. Some
diagnostic messages are probably redundant with the verbose dumping and
could be simplified with this.

2 years agoRevert "[InstrProf] Attach debug info to counters"
Ellis Hoag [Tue, 14 Dec 2021 02:08:57 +0000 (18:08 -0800)]
Revert "[InstrProf] Attach debug info to counters"

This reverts commit 800bf8ed29fbcaa9436540e83bc119ec92e7d40f.

The `Instrumentation/InstrProfiling/debug-info-correlate.ll` test was
failing because I forgot the `llc` commands are architecture specific.
I'll follow up with a fix.

Differential Revision: https://reviews.llvm.org/D115689

2 years ago[InstrProf] Attach debug info to counters
Ellis Hoag [Tue, 14 Dec 2021 00:47:47 +0000 (16:47 -0800)]
[InstrProf] Attach debug info to counters

Add the llvm flag `-debug-info-correlate` to attach debug info to instrumentation counters so we can correlate raw profile data to their functions. Raw profiles are dumped as `.proflite` files. The next diff enables `llvm-profdata` to consume `.proflite` and debug info files to produce a normal `.profdata` profile.

Part of the "lightweight instrumentation" work: https://groups.google.com/g/llvm-dev/c/r03Z6JoN7d4

Reviewed By: kyulee

Differential Revision: https://reviews.llvm.org/D114565

2 years ago[benchmark] Pull latest; disable -Werror
Mircea Trofin [Tue, 14 Dec 2021 00:02:02 +0000 (16:02 -0800)]
[benchmark] Pull latest; disable -Werror

Pulled the latest (b000672), which adds an option to disable -Werror,
which caused issues previously (see for instance
https://reviews.llvm.org/D112012)

Applied https://github.com/google/benchmark/pull/1305 to unblock, as
this issue is causing downstream buildbot failures.

The only change is in llvm/CMakeLists.txt, where we set
BENCHMARK_ENABLE_WERROR to have the same value as LLVM_ENABLE_WERROR.

This patch also introduces a convenience script to pull benchmark from
upstream.

Differential Revision: https://reviews.llvm.org/D115684

2 years ago[lldb] Use LLDB_VERSION_STRING instead of CLANG_VERSION_STRING
Jonas Devlieghere [Tue, 14 Dec 2021 00:58:29 +0000 (16:58 -0800)]
[lldb] Use LLDB_VERSION_STRING instead of CLANG_VERSION_STRING

2 years ago[AMDGPU][NFC] Add documentation for location description DWARF extension
Tony Tye [Sat, 11 Dec 2021 23:43:54 +0000 (23:43 +0000)]
[AMDGPU][NFC] Add documentation for location description DWARF extension

Add documentation for the DWARF extension to allow location descriptions
on the DWARF expression stack. This is part of the "DWARF Extensions For
Heterogeneous Debugging" used by the AMD GPU target.

Reviewed By: scott.linder

Differential Revision: https://reviews.llvm.org/D115587

2 years ago[instcombine] Canonicalize constant index type to i64 for extractelement/insertelement
Philip Reames [Tue, 14 Dec 2021 00:29:19 +0000 (16:29 -0800)]
[instcombine] Canonicalize constant index type to i64 for extractelement/insertelement

The basic idea to this is that a) having a single canonical type makes CSE easier, and b) many of our transforms are inconsistent about which types we end up with based on visit order.

I'm restricting this to constants as for non-constants, we'd have to decide whether the simplicity was worth extra instructions. For constants, there are no extra instructions.

We chose the canonical type as i64 arbitrarily.  We might consider changing this to something else in the future if we have cause.

Differential Revision: https://reviews.llvm.org/D115387

2 years ago[MemorySSA] Document details regarding MemorySSA's precision.
Alina Sbirlea [Fri, 12 Nov 2021 01:14:14 +0000 (17:14 -0800)]
[MemorySSA] Document details regarding MemorySSA's precision.

2 years ago[NewGVN] Use PredicateInfo info when previously used for the same ssa.copy intrinsic
Alina Sbirlea [Fri, 1 Oct 2021 05:22:17 +0000 (22:22 -0700)]
[NewGVN] Use PredicateInfo info when previously used for the same ssa.copy intrinsic

Symbolic execution using PredicateInfo is only done for the ssa.copy
intrinsic. It's using two potential sources for building the expression:
1. the Value of the instruction for which the instruction is a copy of, and
2. the Value from the contraint in PredicateInfo
It's possible to get into an infinite loop when choosing between these
two, as described in PR31613.

This patch proposes performing swapping of the two values (i.e. choosing
the second one for the expression), if that same second value was chosen
before; this breaks the cycle.

In the testcases provided, where there is a contradiction between the
value from symbolic execution and assume instruction, NewGVN reduces the
assume to assume(false).

Resolves PR31613.

Differential Revision: https://reviews.llvm.org/D110907

2 years ago[LegalizeVectorOps] fix a typo
Chen Zheng [Mon, 13 Dec 2021 14:45:52 +0000 (14:45 +0000)]
[LegalizeVectorOps] fix a typo

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D115637

2 years ago[NFC][Clang][OpenMP] Use switch-case statement to process clauses of atomic directive
Shilei Tian [Mon, 13 Dec 2021 22:00:22 +0000 (17:00 -0500)]
[NFC][Clang][OpenMP] Use switch-case statement to process clauses of atomic directive

This patch makes the process of clauses of atomic directive more clear
and preparation for the support for `atomic compare capture`.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D115586

2 years ago[libc++] Make ThrowingIterator constexpr
Nikolas Klauser [Sun, 12 Dec 2021 10:25:20 +0000 (11:25 +0100)]
[libc++] Make ThrowingIterator constexpr

Make ThrowingIterator constexpr

Reviewed By: Quuxplusone, ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D115579

2 years agoReapply: Autogen more vectorizer tests in advance of D115387.
Philip Reames [Mon, 13 Dec 2021 23:20:25 +0000 (15:20 -0800)]
Reapply: Autogen more vectorizer tests in advance of D115387.

Drop changes to consecutive-ptr-uniforms.ll since that test checks boths IR output and debug messages.  I'd missed this in the original commit, and Florian pointed it out in post-commit review.

Original commit message:

These are the ones my first round of scripting couldn't handle that required a bit of manual messaging.  This should be the last batch in llvm-check.

This reverts commit bbba86764ae8f9365a1a3908c50eb54698b2b203.

2 years ago[gn build] Port fff876c20e83
LLVM GN Syncbot [Mon, 13 Dec 2021 23:30:23 +0000 (23:30 +0000)]
[gn build] Port fff876c20e83

2 years agoRevert "[ASan] Shared optimized callbacks implementation."
Arthur Eubanks [Mon, 13 Dec 2021 23:25:44 +0000 (15:25 -0800)]
Revert "[ASan] Shared optimized callbacks implementation."

This reverts commit ebc31d2e7297d4002c72e5c7b9761c9559428ffc.

Causes test failures on Windows, see comments on D114558.

2 years agoRevert "[ASan] Added NO_EXEC_STACK_DIRECTIVE to assembly callback file."
Arthur Eubanks [Mon, 13 Dec 2021 23:24:46 +0000 (15:24 -0800)]
Revert "[ASan] Added NO_EXEC_STACK_DIRECTIVE to assembly callback file."

This reverts commit e31a5e0ba540fcebf115d2fcde2be8a250c485c1.

Reverting dependent change D114558.

2 years ago[Symbolizer][Debuginfo] Add debuginfod client to llvm-symbolizer.
Noah Shutty [Mon, 13 Dec 2021 22:35:27 +0000 (22:35 +0000)]
[Symbolizer][Debuginfo] Add debuginfod client to llvm-symbolizer.

Adds a fallback to use the debuginfod client library (386655) in `findDebugBinary`.
Fixed a cast of Erorr::success() to Expected<> in debuginfod library.
Added Debuginfod to Symbolize deps in gn.
Updates compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh to include Debuginfod library to fix sanitizer-x86_64-linux breakage.

Reviewed By: jhenderson, vitalybuka

Differential Revision: https://reviews.llvm.org/D113717

2 years ago[libc++] Fix the noexceptness of __decay_copy.
Arthur O'Dwyer [Mon, 13 Dec 2021 19:50:37 +0000 (14:50 -0500)]
[libc++] Fix the noexceptness of __decay_copy.

When `a` was an array type, `__decay_copy(a)` was incorrectly marking itself
noexcept(false), because it is false that `int[10]` is nothrow convertible to `int[10]`
(in fact it is not convertible at all).

We have no tests explicitly for `__decay_copy`, but the new ranges::begin
and ranges::end tests fail before this patch.

Differential Revision: https://reviews.llvm.org/D115658

2 years ago[mlir][Vector] Patterns flattening vector transfers to 1D
Benoit Jacob [Mon, 13 Dec 2021 20:00:28 +0000 (20:00 +0000)]
[mlir][Vector] Patterns flattening vector transfers to 1D

This is the second part of https://reviews.llvm.org/D114993 after slicing
into 2 independent commits.

This is needed at the moment to get good codegen from 2d vector.transfer
ops that aim to compile to SIMD load/store instructions but that can
only do so if the whole 2d transfer shape is handled in one piece, in
particular taking advantage of the memref being contiguous rowmajor.

For instance, if the target architecture has 128bit SIMD then we would
expect that contiguous row-major transfers of <4x4xi8> map to one SIMD
load/store instruction each.

The current generic lowering of multi-dimensional vector.transfer ops
can't achieve that because it peels dimensions one by one, so a transfer
of <4x4xi8> becomes 4 transfers of <4xi8>.

The new patterns here are only enabled for now by
 -test-vector-transfer-flatten-patterns.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D114993

2 years ago[clang][amdgpu] - Choose when to promote VarDecl to address space 4.
Ethan Stewart [Mon, 13 Dec 2021 22:30:54 +0000 (16:30 -0600)]
[clang][amdgpu] - Choose when to promote VarDecl to address space 4.

There are instances where clang codegen creates stores to
address space 4 in ctors, which causes a crash in llc.
This store was being optimized out at opt levels > 0.

For example:

pragma omp declare target
static  const double log_smallx = log2(smallx);
pragma omp end declare target

This patch ensures that any global const that does not
have constant initialization stays in address space 1.

Note - a second patch is in the works where all global
constants are placed in address space 1 during
codegen and then the opt pass InferAdressSpaces
will promote to address space 4 where necessary.

Reviewed By: JonChesterfield

Differential Revision: https://reviews.llvm.org/D115661

2 years ago[MIPS] Allow i1 values for 'r' constraint in inline-asm
Simon Atanasyan [Mon, 13 Dec 2021 16:16:39 +0000 (19:16 +0300)]
[MIPS] Allow i1 values for 'r' constraint in inline-asm

The bug was reported in the issue #52638.

2 years ago[lld] Replace Symbolize.h with DIContext.h in lld's COFF lib
Noah Shutty [Mon, 13 Dec 2021 22:16:41 +0000 (22:16 +0000)]
[lld] Replace Symbolize.h with DIContext.h in lld's COFF lib

lld only needs DIContext.h which it gets through Symbolize.h -> SymbolizableModule.h -> DIContext.h. This replaces it with a direct include of DIContext.h to avoid any confusion and pulling in unnecessary headers.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D115659

2 years ago[z/OS] Implement prologue and epilogue generation for z/OS target.
Neumann Hon [Mon, 13 Dec 2021 21:17:16 +0000 (16:17 -0500)]
[z/OS] Implement prologue and epilogue generation for z/OS target.

This patch adds support for prologue and epilogue generation for
the z/OS target under the XPLINK64 ABI for functions with a stack
size of less than 1048576 bytes (huge stack frames).

Reviewed by: uweigand, Kai

Differential Revision: https://reviews.llvm.org/D114457

2 years ago[clang] [unitttests] Fix linking Basic test to LLVMTestingSupport
Michał Górny [Sat, 11 Dec 2021 17:12:24 +0000 (18:12 +0100)]
[clang] [unitttests] Fix linking Basic test to LLVMTestingSupport

Link BasicTests via explicit target_link_libraries() rather than
clang_target_link_libraries() in order to fix linking when building
clang against libclang-cpp.  The latter requires all listed libraries
to be part of libclang-cpp and omits them if libclang-cpp is used.
However, LLVMTestingSupport is not part of libclang-cpp, so omitting it
causes undefined symbols.  Link to the library explicitly to follow suit
with the 7 other unittest programs.

Differential Revision: https://reviews.llvm.org/D115580

2 years ago[mlir][Vector] Patterns flattening vector transfers to 1D
Benoit Jacob [Mon, 13 Dec 2021 20:00:28 +0000 (20:00 +0000)]
[mlir][Vector] Patterns flattening vector transfers to 1D

This is the first part of https://reviews.llvm.org/D114993 which has been
split into small independent commits.

This is needed at the moment to get good codegen from 2d vector.transfer
ops that aim to compile to SIMD load/store instructions but that can
only do so if the whole 2d transfer shape is handled in one piece, in
particular taking advantage of the memref being contiguous rowmajor.

For instance, if the target architecture has 128bit SIMD then we would
expect that contiguous row-major transfers of <4x4xi8> map to one SIMD
load/store instruction each.

The current generic lowering of multi-dimensional vector.transfer ops
can't achieve that because it peels dimensions one by one, so a transfer
of <4x4xi8> becomes 4 transfers of <4xi8>.

The new patterns here are only enabled for now by
 -test-vector-transfer-flatten-patterns.

Reviewed By: nicolasvasilache

2 years agoRe-apply [NFC] Generalize a couple of passes so they can operate on any FunctionLike op.
Stella Laurenzo [Mon, 13 Dec 2021 21:08:54 +0000 (13:08 -0800)]
Re-apply [NFC] Generalize a couple of passes so they can operate on any FunctionLike op.

* Generalizes passes linalg-detensorize, linalg-fold-unit-extent-dims, convert-elementwise-to-linalg.
* I feel that more work could be done in the future (i.e. make FunctionLike into a proper OpInterface and extend actions in dialect conversion to be trait based), and this patch would be a good record of why that is useful.
* Note for downstreams:
  * Since these passes are now generic, they do not automatically nest with pass managers set up for implicit nesting.
  * The Detensorize pass must run on a FunctionLike, and this requires explicit nesting.
* Addressed missed comments from the original and per-suggestion removed the assert on FunctionLike in ElementwiseToLinalg and DropUnitDims.cpp, which also is what was causing the integration test to fail.

This reverts commit aa8815e42e646a98663af4cf036dbb913ad047a7.

Differential Revision: https://reviews.llvm.org/D115671

2 years agoRevert "[LTO] Add a function `LTOCodeGenerator::getMergedModule`"
Shilei Tian [Mon, 13 Dec 2021 21:31:22 +0000 (16:31 -0500)]
Revert "[LTO] Add a function `LTOCodeGenerator::getMergedModule`"

This reverts commit 61051e42c2d5b30ad440b2b275397fc0aa478434.

2 years agoRevert "[NFC][Clang][OpenMP] Use switch-case statement to process clauses of atomic...
Shilei Tian [Mon, 13 Dec 2021 21:30:56 +0000 (16:30 -0500)]
Revert "[NFC][Clang][OpenMP] Use switch-case statement to process clauses of atomic directive"

This reverts commit 5c23acbc023fbb9fdc6c56f4d2212ecb0432874e.

2 years agoSimplify AddSphinxTarget.cmake by just including `GNUInstallDirs`
John Ericson [Sun, 12 Dec 2021 17:07:13 +0000 (17:07 +0000)]
Simplify AddSphinxTarget.cmake by just including `GNUInstallDirs`

See the discussion in D30906 for how it must be robust to downstream
projects that might not use `GNUInstallDirs`.

I think an easier approach is just to include `GNUInstallDirs` so that
we can always rely on it. Looking at its definition in
https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/GNUInstallDirs.cmake
it appears safe to include multiple times.

I am trying this out because we will face the same problem many times
over if we use `GNUInstallDirs` more widely, as proposed in D99484 and
its parent revisions, since we do not know what downstream projects do
and rather not break them.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D115601

2 years ago[MachineOutliner] Don't outline functions starting with PATCHABLE_FUNCTION_ENTER...
Fangrui Song [Mon, 13 Dec 2021 21:24:29 +0000 (13:24 -0800)]
[MachineOutliner] Don't outline functions starting with PATCHABLE_FUNCTION_ENTER/FENTRL_CALL

MachineOutliner may outline a "patchable-function-entry" function whose body has
a TargetOpcode::PATCHABLE_FUNCTION_ENTER MachineInstr. This is incorrect because
the special code sequence must stay unchanged to be used at run-time.
Avoid outlining PATCHABLE_FUNCTION_ENTER. While here, avoid outlining FENTRY_CALL too
(which doesn't reproduce currently) to allow phase ordering flexibility.

Fixes #52635

Reviewed By: paquette

Differential Revision: https://reviews.llvm.org/D115614

2 years agoAdd support for a "load binary" LC_NOTE in mach-o corefiles
Jason Molenda [Mon, 13 Dec 2021 21:20:05 +0000 (13:20 -0800)]
Add support for a "load binary" LC_NOTE in mach-o corefiles

Add lldb support for a Mach-O "load binary" LC_NOTE which provides
a UUID, load address/slide, and possibly a name of a binary that
should be loaded when examining the core.

struct load_binary
{
    uint32_t version;        // currently 1
    uuid_t   uuid;           // all zeroes if uuid not specified
    uint64_t load_address;   // virtual address where the macho is loaded, UINT64_MAX if unavail
    uint64_t slide;          // slide to be applied to file address to get load address, 0 if unavail
    char     name_cstring[]; // must be nul-byte terminated c-string, '\0' alone if name unavail
} __attribute__((packed));

Differential Revision: https://reviews.llvm.org/D115494
rdar://85069250

2 years ago[NFC][Clang][OpenMP] Use switch-case statement to process clauses of atomic directive
Shilei Tian [Mon, 13 Dec 2021 21:20:01 +0000 (16:20 -0500)]
[NFC][Clang][OpenMP] Use switch-case statement to process clauses of atomic directive

This patch makes the process of clauses of atomic directive more clear
and preparation for the support for `atomic compare capture`.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D115586