platform/upstream/llvm.git
2 years ago[mlir][linalg][bufferize] Allow unbufferizable ops in input
Matthias Springer [Fri, 3 Dec 2021 11:19:46 +0000 (20:19 +0900)]
[mlir][linalg][bufferize] Allow unbufferizable ops in input

Allow ops that are not bufferizable in the input IR. (Deactivated by default.)

bufferization::ToMemrefOp and bufferization::ToTensorOp are generated at the bufferization boundaries.

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

2 years ago[RISCV][VP] Add RVV codegen for vp.select
Victor Perez [Fri, 3 Dec 2021 10:00:09 +0000 (10:00 +0000)]
[RISCV][VP] Add RVV codegen for vp.select

Lower vp.select instrinsic to VSELECT_VL.

Reviewed By: rogfer01

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

2 years ago[flang] Add missing LABEL in test. NFC
Diana Picus [Thu, 2 Dec 2021 04:40:29 +0000 (04:40 +0000)]
[flang] Add missing LABEL in test. NFC

2 years ago[fir] TargetRewrite: Rewrite fir.address_of(func)
Diana Picus [Thu, 2 Dec 2021 04:27:18 +0000 (04:27 +0000)]
[fir] TargetRewrite: Rewrite fir.address_of(func)

Rewrite AddrOfOp if taking the address of a function.

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[mlir][linalg][bufferize][NFC] Move BufferizationOptions to op interface
Matthias Springer [Fri, 3 Dec 2021 10:50:37 +0000 (19:50 +0900)]
[mlir][linalg][bufferize][NFC] Move BufferizationOptions to op interface

Also store a reference to BufferizationOptions in BufferizationState. This is in preparation of adding support for partial bufferization.

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

2 years ago[fir] Add fircg.ext_embox conversion
Valentin Clement [Fri, 3 Dec 2021 10:44:47 +0000 (11:44 +0100)]
[fir] Add fircg.ext_embox conversion

Convert a fircg.ext_embox operation to LLVM IR dialect.
A fircg.ext_embox is converted to a sequence of operation that
create, allocate if needed, and populate a descriptor.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: kiranchandramohan

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
2 years ago[llvm-dwarfdump] Do not print preceding :: for local types
Kristina Bessonova [Fri, 3 Dec 2021 10:27:29 +0000 (12:27 +0200)]
[llvm-dwarfdump] Do not print preceding :: for local types

Reviewed By: dblaikie, jhenderson

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

2 years ago[PowerPC] [Clang] Fix alignment adjustment of single-elemented float128
Qiu Chaofan [Fri, 3 Dec 2021 10:05:46 +0000 (18:05 +0800)]
[PowerPC] [Clang] Fix alignment adjustment of single-elemented float128

This does similar thing to 6b1341e, but fixes single element 128-bit
float type: `struct { long double x; }`.

Reviewed By: rjmccall

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

2 years ago[Clang] Mutate bulitin names under IEEE128 on PPC64
Qiu Chaofan [Fri, 3 Dec 2021 09:40:52 +0000 (17:40 +0800)]
[Clang] Mutate bulitin names under IEEE128 on PPC64

Glibc 2.32 and newer uses these symbol names to support IEEE-754 128-bit
float. GCC transforms name of these builtins to align with Glibc header
behavior.

Since Clang doesn't have all GCC-compatible builtins implemented, this
patch only mutates the implemented part.

Note nexttoward is a special case (no nexttowardf128) so it's also
handled here.

Reviewed By: jsji

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

2 years agoFix typos in FPUtil README
Guillaume Chatelet [Fri, 3 Dec 2021 09:22:00 +0000 (10:22 +0100)]
Fix typos in FPUtil README

2 years ago[MemoryLocation] Move DSE's logic to new MemLoc::getForDest helper (NFC).
Florian Hahn [Fri, 3 Dec 2021 09:12:01 +0000 (09:12 +0000)]
[MemoryLocation] Move DSE's logic to new MemLoc::getForDest helper (NFC).

DSE has some extra logic to determine the write location of library
calls like str*cpy and str*cat. This patch moves the logic to a new
MemoryLocation:getForDest variant, which takes a call and TLI.

This patch should be NFC, because no other places take advantage of the
new helper yet.

Suggested by @reames post-commit 7eec832def571.

Reviewed By: nikic

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

2 years ago[SCEV] Fix ValuesAtScopesUsers consistency
Nikita Popov [Fri, 3 Dec 2021 08:58:42 +0000 (09:58 +0100)]
[SCEV] Fix ValuesAtScopesUsers consistency

Fixes verification failure reported at:
https://reviews.llvm.org/rGc9f9be0381d1

The issue is that getSCEVAtScope() might compute a result without
inserting it in the ValuesAtScopes map in degenerate cases,
specifically if the ValuesAtScopes entry is invalidated during the
calculation. Arguably we should still insert the result if no
existing placeholder is found, but for now just tweak the logic
to only update ValuesAtScopesUsers if ValuesAtScopes is updated.

2 years ago[mlir][Vector] Support 0-D vectors in `BitCastOp`
Michal Terepeta [Fri, 3 Dec 2021 08:55:52 +0000 (08:55 +0000)]
[mlir][Vector] Support 0-D vectors in `BitCastOp`

The implementation only allows to bit-cast between two 0-D vectors. We could
probably support casting from/to vectors like `vector<1xf32>`, but I wasn't
convinced that this would be important and it would require breaking the
invariant that `BitCastOp` works only on vectors with equal rank.

