Commit Graph

415295 Commits

Author SHA1 Message Date
Michael Kruse ad84c6f657 [polly] Match function definitions and header declarations. NFC.
Ensure that function definitions match their declrations in header
files, even if they have no effect on linking. This includes

 1. Both have the same __isl_* annotations

 2. Both use the same type alias

 3. Remove unused declarations that have no definition

 4. Use explicit polly namespace qualifier for definitions; generally,
    the .cpp file should use at most an anon namespace region since
    only symbols declared in the header file can be accessed from other
    translation units anyway. For defintions that have been declared in
    the header file, the explicit namespace qualifier ensures that both
    match.
2022-02-16 12:52:17 -06:00
Lei Zhang e027c00821 [mlir][tensor] Add a pattern to split tensor.pad ops
This commit adds a pattern to wrap a tensor.pad op with
an scf.if op to separate the cases where we don't need padding
(all pad sizes are actually zeros) and where we indeed need
padding.

This pattern is meant to handle padding inside tiled loops.
Under such cases the padding sizes typically depend on the
loop induction variables. Splitting them would allow treating
perfect tiles and edge tiles separately.

Reviewed By: nicolasvasilache

Differential Revision: https://reviews.llvm.org/D117018
2022-02-16 13:43:57 -05:00
Jonas Devlieghere 6f1ce046fd [lldb] BreakpointResolver::CreateFromStructuredData Gardening (NFC)
- Use an early return.
 - Check for error.Fail() instead of !error.Success().
 - Check the resolver pointer before using instead of relying on the
   error being set.
2022-02-16 10:38:05 -08:00
Jonas Devlieghere 046b772c78 [lldb] Default initialize DWARFDebugMacroHeader
Default initialize the DWARFDebugMacroHeader to avoid returning a header
with uninitialized variables from DWARFDebugMacroHeader::ParseHeader.
2022-02-16 10:38:05 -08:00
Michał Górny 2c5c243bb5 [llvm] [bindings/OCaml] Remove unused dep on ounit2
Remove the dependency on ounit2 and the relevant lit code.  It seems
that ounit2 is not used at all and all OCaml binding tests pass without
it installed.

Thanks for Shiwei Weng and Josh Berdine for bringing this to
my attention.

Differential Revision: https://reviews.llvm.org/D119884
2022-02-16 19:30:25 +01:00
Michał Górny 5244ef0faf [libcxxabi] [test] Depend on unwind only if available
When building libcxxabi via LLVM_ENABLE_RUNTIMES=libcxxabi the CMake
invocation fails because of missing "unwind" target.  However,
if the extraneous dependency is removed, the library builds just fine
against installed libunwind and tests work fine.  To fix this,
add the dependency only if the target actually exists.

Differential Revision: https://reviews.llvm.org/D119538
2022-02-16 19:30:25 +01:00
Arthur Eubanks b5c9512df2 [test] Mark archive-as-start-lib.s as unsupported on Windows
gnuwin32 tail does not support the `tail -c +9` syntax.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D119956
2022-02-16 10:27:43 -08:00
Kevin P. Neal db7eb9c108 Add an include that is required on some hosts. This should fix the bot
failures.
2022-02-16 13:10:14 -05:00
Haowei Wu 1af309d0c2 [ifs] Add the invalid STRSZ test to llvm-ifs
This patch adds an addition test to test llvm-ifs's behavior when
DT_STRSZ value from .dynamic is invalid

Differential Revision: https://reviews.llvm.org/D119741
2022-02-16 09:58:27 -08:00
Nico Weber 7d5edfaa57 [gn build] (semi-manually) port f87aa19be6 2022-02-16 12:56:02 -05:00
Louis Dionne f87aa19be6 [libc++] Move everything related solely to _LIBCPP_ASSERT to its own file
This is the first step towards disentangling the debug mode and assertions
in libc++. This patch doesn't make any functional change: it simply moves
_LIBCPP_ASSERT-related stuff to its own file so as to make it clear that
libc++ assertions and the debug mode are different things. Future patches
will make it possible to enable assertions without enabling the debug
mode.

Differential Revision: https://reviews.llvm.org/D119769
2022-02-16 12:49:50 -05:00
Fangrui Song ae62aaa171 [ELF][test] Add --undefine-glob test to lto/duplicated.ll 2022-02-16 09:40:55 -08:00
Kevin P. Neal 8290f2535b [FPEnv][FMF] Move helper function to header, move fast math flags to new include file.
In a prior review I was asked to move the helper function canIgnoreSNaN()
out to FPEnv.h. This wasn't possible at the time because that function
needs the fast math flags, and including them includes lots of other stuff
that isn't needed.

This patch moves the fast math flags out into a new FMF.h file unchanged,
and moves the helper function out to FPEnv.h also unchanged. This ticket
only moves code around.

