Commit Graph

406238 Commits

Author SHA1 Message Date
Paul Robinson 8cd61aac00 Revert "[TLI checker] Add more tests"
This reverts commit 2778554971.

Some bots are failing on the updated tests.
2021-12-02 08:31:27 -08:00
David Greene 53adfa8750 [clang] Do not duplicate "EnableSplitLTOUnit" module flag
If clang's output is set to bitcode and LTO is enabled, clang would
unconditionally add the flag to the module.  Unfortunately, if the input were a
bitcode or IR file and had the flag set, this would result in two copies of the
flag, which is illegal IR.  Guard the setting of the flag by checking whether it
already exists.  This follows existing practice for the related "ThinLTO" module
flag.

Differential Revision: https://reviews.llvm.org/D112177
2021-12-02 08:24:56 -08:00
Paul Robinson 2778554971 [TLI checker] Add more tests
D114478 identified testing gaps; this patch fills them.

Differential Revision: https://reviews.llvm.org/D114913
2021-12-02 08:17:16 -08:00
Joseph Huber c99407e31c [OpenMP] Make the new device runtime the default
This patch changes the `-fopenmp-target-new-runtime` option which controls if
the new or old device runtime is used to be true by default.  Disabling this to
use the old runtime now requires using `-fno-openmp-target-new-runtime`.

Reviewed By: JonChesterfield, tianshilei1992, gregrodgers, ronlieb

Differential Revision: https://reviews.llvm.org/D114890
2021-12-02 11:11:45 -05:00
Sanjay Patel 3f8edce447 [InstCombine] add tests for icmp with mul op; NFC 2021-12-02 11:01:10 -05:00
Christian Kühnel 5bd643d31d [clangd] cleanup of header guard names
Renaming header guards to match the LLVM convention.
This patch was created by automatically applying the fixes from
clang-tidy.

I've removed the [NFC]  tag from the title, as we're adding header guards in some files and thus might trigger behavior changes.

Differential Revision: https://reviews.llvm.org/D113896
2021-12-02 15:58:35 +00:00
Florian Hahn 89d645dd3a
[Clang] Fix LTO pipeline test after 770a50b28c. 2021-12-02 15:42:52 +00:00
Florian Hahn 770a50b28c
[AnnotationRemarks] Support generating annotation remarks with -O0.
This matches the legacy pass manager behavior. If remarks are not
enabled the pass is effectively a no-op.
2021-12-02 15:01:02 +00:00
Yitzhak Mandelbaum c006ea6bde [clang-tidy] Fix build broken by commit 6a9487df73 (D113148) 2021-12-02 14:41:00 +00:00
Alexey Bataev 75106413d0 [SLP][NFC]Add a test for extractelements with many uses vectorization, NFC. 2021-12-02 06:30:37 -08:00
David Stuttard 0e8590f065 [AMDGPU] Add support for in-order bvh in waitcnt pass
bvh should be handled separately from vmem and vmem with sampler instructions
for waitcnt handling.

Differential Revision: https://reviews.llvm.org/D114794
2021-12-02 14:26:11 +00:00
David Stuttard 17a3385c35 [AMDGPU] Test for in-order waitcnt insertion for bvh instructions
In-order bvh instructions don't require a waitcnt as order is
guaranteed.

However, waitcnt IS required for other image instruction types vs
bvh.

Pre-commit test for new functionality in https://reviews.llvm.org/D114794

Differential Revision: https://reviews.llvm.org/D114792
2021-12-02 14:25:37 +00:00
Simon Moll e92429d99b [VE][NFC] Cleanup redundant namespace wrapper 2021-12-02 15:23:37 +01:00
Florian Hahn 639a78a4bf
[MemoryLocation] Support strncpy in getForArgument.
The size argument of strncpy can be used as bound for the size of
its pointer arguments.

strncpy is guaranteed to write N bytes and reads up to N bytes.

Reviewed By: xbolva00

Differential Revision: https://reviews.llvm.org/D114871
2021-12-02 14:18:05 +00:00
Tue Ly 32568fc95e [libc] Fix a bug in MPFRUtils making ULP values off by 2^(-mantissaWidth).
Fix a bug in MPFRUtils making ULP values off by 2^(-mantissaWidth) and incorrect eps for denormal numbers.

Differential Revision: https://reviews.llvm.org/D114878
2021-12-02 09:07:46 -05:00
Sanjay Patel 97e921c81f [PatternMatch] create and use matcher for 'not' that excludes undef elements
We needed a stricter version of m_Not for D114462, but I wasn't
sure if that was going to be required anywhere else, so I didn't bother
to make that reusable.