Reviewed By: nicolasvasilache

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

2 years ago[mlir][Vector] Add some missing tests for `broadcast` and `splat`
Michal Terepeta [Fri, 3 Dec 2021 07:56:21 +0000 (07:56 +0000)]
[mlir][Vector] Add some missing tests for `broadcast` and `splat`

Reviewed By: nicolasvasilache

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

2 years ago[MemoryLocation] strcat/strncat/strcpy read/write after their args.
Florian Hahn [Fri, 3 Dec 2021 08:48:21 +0000 (08:48 +0000)]
[MemoryLocation] strcat/strncat/strcpy read/write after their args.

strcpy/strcat/strncat access memory starting from the passed in
pointers. Construct memory locations for their args using getAfter.

Discussed in D114872.

Reviewed By: reames

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

2 years ago[clangd] IncludeCleaner: Do not require forward declarations of RecordDecls when...
Kirill Bobyrev [Fri, 3 Dec 2021 08:36:49 +0000 (09:36 +0100)]
[clangd] IncludeCleaner: Do not require forward declarations of RecordDecls when definition is available

This makes IncludeCleaner more useful in the presense of a large number of
forward declarations. If the definition is already in the Translation Unit and
visible to the Main File, forward declarations have no effect.

The original patch D112707 was split in two: D114864 and this one.

Reviewed By: kadircet

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

2 years agotsan: disable munmap_invalid.cpp test on darwin
Dmitry Vyukov [Thu, 2 Dec 2021 17:42:11 +0000 (18:42 +0100)]
tsan: disable munmap_invalid.cpp test on darwin

It failed on bots:
https://green.lab.llvm.org/green//job/clang-stage1-RA/25954/consoleFull#-1417328700a1ca8a51-895e-46c6-af87-ce24fa4cd561
and it  doesn't provide the test output.

Reviewed By: melver

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

2 years ago[mlir][linalg][bufferize] Op interface implementation for Bufferization dialect ops
Matthias Springer [Fri, 3 Dec 2021 07:25:08 +0000 (16:25 +0900)]
[mlir][linalg][bufferize] Op interface implementation for Bufferization dialect ops

This change provides `BufferizableOpInterface` implementations for ops from the Bufferization dialects. These ops are needed at the bufferization boundaries for partial bufferization.

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

2 years ago[flang] Return arrays in Transfer runtime with SIZE argument
Jean Perier [Fri, 3 Dec 2021 07:23:16 +0000 (08:23 +0100)]
[flang] Return arrays in Transfer runtime with SIZE argument

In TRANSFER runtime the result was an array only if the MOLD was an array.
This is not in line with TRANSFER definition in 16.9.193 that rules that it
must also be an array if MOLD is scalar and SIZE if provided.

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

2 years ago[TableGen][SelectionDAG] Use ComplexPattern type for non-leaf nodes
Jessica Clarke [Thu, 2 Dec 2021 16:23:09 +0000 (16:23 +0000)]
[TableGen][SelectionDAG] Use ComplexPattern type for non-leaf nodes

When used as a non-leaf node, TableGen does not currently use the type
of a ComplexPattern for type inference, which also means it does not
check it doesn't conflict with the use. This differs from when used as a
leaf value, where the type is used for inference. This addresses that
discrepancy. The test case is not representative of most real-world uses
but is sufficient to demonstrate inference is working.

Some of these uses also make use of ValueTypeByHwMode rather than
SimpleValueType and so the existing type inference is extended to
support that alongside the new type inference.

There are also currently various cases of using ComplexPatterns with an
untyped type, but only for non-leaf nodes. For compatibility this is
permitted, and uses the old behaviour of not inferring for non-leaf
nodes, but the existing logic is still used for leaf values. This
remaining discrepancy should eventually be eliminated, either by
removing all such uses of untyped so the special case goes away (I
imagine Any, or a more specific type in certain cases, would be
perfectly sufficient), or by copying it to the leaf value case so
they're consistent with one another if this is something that does need
to keep being supported.

All non-experimental targets have been verified to produce bit-for-bit
identical TableGen output with this change applied.

Reviewed By: kparzysz

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

2 years ago[AArch64][NFC] Alter ComplexPattern types to be consistent with their uses
Jessica Clarke [Thu, 2 Dec 2021 15:21:28 +0000 (15:21 +0000)]
[AArch64][NFC] Alter ComplexPattern types to be consistent with their uses

When used as a non-leaf node, TableGen does not currently use the type
of a ComplexPattern for type inference, which also means it does not
check it doesn't conflict with the use. This differs from when used as a
leaf value, where the type is used for inference. Fixing that
discrepancy is something I intend to upstream as a subsequent review.

AArch64 currently has several ComplexPatterns that are used in contexts
where they're expected to be an iPTR. The cases that lead to type
contradictions are separated out in D108759, but there are additional
differences to the TableGen output when using my locally-patched
TableGen. None of these appear to matter, at least for passing all the
CodeGen tests, but it's safer to avoid such changes (and similar changes
were causing issues on some AMDGPU tests, causing failures to select).
Changing these additional ComplexPatterns to use iPTR rather than i64
ensures that the TableGen output remains bit-for-bit identical (compared
to without having this patch and my TableGen patch, as well as the
intermediate state of having this patch but not my TableGen patch), and
more accurately captures the higher-level meaning of these patterns.

Reviewed By: david-arm

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