Differential Revision: https://reviews.llvm.org/D119752
2022-02-16 12:34:53 -05:00
Rashmi Mudduluru 572e2cd56a Reverting ce420820c8 because it fails expensive checks 2022-02-16 09:25:53 -08:00
Craig Topper cfbbcc544c [RISCV] Improve lowering of SHL_PARTS/SRL_PARTS/SRA_PARTS.
Part of the shift lowering creates a (sub XLEN-1, ShAmt). When this
value is used we know that ShAmt is [0..XLEN-1]. Since XLEN is a power
of 2 we can replace the sub with an xor. This allows us to use XORI
instead of LI+SUB.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D119411
2022-02-16 09:22:11 -08:00
Craig Topper 1daa66d3fd [SelectionDAG] Add SPLAT_VECTOR to SelectionDAG::isConstantFPBuildVectorOrConstantFP.
Matches what is done for the int version.

Reviewed By: sdesmalen

Differential Revision: https://reviews.llvm.org/D119793
2022-02-16 09:22:11 -08:00
Sanjay Patel f150d295da [InstCombine] add tests for min/max reassociation; NFC
D119851
2022-02-16 12:16:24 -05:00
Christopher Di Bella c5a20b5182 [llvm-libgcc] initial commit
Note: the term "libgcc" refers to the all of `libgcc.a`, `libgcc_eh.a`,
and `libgcc_s.so`.