It turns out we have one more existing simplification that needs
this (currently miscompiles):
https://alive2.llvm.org/ce/z/9-nTKi

And there's at least one more fold in that family that we could add.

Differential Revision: https://reviews.llvm.org/D114882
2021-12-02 08:51:13 -05:00
Florian Hahn 9f9e8ba114
[MemoryLocation] Support memset_chk in getForArgument.
The size argument for memset_chk is an upper bound for the size of the
pointer argument. memset_chk may write less than the specified length,
if it exceeds the specified max size and aborts.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D114870
2021-12-02 13:45:58 +00:00
LLVM GN Syncbot a692c5492a [gn build] Port 6a9487df73 2021-12-02 13:40:22 +00:00
Jeroen Dobbelaere 6f08b55213 [flang] GettingInvolved: update LLVM Alias Analysis Technical Call info
The google doc was changed and the calls are now using teams.

Reviewed By: sameeranjoshi

Differential Revision: https://reviews.llvm.org/D114145
2021-12-02 14:36:11 +01:00
Anastasia Stulova f4d3cb4ca8 [HIPSPV] Add CUDA->SPIR-V address space mapping
Add mapping for CUDA address spaces for HIP to SPIR-V
translation. This change allows HIP device code to be
emitted as valid SPIR-V by mapping unqualified pointers
to generic address space and by mapping __device__ and
__shared__ AS to their equivalent AS in SPIR-V
(CrossWorkgroup and Workgroup, respectively).

Cuda's __constant__ AS is handled specially. In HIP
unqualified pointers (aka "flat" pointers) can point to
__constant__ objects. Mapping this AS to ConstantMemory
would produce to illegal address space casts to
generic AS. Therefore, __constant__ AS is mapped to
CrossWorkgroup.

Patch by linjamaki (Henry Linjamäki)!

Differential Revision: https://reviews.llvm.org/D108621
2021-12-02 13:34:27 +00:00
James King 4e9e2f2417 Fix documentation for `forEachLambdaCapture` and `hasAnyCapture`
Updates the return types of these matchers' definitions to use
`internal::Matcher<LambdaCapture>` instead of `LambdaCaptureMatcher`. This
ensures that they are categorized as traversal matchers, instead of narrowing
matchers.

Reviewed By: ymandel, tdl-g, aaron.ballman

Differential Revision: https://reviews.llvm.org/D114809
2021-12-02 13:28:05 +00:00
CJ Johnson 6a9487df73 Add new clang-tidy check for string_view(nullptr)
Checks for various ways that the `const CharT*` constructor of `std::basic_string_view` can be passed a null argument and replaces them with the default constructor in most cases. For the comparison operators, braced initializer list does not compile so instead a call to `.empty()` or the empty string literal are used, where appropriate.

This prevents code from invoking behavior which is unconditionally undefined. The single-argument `const CharT*` constructor does not check for the null case before dereferencing its input. The standard is slated to add an explicitly-deleted overload to catch some of these cases: wg21.link/p2166

https://reviews.llvm.org/D114823 is a companion change to prevent duplicate warnings from the `bugprone-string-constructor` check.

Reviewed By: ymandel

Differential Revision: https://reviews.llvm.org/D113148
2021-12-02 13:25:28 +00:00
Valentin Clement 99961b4f1c
[fir] Declare test function inline
Declare functions checkCallOp and checkCallOpFromResultBox inline due to buildbot failure flang-aarch64-latest-clang
2021-12-02 14:18:43 +01:00
Jamie Schmeiser 2a1bf9e0cf Expand testing of necessary features for print-changed=dot-cfg.
Summary:
Expand the testing for whether the lit tests for print-changed=dot-cfg
are supported to include checking whether dot supports pdf output.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: hvdijk (Harald van Dijk)
Differential Revision: https://reviews.llvm.org/D113187
2021-12-02 08:16:18 -05:00
Matt Devereau 4244f95cc6 [AArch64][SVE] Enable bf16 vector.insert
Allow passthrough bf16 registers for vector.insert

Differential revision: https://reviews.llvm.org/D114858
2021-12-02 12:59:19 +00:00
Simon Moll 3b442644e2 [VE][Clang][NFC] Disable VE toolchain tests on Windows
VE hardware is unsupported under Windows. Disable the clang VE toolchain
tests here. Tests breaking because of non-POSIX path separators.
2021-12-02 13:33:46 +01:00
Djordje Todorovic 2cdc6f2ca6 Reland "[LICM] Hoist LOAD without sinking the STORE"
When doing load/store promotion within LICM, if we
cannot prove that it is safe to sink the store we won't
hoist the load, even though we can prove the load could
be dereferenced and moved outside the loop. This patch
implements the load promotion by moving it in the loop
preheader by inserting proper PHI in the loop. The store
is kept as is in the loop. By doing this, we avoid doing
the load from a memory location in each iteration.