2 years ago[AMDGPU][NFC] Alter ComplexPattern types to be consistent with their uses
Jessica Clarke [Thu, 2 Dec 2021 15:21:12 +0000 (15:21 +0000)]
[AMDGPU][NFC] Alter ComplexPattern types to be consistent with their uses

When used as a non-leaf node, TableGen does not currently use the type
of a ComplexPattern for type inference, which also means it does not
check it doesn't conflict with the use. This differs from when used as a
leaf value, where the type is used for inference. Fixing that
discrepancy is something I intend to upstream as a subsequent review.

AMDGPU currently has several ComplexPatterns that are used in contexts
where they're expected to be an iPTR, and where using an iPTR instead of
a fixed-width integer type matters. With my locally-patched TableGen,
none of these mismatches result in type contradictions, but do change
the patterns and cause various failures to select. These changes to the
ComplexPatterns' types reflect how they are actually used, result in
bit-for-bit identical TableGen output (without my local TableGen patch),
and ensure that with improved type inference AMDGPU's backend will
continue to work.

Reviewed By: arsenm

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

2 years ago[AArch64][NFC] Fix ComplexPattern types conflicting with uses
Jessica Clarke [Thu, 2 Dec 2021 15:21:01 +0000 (15:21 +0000)]
[AArch64][NFC] Fix ComplexPattern types conflicting with uses

When used as a non-leaf node, TableGen does not currently use the type
of a ComplexPattern for type inference, which also means it does not
check it doesn't conflict with the use. This differs from when used as a
leaf value, where the type is used for inference. Fixing that
discrepancy is something I intend to upstream as a subsequent review,
but these are all the type conflicts found (all legitimate) by my
locally-patched TableGen.

Reviewed By: paulwalker-arm

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

2 years ago[NFC] move GNUELFDumper::printEnum() into a common header for reuse.
Esme-Yi [Fri, 3 Dec 2021 06:33:56 +0000 (06:33 +0000)]
[NFC] move GNUELFDumper::printEnum() into a common header for reuse.

Summary:
This is a NFC patch moving the GNUELFDumper<ELFT>::printEnum()
 function from ELFDumper into ScopedPrinter.h for reuse.

Reviewed By: jhenderson

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

2 years ago[Coroutines] Handle InvokeInst in SalvageDebugInfo
Chuanqi Xu [Fri, 3 Dec 2021 05:46:52 +0000 (13:46 +0800)]
[Coroutines] Handle InvokeInst in SalvageDebugInfo

Since coroutine would be splitted into pieces, compiler would move the
dbg.declare intrinsic after the Storage is created to make sure the
corresponding dbg instruction is still available aftet splitted.
However, it would be problematic if the storage instruction is an
InvokeInst, which is a terminator. We couldn't move instruction after an
InvokeInst. This patch tries to move the dbg.declare intrinsic in the
normal destination of the InvokeInst. It should make sense due to the
Storage should be invalid in exception path.

2 years ago[clangd] Show parameters for construct.
lh123 [Fri, 3 Dec 2021 04:32:11 +0000 (12:32 +0800)]
[clangd] Show parameters for construct.

Show parameters for construct.

Reviewed By: kadircet

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

2 years ago[lldb] add fallback for LLDB_PYTHON_RELATIVE_PATH
Lawrence D'Anna [Fri, 3 Dec 2021 05:13:09 +0000 (21:13 -0800)]
[lldb] add fallback for LLDB_PYTHON_RELATIVE_PATH

Some pythons are configured to set platlib somewhere outside of their
sys.prefix.   It's important that we at least use some reasonable
default for LLDB_PYTHON_RELATIVE_PATH even in that case, because
even if the user overrides it on the cmake invocation, cmake will
still be called without the override in order to build tablegen.

Reviewed By: JDevlieghere, clayborg

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

2 years ago[ASan] Changed intrisic implemenation to use PLT safe registers.
Kirill Stoimenov [Thu, 2 Dec 2021 22:15:01 +0000 (22:15 +0000)]
[ASan] Changed intrisic implemenation to use PLT safe registers.

Changed registers to R10 and R11 because PLT resolution clobbers them. Also changed the implementation to use R11 instead of RCX, which saves a push/pop.

Reviewed By: vitalybuka

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

2 years ago[llvm][Inline] Add FunctionSimplificationPipeline to module inliner pipeline
Liqiang Tao [Fri, 3 Dec 2021 03:13:07 +0000 (12:13 +0900)]
[llvm][Inline] Add FunctionSimplificationPipeline to module inliner pipeline

The FunctionSimplificationPipeline could effectively reduce the size of .text section when module inliner is enabled.

Reviewed By: kazu

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

2 years ago[gn build] Port aba8f320cc13
LLVM GN Syncbot [Fri, 3 Dec 2021 02:16:17 +0000 (02:16 +0000)]
[gn build] Port aba8f320cc13

2 years ago[gn build] Port 2d9efcfeec24
LLVM GN Syncbot [Fri, 3 Dec 2021 02:16:16 +0000 (02:16 +0000)]
[gn build] Port 2d9efcfeec24

2 years agoSimplify logic to identify dyld_sim in Simulator debugging on macos
Jason Molenda [Fri, 3 Dec 2021 02:08:54 +0000 (18:08 -0800)]
Simplify logic to identify dyld_sim in Simulator debugging on macos