Enabling libunwind as a replacement for libgcc on Linux has proven to be
challenging since libgcc_s.so is a required dependency in the [Linux
standard base][5]. Some software is transitively dependent on libgcc
because glibc makes hardcoded calls to functions in libgcc_s. For example,
the function `__GI___backtrace` eventually makes its way to a [hardcoded
dlopen to libgcc_s' _Unwind_Backtrace][1]. Since libgcc_{eh.a,s.so} and
libunwind have the same ABI, but different implementations, the two
libraries end up [cross-talking, which ultimately results in a
segfault][2].

To solve this problem, libunwind needs to build a “libgcc”. That is, link
the necessary functions from compiler-rt and libunwind into an archive
and shared object that advertise themselves as `libgcc.a`, `libgcc_eh.a`,
and `libgcc_s.so`, so that glibc’s baked calls are diverted to the
correct objects in memory. Fortunately for us, compiler-rt and libunwind
use the same ABI as the libgcc family, so the problem is solvable at the
llvm-project configuration level: no program source needs to be edited.
Thus, the end result is for a user to configure their LLVM build with a
flag that indicates they want to archive compiler-rt/unwind as libgcc.
We achieve this by compiling libunwind with all the symbols necessary
for compiler-rt to emulate the libgcc family, and then generate symlinks
named for our "libgcc" that point to their corresponding libunwind
counterparts.

We alternatively considered patching glibc so that the source doesn't
directly refer to libgcc, but rather _defaults_ to libgcc, so that a
system preferring compiler-rt/libunwind can point to these libraries
at the config stage instead. Even if we modified the Linux standard
base, this alternative won't work because binaries that are built using
libgcc will still end up having crosstalk between the differing
implementations.

This problem has been solved in this manner for [FreeBSD][3], and this
CL has been tested against [Chrome OS][4].

[1]: https://github.com/bminor/glibc/blob/master/sysdeps/arm/backtrace.c#L68
[2]: https://bugs.chromium.org/p/chromium/issues/detail?id=1162190#c16
[3]: https://github.com/freebsd/freebsd-src/tree/main/lib/libgcc_s
[4]: https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/2945947
[5]: https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/libgcc-s.html

Differential Revision: https://reviews.llvm.org/D108416
2022-02-16 17:06:45 +00:00
Jonas Devlieghere 0c58e9f4a4 [lldb] Fix memory leak in CommandObjectType
Avoid leaking the ScriptAddOptions or SynthAddOptions when we return
early because of an empty type name.
2022-02-16 09:05:08 -08:00
Louis Dionne 2e3bb910e3 [runtimes] Move warning messages for FOO_SYSROOT & friends above their default value
Otherwise, the warnings always trigger.
2022-02-16 12:00:34 -05:00
Jameson Nash 9d59cfc67e clang-analyzer plugins require LLVM_ENABLE_PLUGINS also
The clang-analyzer plugins are not linked to a particular tool, so they
can only be compiled if plugins are broadly supported. We could opt
instead to decide whether to link them to specifically against clang or
with undefined symbols, depending on the value of LLVM_ENABLE_PLUGINS,
but we do not currently expect there to be a use case for that rather
niche configuration.

Differential Revision: https://reviews.llvm.org/D119591
2022-02-16 11:59:09 -05:00
Nathan Sidwell fbf7bbcb83 [demangler] Fix build breakage
The copy and pristine versions of Utility diverged and one didn't
include <algorithm>.  As that's a rather large header, let's just open
code the comparisons.

Reviewed By:

Differential Revision: https://reviews.llvm.org/
2022-02-16 08:57:37 -08:00
Joseph Huber 5781839f7a Revert "[OpenMP] Pass AMDGPU math libraries into the linker wrapper"
This hits an assertion in the linker wrapper. Revert for now, will fix
later.

This reverts commit 61fb260d9d.
2022-02-16 11:54:44 -05:00
Dmitry Preobrazhensky 6655c5a6bb [AMDGPU][MC][GFX10] Added an alias for HW_REG_HW_ID1
Enabled HW_REG_HW_ID as an alias for HW_REG_HW_ID1. This is required for compatibility with existing code.

Differential Revision: https://reviews.llvm.org/D119939
2022-02-16 19:45:44 +03:00
Joseph Huber 61fb260d9d [OpenMP] Pass AMDGPU math libraries into the linker wrapper
This patch passes in the AMDPGU math libraries to the linker wrapper.
The wrapper already handles linking OpenMP bitcode libraries via the
`--target-library` option. This should be sufficient to link in math
libraries for the accompanying architecture.

Fixes #53526.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D119841
2022-02-16 11:39:11 -05:00
Adrian Prantl 0604d86c07 Darwin: introduce a global override for debug prefix map entries.
This patch adds a new Darwin clang driver environment variable in the
spirit of RC_DEBUG_OPTIONS, called RC_DEBUG_PREFIX_MAP, which allows a
meta build tool to add one additional -fdebug-prefix-map entry without
the knowledge of the build system.

rdar://85224675

Differential Revision: https://reviews.llvm.org/D119850
2022-02-16 08:36:26 -08:00
Louis Dionne 9a460b848f [libc++][ci] Allow updating packages and config files on macOS CI nodes 2022-02-16 11:24:24 -05:00
Lei Huang 5abe6c312b [PowerPC] Rename PPCInstrPrefix.td to PPCInstrP10.td 2022-02-16 10:22:41 -06:00
Lei Zhang 0edb412773 [mlir][linalg] Add control to pad-slice swap pattern
The pad-slice swap pattern generates `scf.if` and `tensor.generate`
to guard against zero-sized slices if it cannot prove the slice is
always non-zero. This is safe but quite conservative. It can be
unnecessary for cases where we know by problem definition such cases
does not exist, even if with dynamic shaped ops or unknown tile/slice
sizes, e.g., convolution padding size = 1 with kernel dim size = 3.

So this commit introduces a control to the pattern to specify
whether to generate the if constructs to handle such cases better,
given that once the if constructs is materialized, it's very hard
to analyze and simplify.

Reviewed By: mravishankar

Differential Revision: https://reviews.llvm.org/D117017
2022-02-16 11:19:35 -05:00
Benjamin Kramer 27cd2a6284 [mlir][MemRef] Lower memref.copy with an offset to memcpy
memcpy can handle them as long as they're contiguous.

Differential Revision: https://reviews.llvm.org/D119938
2022-02-16 17:18:31 +01:00
Arthur O'Dwyer 37f7e31015 [libc++] [test] Qualify calls to std::get(tuple). NFC.
It actually *is* important (for structured bindings) that `get(tuple)`
be ADL-able; but that's not the point of this test in particular.

Reviewed as part of D119860.
2022-02-16 11:03:35 -05:00
Arthur O'Dwyer 79dc7551d8 [libc++] [test] Qualify calls to std::rethrow_exception. NFC.
We shouldn't be calling `rethrow_exception` via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
this ADL ability of `rethrow_exception` in particular.

Reviewed as part of D119860.
2022-02-16 11:03:34 -05:00
Arthur O'Dwyer f033bf88b4 [libc++] [test] Qualify calls to std::atomic_flag_{clear,test} functions. NFCI.
We shouldn't be calling these functions via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
the ADL ability of these functions in particular.

Reviewed as part of D119860.
2022-02-16 11:03:34 -05:00
Arthur O'Dwyer 98bb747c87 [libc++] [test] Qualify calls to std::getline. NFCI.
Reviewed as part of D119860.
2022-02-16 11:03:33 -05:00
Arthur O'Dwyer eae745c18e [libc++] [test] Qualify calls to iomanip functions in std/input.output/iostream.format/. NFCI.
Reviewed as part of D119860.
2022-02-16 11:03:33 -05:00
Arthur O'Dwyer 85a92deb59 [libc++] [test] Qualify calls to iomanip functions in std/localization/. NFCI.
Reviewed as part of D119860.
2022-02-16 11:03:32 -05:00
Arthur O'Dwyer 3b966c1fe9 [libc++] [test] Qualify `prev` as `std::prev` in a lot of tests. NFCI.
We shouldn't be calling `prev` via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
this ADL ability of `prev` in particular.

Reviewed as part of D119860.
2022-02-16 11:03:32 -05:00
Arthur O'Dwyer 5ffe11a9fc [libc++] [test] Qualify `next` as `std::next` in a lot of tests. NFCI.
We shouldn't be calling `next` via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
this ADL ability of `next` in particular.

Reviewed as part of D119860.
2022-02-16 11:03:31 -05:00
Arthur O'Dwyer 7853371146 [libc++] [test] Qualify `move` as `std::move` in a lot of tests. NFCI.
We shouldn't be calling `move` via ADL -- and neither should anybody
in the wild be calling it via ADL, so it's not like we need to test
this ADL ability of `move` in particular.

Reviewed as part of D119860.
2022-02-16 11:03:31 -05:00
Arthur O'Dwyer 3f3abaf40a [libc++] LWG2148, LWG2543: Enable std::hash<Enum> in C++03 and C++11.
Fixes #49601.

Differential Revision: https://reviews.llvm.org/D119891
2022-02-16 11:01:49 -05:00
Arthur O'Dwyer 3581fd32ee [libc++] [test] Remove `using std::any{,_cast}` from std/utilities/any/. NFCI.
Differential Revision: https://reviews.llvm.org/D119863
2022-02-16 11:00:02 -05:00
Arthur O'Dwyer 2b2ee24d53 [libc++] [test] Remove `using std::{make_,}optional` from the optional tests.
Drive-by remove some use of raw `new`, and expand test coverage a tiny bit.

Differential Revision: https://reviews.llvm.org/D119861
2022-02-16 10:59:43 -05:00
Philip Reames b59f135f16 Precommit tests from D119844, expanded with additional coverage 2022-02-16 07:55:43 -08:00
Arthur O'Dwyer 597f2bcee8 [clang] [test] [NFC] Eliminate some hard tabs in tests
"cxx2b-consteval-if.cpp" was showing up misindented.
2022-02-16 10:42:58 -05:00
Vladislav Khmelevsky 729d29e167 [BOLT] Update dynamic relocations from section relocations
This patch changes patchELFAllocatableRelaSections from going through
old relocations sections and update the relocation offsets to emitting
the relocations stored in binary sections. This is needed in case we
would like to remove and add dynamic relocations during BOLT work and it
is used by golang support pass. Note: Currently we emit relocations in
the old sections, so the total number of them should be equal or less
of old number.

Testing: No special tests are neeeded, since this patch does not fix
anything or add new functionality (it only prepares to add). Every
PIC-compiled test binary will use this code and thus become a test.
But just in case the aarch64 dynamic relocations tests were added.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

Reviewed By: maksfb

Differential Revision: https://reviews.llvm.org/D117612
2022-02-16 18:40:54 +03:00
Nikita Popov c9032f1a69 [LowerMemIntrinsics] Explicitly use i8 type in memmove lowering
By convention, memcpy/memmove intrinsics are always used with i8
pointers (though this is not enforced), so in practice this code
was always using an i8 type. Make that explicit.

Of course, i8 is not a very profitable choice, and this code could
be more performant by picking an appropriate larger type. But that
would require additional test coverage and correctness review, and
certainly shouldn't be a decision based on the pointer element type.
2022-02-16 16:31:55 +01:00
Louis Dionne 8f7f3c1f99 [libc++] Pass -fcxx-modules during our modules builds
Otherwise, AppleClang ignores -fmodules entirely, so we are not actually
testing anything.

Differential Revision: https://reviews.llvm.org/D119862
2022-02-16 10:30:23 -05:00
Sven van Haastregt 6690b7d3ac [OpenCL] Ensure atomic_init is guarded with extension
The named and generic address space overloads for atomic_init added
by 50f8abb9f4 ("[OpenCL] Add OpenCL 3.0 atomics to
-fdeclare-opencl-builtins", 2022-02-11) were not guarded by the
corresponding extensions.
2022-02-16 15:12:23 +00:00
Kevin P. Neal c7400892ca [FPEnv][InstSimplify] Fold fsub X, -0 ==> X, when we know X is not -0
Currently the fsub optimizations in InstSimplify don't know how to fold
X - -0.0 to X when we know X is not zero and the constrained intrinsics
are used. This adds the support.

This review is split out from D107285.

Differential Revision: https://reviews.llvm.org/D119746
2022-02-16 10:10:13 -05:00
Tue Ly f1ec99f973 [libc] Improve hypotf performance with different algorithm correctly rounded to all rounding modes.
Algorithm for hypotf: compute (a*a + b*b) in double precision, then use Dekker's algorithm to find the rounding error, and then correcting it after taking its square-root.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D118157
2022-02-16 09:48:51 -05:00