Please consider this small example:

loop {
  var = *ptr;
  if (var) break;
  *ptr= var + 1;
}
After this patch, it will be:

var0 = *ptr;
loop {
  var1 = phi (var0, var2);
  if (var1) break;
  var2 = var1 + 1;
  *ptr = var2;
}
This addresses some problems from [0].

[0] https://bugs.llvm.org/show_bug.cgi?id=51193

Differential revision: https://reviews.llvm.org/D113289
2021-12-02 03:53:50 -08:00
Florian Hahn 47616c8855
[BasicAA] Add tests for memset_pattern{4,8,16}.
This also removes the existing memset_pattern.ll test, which was relying
on GVN. It is also covered by the new test directly.
2021-12-02 11:50:32 +00:00
Simon Pilgrim 6803d08c38 [DAG][PowerPC] Enable initial ISD::BITCAST SimplifyDemandedBits/SimplifyMultipleUseDemandedBits big-endian handling
This patch begins extending handling for peeking through bitcast nodes to big-endian targets as well as the existing little-endian case.

Differential Revision: https://reviews.llvm.org/D114676
2021-12-02 11:47:53 +00:00
Djordje Todorovic 8e757b2383 [LICM] Adding the test as a precommit for the D113289 2021-12-02 03:38:14 -08:00
David Green e629302558 [ARM] Correct range in isLegalAddressImm
The ranges in isLegalAddressImm were off by one, not allowing the
maximum values for unscaled offsets.

Differential Revision: https://reviews.llvm.org/D114636
2021-12-02 11:33:40 +00:00
Frederic Cambus 878ff1f9f8 [llvm-readobj] Add support for machine-independent NetBSD ELF core notes.
Notes generated in NetBSD core files provide additional information about
processes. These notes are described in core.5, which can be viewed here:
https://man.netbsd.org/core.5

Differential Revision: https://reviews.llvm.org/D114635
2021-12-02 12:10:17 +01:00
Florian Hahn 2de5f39e54
[BuildLibCalls] Add support for memset_pattern{4,8}.
Add support for memset_pattern{4,8} similar to the existing
memset_pattern16 handling.

Reviewed By: ab

Differential Revision: https://reviews.llvm.org/D114883
2021-12-02 11:04:25 +00:00
Nikita Popov a0ff26e08c [GlobalOpt] Fix assertion failure during instruction deletion
This fixes the assertion failure reported in https://reviews.llvm.org/D114889#3166417,
by making RecursivelyDeleteTriviallyDeadInstructionsPermissive()
more permissive. As the function accepts a WeakTrackingVH, even if
originally only Instructions were inserted, we may end up with
different Value types after a RAUW operation. As such, we should
not assume that the vector only contains instructions.

Notably this matches the behavior of the
RecursivelyDeleteTriviallyDeadInstructions() function variant which
accepts a single value rather than vector.
2021-12-02 11:58:39 +01:00
Frederic Cambus 69deb1371f Use cc/c++ instead of gcc/g++ on FreeBSD.
All supported FreeBSD platforms do not have GCC in base anymore.

Differential Revision: https://reviews.llvm.org/D114530
2021-12-02 11:52:40 +01:00
David Green 73c50ccf7a [ARM] Add additional postinc distribute tests and regenerate tests. NFC 2021-12-02 10:40:10 +00:00
Kiran Chandramohan 7ce8c6fcf1 [Flang] Replace notifyMatchFailure with TODO hard failures
For unimplemented patterns we revert to using TODO hard failures instead of
notifyMatchFailure.

For fir.select_type revert to using mlir::emiterror.
For the fir.embox TODO on a type with len params we cannot add a test since the type cannot be converted to llvm.

Adding negative tests using not and checking for the error message.
TODO exits with an error in a build without assertion but aborts in a
build with assertions. Abort requires using not with the --crash
option. The two different usages of not is handled by using a custom
command %not_todo_cmd which is converted to not or not --crash
depending on the presence or absence of assertions. Using llvm-config
to check the presence of assertions.

Reviewed By: clementval, awarzynski

Differential Revision: https://reviews.llvm.org/D114371
2021-12-02 10:25:02 +00:00
Simon Moll 6f25e754a0 Revert "Revert "[VE] Make VE official""
This reverts commit 27c9e8b45b.