When debugging a Simulator process on macOS (e.g. the iPhone simulator),
the process will have both a dyld, and a dyld_sim present.  The dyld_sim
is an iOS Simulator binary.  The dyld is a macOS binary.  Both are
MH_DYLINKER filetypes.  lldb needs to identify & set a breakpoint in
dyld, so it has to distinguish between these two.

Previously lldb was checking if the inferior target was x86 (indicating
macOS) and the OS of the MH_DYLINKER binary was iOS/watchOS/etc -- if
so, then this is dyld_sim and we should ignore it.  Now with arm64
macOS systems, this check was invalid, and we would set our breakpoint
for new binaries being loaded in dyld_sim, causing binary loading to
be missed by lldb.

This patch uses the Target's ArchSpec triple environment, to see if
this process is a simulator process.  If this is a Simulator process,
then we only recognize a MH_DYLINKER binary with OS type macOS as
being dyld.

This patch also removes some code that handled pre-2016 era debugservers
which didn't give us the OS type for each binary.  This was only being
used on macOS, where we don't need to handle the presence of very old
debugservers.

Differential Revision: https://reviews.llvm.org/D115001
rdar://85907839

2 years ago[gn build] (manually) port 9c4d194f44c4 better
Nico Weber [Fri, 3 Dec 2021 02:11:36 +0000 (21:11 -0500)]
[gn build] (manually) port 9c4d194f44c4 better

2 years ago[lsan] Deflake fork_and_leak test
Vitaly Buka [Fri, 3 Dec 2021 01:29:39 +0000 (17:29 -0800)]
[lsan] Deflake fork_and_leak test

2 years ago[gn build] (manually) port 9c4d194f44c4
Nico Weber [Fri, 3 Dec 2021 02:03:38 +0000 (21:03 -0500)]
[gn build] (manually) port 9c4d194f44c4

2 years ago[libc++][ranges] Implement [special.mem.concepts].
Konstantin Varlamov [Fri, 3 Dec 2021 01:57:55 +0000 (17:57 -0800)]
[libc++][ranges] Implement [special.mem.concepts].

Implement the exposition-only concepts specified in
`[special.mem.concepts]`. These are all thin wrappers over other
concepts.

Reviewed By: #libc, Quuxplusone, ldionne

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

2 years ago[CSSPGO] Turn on Profi by default
Hongtao Yu [Tue, 15 Sep 2020 23:12:12 +0000 (16:12 -0700)]
[CSSPGO] Turn on Profi by default

As titled.

Reviewed By: wenlei, wlei

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

2 years agoUsing make_unique instead of `new` (NFC)
Mehdi Amini [Thu, 2 Dec 2021 17:06:18 +0000 (17:06 +0000)]
Using make_unique instead of `new` (NFC)

Fix a clang-tidy warning.

2 years ago[Bazel] Set the right default for LLVM_WINDOWS_PREFER_FORWARD_SLASH on Windows
Geoffrey Martin-Noble [Fri, 3 Dec 2021 01:33:19 +0000 (17:33 -0800)]
[Bazel] Set the right default for LLVM_WINDOWS_PREFER_FORWARD_SLASH on Windows

This cmake configure option was added in
df0ba47c36f6bd0865e3286853b76d37e037c2d7, and was ported to
Bazel in 7d323dc7738e3152c4bd54a23ac27554bfbbf583.

However, the setting chosen in Bazel seems accidental, not necessarily
intentional.

LLVM_WINDOWS_PREFER_FORWARD_SLASH has no effect on Unix, and on
Windows, setting it to 0 is the default, which gets the same behaviour
as before. Setting it to 1 enables new experimental behaviours
(which is enabled by default on MinGW targets only).

As I don't see any explicit intent to opt in to the new experimental
behaviour, I believe the current configuration in bazel was a
mistake.

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

2 years ago[clang][Darwin] Remove old lld implementation handling
Keith Smiley [Thu, 2 Dec 2021 19:10:41 +0000 (11:10 -0800)]
[clang][Darwin] Remove old lld implementation handling

This now assumes that for the darwin driver any lld is the "new" macho
lld implementation.

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

2 years ago[bazel] Update static analyzer unit test deps for clangTesting
Reid Kleckner [Fri, 3 Dec 2021 00:25:28 +0000 (16:25 -0800)]
[bazel] Update static analyzer unit test deps for clangTesting

2 years agoRun update_test_checks.py on test cases.
Mingming Liu [Fri, 3 Dec 2021 00:21:11 +0000 (00:21 +0000)]
Run update_test_checks.py on test cases.

In this way, each instruction has a line, and diffs will be more clear.

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

2 years ago[Bazel] Add LLVM_ENABLE_CURL to Bazel llvm-config.h.cmake for e0b259f2
Reid Kleckner [Fri, 3 Dec 2021 00:15:38 +0000 (16:15 -0800)]
[Bazel] Add LLVM_ENABLE_CURL to Bazel llvm-config.h.cmake for e0b259f2

2 years ago[CostModel][AMDGPU] Fix instructions costs estimation for vector types.
Daniil Fukalov [Fri, 29 Oct 2021 15:29:57 +0000 (18:29 +0300)]
[CostModel][AMDGPU] Fix instructions costs estimation for vector types.

1. Fixed vector instructions costs estimations incosistency - removed different
   logic for "not simple types" since it biases costs for these types.
2. Fixed legalization penalty for vectors too big for the target: changed from
   overwrite default legalization cost value estimation to added penalty.
3. Fixed few typos in tests.

Reviewed By: rampitec

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

2 years agoInclude extra input contents on this test so we can see why lldb-arm-ubuntu buildbot...
Greg Clayton [Thu, 2 Dec 2021 23:47:15 +0000 (15:47 -0800)]
Include extra input contents on this test so we can see why lldb-arm-ubuntu buildbot is failing.

Only lldb-arm-ubuntu is failing after https://reviews.llvm.org/D114288 and there isn't enough input context to see why this is failing. It works on x86_64 linux just fine.

2 years ago[mlir][ods] update attr/type def format docs
Mogball [Thu, 2 Dec 2021 23:42:47 +0000 (23:42 +0000)]
[mlir][ods] update attr/type def format docs

2 years ago[clang-tidy][objc] Finds and fixes improper usages of XCTAssertEquals and XCTAssertNo...
Vy Nguyen [Thu, 2 Dec 2021 20:22:43 +0000 (15:22 -0500)]
[clang-tidy][objc] Finds and fixes improper usages of XCTAssertEquals and XCTAssertNotEquals.

Using XCTAssertEqual on NSString* objects is almost always  wrong.

Unfortunately, we have seen a lot of tests doing this and reyling on pointer equality for strings with the same values (which happens to work sometimes - depending on the linker, but this assumption is not guaranteed by the language)

These fixes would make tests less brittle.

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

2 years ago[analyzer]Skip unstable CSA tests failing on several platforms
Steven Wan [Thu, 2 Dec 2021 23:29:43 +0000 (18:29 -0500)]
[analyzer]Skip unstable CSA tests failing on several platforms

Clang static analyzer uses bitwidth to infer the integer value type, that is, any 32-bit integer is considered of type `int`, and any 64-bit integer is considered of type `long`. This isn't always true, for instance, in ILP32 (e.g., 32-bit AIX), 32-bit could be `long`, and in LP64 (e.g., 64-bit wasm64), 64-bit could be `long long`.

Reviewed By: steakhal

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

2 years ago[ELF][PPC32] Make R_PPC32_PLTREL retain .got
George Koehler [Thu, 2 Dec 2021 23:28:37 +0000 (15:28 -0800)]
[ELF][PPC32] Make R_PPC32_PLTREL retain .got

PLT usage needs the first 12 bytes of the .got section. We need to keep .got and
DT_GOT_PPC even if .got/_GLOBAL_OFFSET_TABLE_ are not referenced (large PIC code
may only reference .got2), which is the case in OpenBSD's ld.so, leading
to a misleading error, "unsupported insecure BSS PLT object".

Fix this by adding R_PPC32_PLTREL to the list of hasGotOffRel.

Reviewed By: MaskRay

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

2 years agoAMDGPU: Sanitized functions require implicit arguments
Matt Arsenault [Thu, 2 Dec 2021 21:31:56 +0000 (16:31 -0500)]
AMDGPU: Sanitized functions require implicit arguments

Do not infer no-amdgpu-implicitarg-ptr for sanitized functions. If a
function is explicitly marked amdgpu-no-implicitarg-ptr and
sanitize_address, infer that it is required.

2 years ago[MLIR] Use a shared uniquer for affine maps and integer sets.
Ulysse Beaugnon [Thu, 2 Dec 2021 22:49:02 +0000 (23:49 +0100)]
[MLIR] Use a shared uniquer for affine maps and integer sets.

Affine maps and integer sets previously relied on a single lock for creating unique instances. In a multi-threaded setting, this lock becomes a contention point. This commit updates AffineMap and IntegerSet to use StorageUniquer instead. StorageUniquer internally uses sharded locks and thread-local caches to reduce contention. It is already used for affine expressions, types and attributes. On my local machine, this gives me a 5X speedup for an application that manipulates a lot of affine maps and integer sets.

This commit also removes the integer set uniquer threshold. The threshold was used to avoid adding integer sets with a lot of constraints to the hash_map containing unique instances, but the constraints and the integer set were still allocated in the same allocator and never freed, thus not saving any space expect for the hash-map entry.

Reviewed By: rriddle

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

2 years ago[NFC][sanitizer] Remove SetSoftRssLimitExceededCallback
Vitaly Buka [Thu, 2 Dec 2021 20:44:38 +0000 (12:44 -0800)]
[NFC][sanitizer] Remove SetSoftRssLimitExceededCallback

According comments on D44404, something like that was the goal.

Reviewed By: morehouse, kstoimenov

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

2 years ago[NFC][sanitizer] Reorder functions in cpp file
Vitaly Buka [Thu, 2 Dec 2021 21:27:11 +0000 (13:27 -0800)]
[NFC][sanitizer] Reorder functions in cpp file

2 years agolibcxx pretty printers: remove non-lazy_string fallback
David Blaikie [Thu, 2 Dec 2021 20:16:10 +0000 (12:16 -0800)]
libcxx pretty printers: remove non-lazy_string fallback

This has been supported on gdb for something like ~10 years, so doesn't
seem necessary to carry a fallback.

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

2 years ago[TLI checker] Follow good practice with -COUNT directives
Paul Robinson [Thu, 2 Dec 2021 22:28:07 +0000 (14:28 -0800)]
[TLI checker] Follow good practice with -COUNT directives

FileCheck's -COUNT suffix doesn't fail if there are more matches
than you asked for, so it's good practice to put a -NOT after.

2 years ago[clang-tidy] Allow disabling support for NOLINTBEGIN/NOLINTEND blocks.
Yitzhak Mandelbaum [Thu, 2 Dec 2021 19:52:47 +0000 (19:52 +0000)]
[clang-tidy] Allow disabling support for NOLINTBEGIN/NOLINTEND blocks.