Bugs exposed by AddressSanitizer have been reproduced and fixed locally:
* commit e37000f3bf
* commit 435d44bf8a
2021-12-02 11:19:37 +01:00
Florian Hahn d9bb9bd4bf
[InferAttrs] Add memset_pattern{4,8} declarations to test. 2021-12-02 10:11:55 +00:00
Fangrui Song c5bfffed48 [ELF] Discard input .note.gnu.build-id even with default --build-id=none
binutils 2.38 will adopt this behavior
https://sourceware.org/bugzilla/show_bug.cgi?id=28639

Reviewed By: ikudrin

Differential Revision: https://reviews.llvm.org/D114910
2021-12-02 09:50:59 +00:00
Florian Hahn 0496edad49
[BuildLibCalls] Add additional attrs to memcpy_chk.
`memcpy_chk` can be treated like `memcpy`, with the exception that it
may not return (if it aborts the program).

See D114793 for a similar patch for `memset_chk`.

Reviewed By: xbolva00

Differential Revision: https://reviews.llvm.org/D114863
2021-12-02 09:50:14 +00:00
Simon Moll e37000f3bf [VE][NFC] Fix use-after-free in PVFMK expansion
There is custom expansion code for packed VFMK Pseudos in the VE
backend.  This code erased the Pseudo without telling
ExpandPostRAPseudos about it, causing the generic expansion function to
access the erased Pseudo.  This bug triggered in the
test/CodeGen/VE/VELIntrinsics/vfmk.ll test with asan-enabled builds.

Detected by:
sanitizer-x86_64-linux-fast
(https://lab.llvm.org/buildbot/#/builders/5/builds/15393)
2021-12-02 10:41:11 +01:00
Lang Hames 905381dc10 [ORC] Fix ambiguous call to overloaded function.
This should fix the build failure at
https://lab.llvm.org/buildbot#builders/110/builds/8359
2021-12-02 20:41:09 +11:00
Kirill Bobyrev d3a4ef3568 [clangd] IncludeClenaer: Don't mark forward declarations of a class if it's declared in the main file
This will mark more headers that are unrelated to used symbol but contain its
forawrd declaration. E.g. the following are examples of headers forward
declaring `llvm::StringRef`:

- clang/include/clang/Basic/Cuda.h
- llvm/include/llvm/Support/SHA256.h
- llvm/include/llvm/Support/TrigramIndex.h
- llvm/include/llvm/Support/RandomNumberGenerator.
- ... and more (~50 in total)

This patch is a reduced version of D112707 which was controversial.

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D114864
2021-12-02 10:26:08 +01:00
Valentin Clement 529d0942da
[fir] Add fir numeric intrinsic runtime call builder
This patch adds the FIR builder to generate the numeric intrinsic
runtime call.

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

Reviewed By: rovka

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: mleair <leairmark@gmail.com>
2021-12-02 10:22:26 +01:00
Nikita Popov 55d392cc30 [llvm-c] Make LLVMAddAlias opaque pointer compatible
Deprecate LLVMAddAlias in favor of LLVMAddAlias2, which accepts a
value type and an address space. Previously these were extracted
from the pointer type.

Differential Revision: https://reviews.llvm.org/D114860
2021-12-02 09:21:16 +01:00
Nikita Popov bc61e5e90b [GlobalOpt] Add test for PR39751 (NFC)
This has been fixed by D114889, as noted in the comments.
2021-12-02 09:17:33 +01:00
mydeveloperday 57b95aed2a [clang-format] Add better support for co-routinues
Responding to a Discord call to help {D113977} and heavily inspired by the unlanded {D34225} add some support to help coroutinues from not being formatted from

```for co_await(auto elt : seq)```

to

```
for
co_await(auto elt : seq)
```

Because of the dominance of clang-format in the C++ community, I don't think we should make it the blocker that prevents users from embracing the newer parts of the standard because we butcher the layout of some of the new constucts.

Reviewed By: HazardyKnusperkeks, Quuxplusone, ChuanqiXu

Differential Revision: https://reviews.llvm.org/D114859
2021-12-02 08:06:43 +00:00
Vitaly Buka 8aabde5a4b [NFC][sanitizer] Check &real_pthread_join
It's a weak function which may be undefined.
2021-12-01 23:59:33 -08:00
Jon Chesterfield fb9fc3c951 [openmp][amdgpu] Disable three tests in preparation for new runtime 2021-12-02 07:57:14 +00:00