This patch parameterizes the clang-tidy diagnostic consumer with a boolean that
controls whether to honor NOLINTBEGIN/NOLINTEND blocks. The current support for
scanning these blocks is very costly -- O(n*m) in the size of files (n) and
number of diagnostics found (m), with a large constant factor.  So, the patch
allows clients to disable it.

Future patches should make the feature more efficient, but this will mitigate in
the interim.

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

2 years ago[MLIR][FlatAffineConstraints] Remove duplicate divisions while merging local ids
Groverkss [Thu, 2 Dec 2021 22:14:36 +0000 (03:44 +0530)]
[MLIR][FlatAffineConstraints] Remove duplicate divisions while merging local ids

This patch implements detecting duplicate local identifiers by extracting their
division representation while merging local identifiers.

For example, given the FACs A, B:

```
A: (x, y)[s0] : (exists d0 = [x / 4], d1 = [y / 4]: d0 <= s0, d1 <= s0, x + y >= 2)
B: (x, y)[s0] : (exists d0 = [x / 4], d1 = [y / 4]: d0 <= s0, d1 <= s0, x + y >= 5)
```

The intersection of A and B without this patch would lead to the following FAC:

```
(x, y)[s0] : (exists d0 = [x / 4], d1 = [y / 4], d2 = [x / 4], d3 = [x / 4]: d0 <= s0, d1 <= s0, d2 <= s0, d3 <= s0, x + y >= 2, x + y >= 5)
```

after this patch, merging of local ids will detect that `d0 = d2` and `d1 = d3`,
and the intersection of these two FACs will be (after removing duplicate constraints):

```
(x, y)[s0] : (exists d0 = [x / 4], d1 = [y / 4] : d0 <= s0, d1 <= s0, x + y >= 2, x + y >= 5)
```

This reduces the number of constraints by 2 (constraints) + 4 (2 constraints for each extra division) for this case.

This is used to reduce the output size representation of operations like
PresburgerSet::subtract, PresburgerSet::intersect which require merging local
variables.

Reviewed By: arjunp, bondhugula

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

2 years agoRevert changes that should have been sent as a patch
Groverkss [Thu, 2 Dec 2021 22:08:00 +0000 (03:38 +0530)]
Revert changes that should have been sent as a patch

Revert changes that were meant to be sent as a single commit with
summary for the differential review, but were accidently sent directly.

This reverts commit 3bc5353fc6f291d6ac12c256600b5b05d7de8f74.

2 years ago[OPENMP]Fix PR50733: unexpected final value of list-item in linear clause in loop...
Alexey Bataev [Tue, 29 Jun 2021 20:56:00 +0000 (13:56 -0700)]
[OPENMP]Fix PR50733: unexpected final value of list-item in linear clause in loop construct.

Currently the last value of linear is calculated as var = init + num_iters * step.
Replaced it with var = var_priv, i.e. original variable gets the value
of the last private copy.

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

2 years ago[PowerPC] Fix load/store selection infrastructure when load/store intrinsics are...
Amy Kwan [Thu, 2 Dec 2021 21:24:06 +0000 (15:24 -0600)]
[PowerPC] Fix load/store selection infrastructure when load/store intrinsics are used on P10.

The load/store infrastructure previously made an incorrect assumption that
whenever it is used with a load/store intrinsic on Power10 - those intrinsics
would automatically be the lxvp/stxvp intrinsics introduced in Power10.

However, this is obviously not the case as there are multiple instances of
pre-P10 intrinsics that use the refactored load/store implementation.
This patch corrects this assumption, and produces the expected intrinsic on pre-P10.

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

2 years agoAddress bondhugula's comments
Groverkss [Thu, 2 Dec 2021 21:39:19 +0000 (03:09 +0530)]
Address bondhugula's comments

2 years agoAddressed comments
Groverkss [Thu, 18 Nov 2021 17:04:36 +0000 (22:34 +0530)]
Addressed comments

2 years agoFix doc comment for mergeLocalIds.
Groverkss [Thu, 18 Nov 2021 15:34:00 +0000 (21:04 +0530)]
Fix doc comment for mergeLocalIds.

2 years agoAddress more comments.
Groverkss [Thu, 18 Nov 2021 14:51:46 +0000 (20:21 +0530)]
Address more comments.

2 years agoAddressed more comments
Groverkss [Fri, 12 Nov 2021 22:57:37 +0000 (04:27 +0530)]
Addressed more comments

2 years agoFix asserts as suggested by Arjun
Groverkss [Thu, 11 Nov 2021 17:12:04 +0000 (22:42 +0530)]
Fix asserts as suggested by Arjun

2 years agoFix clang-format errors
Groverkss [Wed, 10 Nov 2021 10:18:48 +0000 (15:48 +0530)]
Fix clang-format errors

2 years agoUpdate docs
Groverkss [Mon, 8 Nov 2021 22:02:40 +0000 (03:32 +0530)]
Update docs

2 years agoUpdate tests for mergeLocalIds
Groverkss [Mon, 8 Nov 2021 21:43:43 +0000 (03:13 +0530)]
Update tests for mergeLocalIds

2 years agoAddress arjun's comments
Groverkss [Mon, 8 Nov 2021 21:43:25 +0000 (03:13 +0530)]
Address arjun's comments

2 years agoMove division representation to a common function
Groverkss [Sun, 7 Nov 2021 05:15:20 +0000 (10:45 +0530)]
Move division representation to a common function

2 years agoUpdate mergeLocalIds docs
Groverkss [Sat, 6 Nov 2021 10:45:51 +0000 (16:15 +0530)]
Update mergeLocalIds docs

2 years agoUpdate docs for mergeLocalIds
Groverkss [Sun, 31 Oct 2021 21:34:08 +0000 (03:04 +0530)]
Update docs for mergeLocalIds

2 years agoImplement division merging
Groverkss [Sat, 30 Oct 2021 12:12:47 +0000 (17:42 +0530)]
Implement division merging

2 years ago[LTO] Specify triple to address unknown binary format assertion
Jake Egan [Thu, 2 Dec 2021 21:39:52 +0000 (16:39 -0500)]
[LTO] Specify triple to address unknown binary format assertion

On AIX, this test generates an XCOFF file and hits "unknown binary format" assertion in llvm-nm. This patch specifies the triple to mitigate this issue.

Reviewed By: steven_wu

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

2 years ago[OPENMP]Fix PR51327: Range based for loop not working if range's type is a template.
Alexey Bataev [Wed, 24 Nov 2021 19:21:10 +0000 (11:21 -0800)]
[OPENMP]Fix PR51327: Range based for loop not working if range's type is a template.

Need to postpone anlysis of the ranged for loops till the actual
instantiation to avoid erroneous emission of error messages.

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

2 years ago[mlir][ods] fix defgen on empty files
Mogball [Thu, 2 Dec 2021 21:25:04 +0000 (21:25 +0000)]
[mlir][ods] fix defgen on empty files

2 years ago[funcattrs] Infer writeonly argument attribute
Philip Reames [Thu, 2 Dec 2021 20:56:09 +0000 (12:56 -0800)]
[funcattrs] Infer writeonly argument attribute

This change extends the current logic for inferring readonly and readnone argument attributes to also infer writeonly.

This change is deliberately minimal; there's a couple of areas for follow up.
* I left out all call handling and thus any benefit from the SCC walk. When examining the test changes, I realized the existing code is imprecise, and am going to fix that in it's own revision before adding in the writeonly handling. (Mostly because updating the tests is hard when I, the human, can't figure out whether the result is correct.)
* I left out handling for storing a value (as opposed to storing to a pointer). This should benefit readonly/readnone as well, and applies to a bunch of other instructions. Seemed worth having as a separate review.

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

2 years ago[OPENMP]Fix error emission for dependent expressions in iterators for depend clauses.
Alexey Bataev [Fri, 26 Nov 2021 15:36:25 +0000 (07:36 -0800)]
[OPENMP]Fix error emission for dependent expressions in iterators for depend clauses.

Need to postpone analysis for addressable lvalue in a depend clause with
iterators, otherwise the incorrect error message is emitted.

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

2 years agoRestric xfail on openmp/libomptarget/test/mapping/reduction_implicit_map.cpp to amdgc...
Ron Lieberman [Thu, 2 Dec 2021 20:58:19 +0000 (20:58 +0000)]
Restric xfail on openmp/libomptarget/test/mapping/reduction_implicit_map.cpp to amdgcn-amd-amdhsa

2 years ago[NFC][sanitizer] Rename RssLimitExceeded -> IsRssLimitExceeded
Vitaly Buka [Thu, 2 Dec 2021 20:47:47 +0000 (12:47 -0800)]
[NFC][sanitizer] Rename RssLimitExceeded -> IsRssLimitExceeded

2 years ago[gn build] (manually) port e0b259f22c003ffe9
Nico Weber [Thu, 2 Dec 2021 20:50:56 +0000 (15:50 -0500)]
[gn build] (manually) port e0b259f22c003ffe9

2 years agoxfail: libomptarget reduction_implicit_map.cpp after reapply of Start calling setTarg...
Ron Lieberman [Thu, 2 Dec 2021 20:32:06 +0000 (20:32 +0000)]
xfail: libomptarget reduction_implicit_map.cpp after reapply of Start calling setTargetAttributes

2 years ago[llvm] [Support] Add CURL HTTP Client.
Noah Shutty [Thu, 2 Dec 2021 19:33:04 +0000 (19:33 +0000)]
[llvm] [Support] Add CURL HTTP Client.

Provides an implementation of `HTTPClient` that wraps libcurl.

Reviewed By: dblaikie

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

2 years agoRevert "xfail: reduction_implicit_map.cpp after reapply of Start calling setTargetAtt...
Ron Lieberman [Thu, 2 Dec 2021 20:29:30 +0000 (20:29 +0000)]
Revert "xfail: reduction_implicit_map.cpp after reapply of Start calling setTargetAttributes"

This reverts commit 8b646f212e9ccc8e0fbf1a84603d0a40bfca1338.

2 years ago[ASan] Fixed asan_mapping.h format.
Kirill Stoimenov [Thu, 2 Dec 2021 20:19:29 +0000 (20:19 +0000)]
[ASan] Fixed asan_mapping.h format.

Reviewed By: kstoimenov

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

2 years agoxfail: reduction_implicit_map.cpp after reapply of Start calling setTargetAttributes
Ron Lieberman [Thu, 2 Dec 2021 20:22:11 +0000 (20:22 +0000)]
xfail: reduction_implicit_map.cpp after reapply of Start calling setTargetAttributes

2 years ago[libc++][NFC] Update namespace comments in include/
Nikolas Klauser [Thu, 2 Dec 2021 13:12:51 +0000 (14:12 +0100)]
[libc++][NFC] Update namespace comments in include/

update the namspace comments in include/

Reviewed By: ldionne, #libc

Spies: smeenai, libcxx-commits

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

2 years agoprofi - a flow-based profile inference algorithm: Part III (out of 3)
spupyrev [Thu, 2 Dec 2021 19:59:33 +0000 (11:59 -0800)]
profi - a flow-based profile inference algorithm: Part III (out of 3)

This is a continuation of D109860 and D109903.

An important challenge for profile inference is caused by the fact that the
sample profile is collected on a fully optimized binary, while the block and
edge frequencies are consumed on an early stage of the compilation that operates
with a non-optimized IR. As a result, some of the basic blocks may not have
associated sample counts, and it is up to the algorithm to deduce missing
frequencies. The problem is illustrated in the figure where three basic
blocks are not present in the optimized binary and hence, receive no samples
during profiling.

We found that it is beneficial to treat all such blocks equally. Otherwise the
compiler may decide that some blocks are “cold” and apply undesirable
optimizations (e.g., hot-cold splitting) regressing the performance. Therefore,
we want to distribute the counts evenly along the blocks with missing samples.
This is achieved by a post-processing step that identifies "dangling" subgraphs
consisting of basic blocks with no sampled counts; once the subgraphs are
found, we rebalance the flow so as every branch probability is 50:50 within the
subgraphs.

Our experiments indicate up to 1% performance win using the optimization on
some binaries and a significant improvement in the quality of profile counts
(when compared to ground-truth instrumentation-based counts)

{F19093045}

Reviewed By: hoy

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

2 years ago[gn build] (manually) port 9e3552523ebd (no more old mach-o lld)
Nico Weber [Thu, 2 Dec 2021 20:00:40 +0000 (15:00 -0500)]
[gn build] (manually) port 9e3552523ebd (no more old mach-o lld)

2 years ago[ELF] Hint -z nostart-stop-gc for __start_ undefined references
Fangrui Song [Thu, 2 Dec 2021 19:58:25 +0000 (11:58 -0800)]
[ELF] Hint -z nostart-stop-gc for __start_ undefined references

Make users aware what to do with ld.lld 13.0.0 / GNU ld<2015-10 --gc-sections
behavior.

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

2 years agoReapply "OpenMP: Start calling setTargetAttributes for generated kernels"
Matt Arsenault [Mon, 29 Nov 2021 20:47:42 +0000 (15:47 -0500)]
Reapply "OpenMP: Start calling setTargetAttributes for generated kernels"

This reverts commit 25eb7fa01d7ebbe67648ea03841cda55b4239ab2.

Previous buildbot failures appear to have been a fluke from a dirty
build.

2 years ago[NFC][sanitizer] Use more bytes of sanitizer_stack_store_test pointers
Vitaly Buka [Thu, 2 Dec 2021 02:41:54 +0000 (18:41 -0800)]
[NFC][sanitizer] Use more bytes of sanitizer_stack_store_test pointers

2 years ago[compiler-rt] Fix incorrect variable names used
Leonard Chan [Thu, 2 Dec 2021 19:45:41 +0000 (11:45 -0800)]
[compiler-rt] Fix incorrect variable names used

2 years ago[sanitizer] Start background thread once
Vitaly Buka [Thu, 2 Dec 2021 08:41:41 +0000 (00:41 -0800)]
[sanitizer] Start background thread once

Reviewed By: morehouse

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

2 years ago[Bazel] Remove old macho lld port
Keith Smiley [Thu, 2 Dec 2021 19:24:08 +0000 (11:24 -0800)]
[Bazel] Remove old macho lld port

This code and cmake was removed in https://reviews.llvm.org/D114842

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

2 years ago[asan] Remove confusing workaround
Vitaly Buka [Thu, 2 Dec 2021 08:53:02 +0000 (00:53 -0800)]
[asan] Remove confusing workaround

The goal is to identify the bot and try to fix it.

SetSoftRssLimitExceededCallback is AsanInitInternal as I assume
that only MaybeStartBackgroudThread needs to be delayed to constructors.
Later I want to move MaybeStartBackgroudThread call into sanitizer_common.

If it needs to be reverted please provide to more info, like bot, or details about setup.

Reviewed By: kstoimenov

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

2 years agoSimplify the libcxx std::string_view gdb pretty printer
David Blaikie [Fri, 5 Nov 2021 05:45:55 +0000 (22:45 -0700)]
Simplify the libcxx std::string_view gdb pretty printer

Seems better to rely on the existing formatting, makes the output
smaller/simpler - this is consistent with libstdc++'s std::string_view
pretty printing too.

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

2 years ago[Bazel] Remove old MachO LLD from the Bazel build
Reid Kleckner [Thu, 2 Dec 2021 19:30:26 +0000 (11:30 -0800)]
[Bazel] Remove old MachO LLD from the Bazel build

Updates Bazel files for 9e3552523ebd3385487e01e3e7af37b8c0efaf57

2 years ago[lld-macho] Remove old macho darwin lld
Keith Smiley [Wed, 1 Dec 2021 06:01:07 +0000 (22:01 -0800)]
[lld-macho] Remove old macho darwin lld

During the llvm round table it was generally agreed that the newer macho
lld implementation is feature complete enough to replace the old
implementation entirely. This will reduce confusion for new users who
aren't aware of the history.

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