Commit graph

398447 commits

Author SHA1 Message Date
Sanjay Patel b041b613e6 [InstCombine] add test for zext with 'or' op; NFC 2021-09-08 09:58:06 -04:00
Sanjay Patel 5639946d89 [InstCombine] remove unnecessary instructions from test; NFC 2021-09-08 09:58:06 -04:00
AndreyChurbanov d40108e0af [OpenMP] libomp: runtime part of omp_all_memory task dependence implementation.
New omp_all_memory task dependence type is implemented.
Library recognizes the new type via either
(dependence_address == NULL && dependence_flag == 0x80)
or
(dependence_address == SIZE_MAX).
A task with new dependence type depends on each preceding task
with any dependence type (kind of a dependence barrier).

Differential Revision: https://reviews.llvm.org/D108574
2021-09-08 16:55:32 +03:00
Michał Górny 2c6d90d741 [lldb] [Commands] Remove 'append' from 'platform file open' mode
Remove File::eOpenOptionAppend from the mode used by 'platform file
open' command.  According to POSIX, O_APPEND causes all successive
writes to be done at the end of the file.  This effectively makes
the offset argument to 'platform file write' meaningless.

Furthermore, apparently O_APPEND is not implemented reliably everywhere.
The Linux manpage for pwrite(2) suggests that Linux does respect
O_APPEND there while according to POSIX it should not, so the actual
behavior would be dependent on how the vFile:pwrite packet is
implemented on the server.

Ideally, the mode used for opening flags would be provided via options.
However, changing the default mode seems to be a reasonable intermediate
solution.

Differential Revision: https://reviews.llvm.org/D107664
2021-09-08 15:28:03 +02:00
Louis Dionne 4e0ea2cf2e [libc++] Use enable_if_t instead of _EnableIf
I just ran into a compiler error involving __bind_back and some overloads
that were being disabled with _EnableIf. I noticed that the error message
was quite bad and did not mention the reason for the overload being
excluded. Specifically, the error looked like this:

     candidate template ignored: substitution failure [with _Args =
     <ContiguousView>]: no member named '_EnableIfImpl' in 'std::_MetaBase<false>'

Instead, when using enable_if or enable_if_t, the compiler is clever and
can produce better diagnostics, like so:

     candidate template ignored: requirement 'is_invocable_v<
          std::__bind_back_op<1, std::integer_sequence<unsigned long, 0>>,
          std::ranges::views::__transform::__fn &, std::tuple<PlusOne> &,
          ContiguousView>' was not satisfied [with _Args = <ContiguousView>]

Basically, it tries to do a poor man's implementation of concepts, which
is already a lot better than simply complaining about substitution failure.

Hence, this commit uses enable_if_t instead of _EnableIf whenever
possible. That is both more straightforward than using the internal
helper, and also leads to better error messages in those cases.

I understand the motivation for _EnableIf's implementation was to improve
compile-time performance, however I believe striving to improve error
messages is even more important for our QOI, hence this patch. Furthermore,
it is unclear that _EnableIf actually improved compile-time performance
in any noticeable way (see discussion in the review for details).

Differential Revision: https://reviews.llvm.org/D108216
2021-09-08 09:09:28 -04:00
Arnab Dutta 1524b01541 [MLIR] Add loop coalesce utility for affine.for
Add loop coalesce utility for affine.for. This expects loops to have
been normalized a-priori. This works for both constant as well non
constant upper bounds having single/multiple result upper bound affine
map.

With contributions from Arnab Dutta and Uday Bondhugula.

Reviewed By: bondhugula, ayzhuang

Differential Revision: https://reviews.llvm.org/D108126
2021-09-08 18:02:23 +05:30
Peter Smith b026ce9c8a [MC] Add Subtarget for MAsmParser call to emitCodeAlignment
The call to emitCodeAlignment was missing a STI which is required
after D45962.

emitCodeAlignment has a default parameter of 0 for MaxBytesToEmit.
Explicitly passing 0 here was interpreted as as nullptr for the STI.
This could possibly be avoided by taking STI as a const reference in
emitCodeAlignment.

Differential Revision: https://reviews.llvm.org/D109425
2021-09-08 13:28:24 +01:00
Simon Pilgrim 35cc4ad354 [X86] Add AVX2 test coverage to combine-concatvectors.ll
This will be useful as part of D109348
2021-09-08 13:26:08 +01:00
Sjoerd Meijer 88a2031207 [FuncSpec] Fix typo in option description. NFC. 2021-09-08 12:58:46 +01:00
David Green d8d24c64fe [DAG] Fix GT -> GE condition when creating SetCC
79845ed6df folded some setcc(ashr) conditions to setcc, but got
the condition for NE incorrect, using GT where it should be using GE.
2021-09-08 12:41:51 +01:00
Sjoerd Meijer a1e8b754eb [FuncSpec] Fix test case: only run funcspec and not any other passes. NFC. 2021-09-08 12:40:58 +01:00
Evgeny Leviant 93b09a2a5d [LiveDebugValues] Handle spills of indirect debug values correctly
When handling register spill for indirect debug value LiveDebugValues pass doesn't add
DW_OP_deref operator which may in some cases cause debugger to return value address, instead
of value while machine register holding that address is spilled.

Differential revision: https://reviews.llvm.org/D109142
2021-09-08 14:06:08 +03:00
Saiyedul Islam 98380762c3 [clang-offload-bundler] Make Bundle Entry ID backward compatible
Earlier BundleEntryID used to be <OffloadKind>-<Triple>-<GPUArch>.
This used to work because the clang-offload-bundler didn't need
GPUArch explicitly for any bundling/unbundling action. With
unbundleArchive it needs GPUArch to ensure compatibility between
device specific code objects. D93525 enforced triples to have
separators for all 4 components irrespective of number of
components, like "amdgcn-amd-amdhsa--". It was required to
to correctly parse a possible 4th environment component or a GPU.
But, this condition is breaking backward compatibility with
archive libraries compiled with compilers older than D93525.

This patch allows triples to have any number of components with
and without extra separator for empty environment field. Thus,
both the following bundle entry IDs are same:
openmp-amdgcn-amd-amdhsa--gfx906
openmp-amdgcn-amd-amdhsa-gfx906

Reviewed By: yaxunl, grokos

Differential Revision: https://reviews.llvm.org/D106809
2021-09-08 16:06:12 +05:30
Fraser Cormack 7fb66d4035 [MemCpyOpt] Fix a variety of scalable-type crashes
This patch fixes a variety of crashes resulting from the `MemCpyOptPass`
casting `TypeSize` to a constant integer, whether implicitly or
explicitly.

Since the `MemsetRanges` requires a constant size to work, all but one
of the fixes in this patch simply involve skipping the various
optimizations for scalable types as cleanly as possible.

The optimization of `byval` parameters, however, has been updated to
work on scalable types in theory. In practice, this optimization is only
valid when the length of the `memcpy` is known to be larger than the
scalable type size, which is currently never the case. This could
perhaps be done in the future using the `vscale_range` attribute.

Some implicit casts have been left as they were, under the knowledge
they are only called on aggregate types. These should never be
scalably-sized.

Reviewed By: nikic, tra

Differential Revision: https://reviews.llvm.org/D109329
2021-09-08 11:21:36 +01:00
David Green caabf2a445 [AArch64] Regenerate some test checks. NFC
This patch just reruns the update_llc_test_checks script on the AArch64
tests claiming to be updated by the script, cleaning up the output.
2021-09-08 11:08:32 +01:00
Michał Górny c01b76e733 [lldb] Support "eflags" register name in generic reg fallback
Enhance the generic register fallback code to support "eflags" register
name in addition to "rflags", as the former is used by gdbserver.  This
permits lldb-server to recognize the generic flags register when
interfacing with gdbserver-style target.xml (i.e. without generic=""
attributes), and therefore aligns ABI plugins' AugmentRegisterInfo()
between lldb-server and gdbserver.

Differential Revision: https://reviews.llvm.org/D108548
2021-09-08 11:33:29 +02:00
Fraser Cormack 2c5568a6a9 [LegalizeTypes][VP] Add promotion support for binary VP ops
This patch extends the preliminary support for vector-predicated (VP)
operation legalization to include promotion of illegal integer vector
types.

Integer promotion of binary VP operations is relatively simple and
piggy-backs on the non-VP logic, but passing the two extra mask and VP
operands through to the promoted operation.

Tests have been added to the RISC-V target to cover the basic scenarios
for integer promotion for both fixed- and scalable-vector types.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D108288
2021-09-08 10:22:57 +01:00
Michał Górny 8872c9d1ca [lldb] [gdb-server] Add tests for more vFile packets
Differential Revision: https://reviews.llvm.org/D107821
2021-09-08 10:58:12 +02:00
Michał Górny 39a2449ea1 [lldb] [Commands] Fix reporting errors in 'platform file read/write'
Fix 'platform file read' and 'platform file write' commands to correctly
detect erraneous return and report it as such.  Currently, errors were
implicitly printed as a return value of -1, and the commands were
assumed to be successful.

Differential Revision: https://reviews.llvm.org/D107665
2021-09-08 10:58:12 +02:00
Michał Górny b07803ee2a [lldb] [Process/FreeBSD] Support SaveCore() using PT_COREDUMP
Differential Revision: https://reviews.llvm.org/D109326
2021-09-08 10:58:12 +02:00
David Green a42bc456c1 [AArch64] Regenerate some test checks. NFC 2021-09-08 09:14:01 +01:00
Cullen Rhodes 89786c2b99 [AArch64][SME] Fix imm bug in mov vector to tile aliases
Also fixes a warning mentioned in D109359.

Reviewed By: sdesmalen

Differential Revision: https://reviews.llvm.org/D109363
2021-09-08 07:42:16 +00:00
Martin Storsjö c5a74c0890 [libcxx] [test] Simplify get_temp_file_name() for mingw
Use the same codepaths as for MSVC. Mingw-w64 does have the _mktemp_s
function; on Vista and newer, msvcrt.dll does contain the function,
which ends up called. (Same thing in the UCRT.) In older versions of
msvcrt.dll (older than what libc++ supports), mingw-w64 provides a
fallback implementation.

This effectively reverts 23323e25f8 (and
d07e5c23b4). That commit tried to fix
unspecified MinGW build breakage.

This reduces the risk of temp name collisions between processes (when
running multiple tests in parallel); the path returned by
GetTempFileName can easily collide with other similar paths.
(_mktemp_s on the other hand tries to avoid such clashes by using
the process id as part of the uniqueness seed.)

This avoids stray random failures in fstreams tests in mingw configurations.

Differential Revision: https://reviews.llvm.org/D98526
2021-09-08 10:24:34 +03:00
Fangrui Song fe6dbe7e95 [WebAssembly][test] Fix lower-em-sjlj-indirect-setjmp.ll after D109375 2021-09-08 00:21:30 -07:00
Sander de Smalen 981f7d563a [AArch64] Implement extract_subvector for predicates.
This patch implements extract_subvector for predicate types when
the input type is more than twice the size of the subvector that
is being extracted.

Reviewed By: CarolineConcatto

Differential Revision: https://reviews.llvm.org/D109314
2021-09-08 08:18:34 +01:00
Fangrui Song 52f739c4ae [ProfileData] Actually fix Clang -Wcovered-switch-default after D109398
The Clang attribute `enum_extensibility(open)` (2017) is too new.
Just use a cast.
2021-09-08 00:15:54 -07:00
Max Kazantsev 29d054bf12 [SimplifyCFG] Preserve knowledge about guarding condition by adding assume
This improvement adds "assume" after removal of branch basing on UB in successor block.

Consider the following example:

```
pred:
  x = ...
  cond = x > 10
  br cond, bb, other.succ

bb:
  phi [nullptr, pred], ... // other possible preds
  load(phi) // UB if we came from pred

other.succ:
  // here we know that x <= 10, but this knowledge is lost
  // after the branch is turned to unconditional unless we
  // preserve it with assume.
```

If we remove the branch basing on knowledge about UB in a successor block,
then the fact that x <= 10 is other.succ might be lost if this condition is
not inferrable from any dominating condition. To preserve this knowledge, we
can add assume intrinsic with (possibly inverted) branch condition.

Patch by Dmitry Bakunevich!

Differential Revision: https://reviews.llvm.org/D109054
Reviewed By: lebedev.ri
2021-09-08 14:05:17 +07:00
Fangrui Song ca867ef47b Revert GCC -Wnon-virtual-dtor workarounds "[SCEV] Fix GCC -Wnon-virtual-dtor" & "[SampleFDO] Fix -Wnon-virtual-dtor"
This reverts commits 4852c770fe and 6df09d6ccb.

After D109404, -Wnon-virtual-dtor will not be added when the host compiler is GCC.
2021-09-08 00:00:33 -07:00
Fangrui Song 813235947d [CMake] Don't add -Wnon-virtual-dtor if affected by GCC PR102168
See the discussion on
https://reviews.llvm.org/rG4852c770fe8703145dd2a35395985646ce57a454
The GCC behavior (https://gcc.gnu.org/PR102168) seems unhelpful.

Unconditional -Wnon-virtual-dtor led to other unnecessary workarounds like
6df09d6ccb

This patches uses a variant of the 4bb5f44c70
check to detect GCC PR102168.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D109404
2021-09-07 23:36:47 -07:00
Fangrui Song b2a885df0d [ProfileData] Fix Clang -Wcovered-switch-default after D109398 2021-09-07 20:58:51 -07:00
Fangrui Song aa4dfba522 [ELF] Infer EM_HEXAGON in getBitcodeMachineKind 2021-09-07 20:46:37 -07:00
Wei Mi 8eb617d719 [SampleFDO] Allow forward compatibility when adding a new section for extbinary
format.

Currently when we add a new section in the profile format and generate a profile
containing the new section, older compiler which reads the new profile will
issue an error. The forward incompatibility can cause unnecessary churn when
extending the profile. This patch removes the incompatibility when adding a new
section for extbinary format.

Differential Revision: https://reviews.llvm.org/D109398
2021-09-07 19:38:43 -07:00
Justin Latimer b0d4d969e2 [AVR] Add support for the tinyAVR 0-series and tinyAVR 1-series
Reviewed By: Dylan McKay, Ben Shi

Differential Revision: https://reviews.llvm.org/D103136
2021-09-08 02:35:26 +00:00
Ben Shi f0460fa4eb [AArch64] Improve target hook function to decide folding (mul (add x, c1), c2)
Prevent the folding if it leads to worse code.

Reviewed By: dmgreen, kda

Differential Revision: https://reviews.llvm.org/D108871
2021-09-08 01:51:26 +00:00
Wang, Pengfei 9d7d34c769 [X86][MS] Fix the aligement mismatch of vector variable arguments on Win32
The alignment of vector variable arguments in callee side is 4, which is
aligned with MSVC. But the caller aligns them to the size of vector
arguments. It results in run fails. This patch fixes this problem by
trimming it to 4 bytes for variable arguments on Win32.

Fixed vector arguments are passed by pointer on Win32. So they don't have
the problem.

I don't find a doc in MSDN for this calling conversion, so I did several
experiments here: https://godbolt.org/z/n1zn1Gx1z

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D108887
2021-09-08 09:26:44 +08:00
Matheus Izvekov 68b9d8ed7a [clang] fix transformation of template arguments of 'auto' type constraints
See PR48617.

When assigning the new template arguments to the new TypeLoc, we were looping
on the argument count of the original TypeLoc instead of the new one,
which can be different when packs are present.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D109406
2021-09-08 03:22:34 +02:00
Usman Nadeem 9f5993d110 [NFC] Recommit "Regenerate SVE ACLE intrinsics tests"" 2nd try
This reverts 61ddc3d3db to reapply
91eda9c30f after fixing the " |& "
causing failures on windows.

Change-Id: Ib646c803b2274f0f24f9a8932de7aa97003529c5
2021-09-07 17:22:23 -07:00
Yuanfang Chen 61d1cce2f8 PR45881: Properly use CXXThisOverride for templated lambda
- `this` used in lambda expression parameter declarations needs no capture.
- Set up CXXThisOverride for default template arguments of a lambda.

A similar fix to this is c3d2ebb60f.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D102531
2021-09-07 17:02:24 -07:00
Yuanfang Chen 79c00d3f54 [NPM] Make AddDiscriminators pass required
This is to make sure the pass is not skipped at O0 where optnone is
applied to functions by default.
2021-09-07 17:02:24 -07:00
Philip Reames 6cdca906c7 [SCEV] Use no-self-wrap flags infered from exit structure to compute trip count
The basic problem being solved is that we largely give up when encountering a trip count involving an IV which is not an addrec. We will fall back to the brute force constant eval, but that doesn't have the information about the fact that we can't cycle back through the same set of values.

There's a high level design question of whether this is the right place to handle this, and if not, where that place is. The major alternative here would be to return a conservative upper bound, and then rely on two invocations of indvars to add the facts to the narrow IV, and then reconstruct SCEV. (I have not implemented the alternative and am not 100% sure this would work out.) That's arguably more in line with existing code, but I find this substantially easier to reason about.  During review, no one expressed a strong opinion, so we went with this one.

Differential Revision: D108651
2021-09-07 17:00:02 -07:00
David Green 6b53817e71 [AArch64] Regenerate some test checks. NFC 2021-09-08 00:00:56 +01:00
Heejin Ahn a1d522939c [WebAssembly] Error out on indirect uses of setjmp
Both Wasm & Emscripten SjLj handling has a restriction that `setjmp`
cannot be called indirectly. I thought we have been erroring out on
indirect uses of `setjmp`, but some recent CL disrupted the logic and
we are not erroring out anymore.

We currently
1. Collect functions that contain `setjmp` calls in `SetjmpUsers`. This
   only counts direct calls:
   8f77dc459e/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp (L869-L878)
2. Run `runSjLjOnFunction` only on those `SetjmpUsers`. Within
   `runSjLjOnFunction`, if we see an indirect use of `setjmp`, we error
   out:
   8f77dc459e/llvm/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp (L1218-L1221)

So if there are only indirect setjmp calls within the module,
`SetjmpUsers` will be empty, and `runSjLjOnFunction` is not even entered
once. And the indirect `setjmp` call will error out at link time. So in
this CL we check for the indirect uses of `setjmp` upfront before we
enter `runSjLjOnFunction`.

Also this currently errors out on `invoke @setjmp`, which can only occur
when using Wasm EH + Wasm SjLj within a function. We recently added Wasm
SjLj support but we don't support using Wasm EH + Wasm SjLj in the same
function yet. We plan to add this support very soon, so I don't think
it's worth creating another test file just for this. (This is an error
test so it needs its own file)

Reviewed By: dschuff

Differential Revision: https://reviews.llvm.org/D109375
2021-09-07 15:52:58 -07:00
Arthur Eubanks 39e2e3bddb [NFC][C API] Make LLVMSetInstrParamAlignment's index param type LLVMAttributeIndex
It's the same as unsigned, but clearer in intent.
2021-09-07 15:13:45 -07:00
Artem Dergachev dcde8fdeeb [clang-tidy] bugprone-infinite-loop: Fix false positives with volatile addresses.
Low-level code may occasionally deal with direct access by concrete addresses
such as 0x1234. Values at these addresses act like globals: they can change
at any time. They typically wear volatile qualifiers.

Suppress all warnings on loops with conditions that involve casting anything to
a pointer-to-...-pointer-to-volatile type.

The closely related bugprone-redundant-branch-condition check
doesn't seem to be affected. Add a test just in case.

Differential Revision: https://reviews.llvm.org/D108808
2021-09-07 15:10:46 -07:00
Arthur Eubanks eeabd90efd [NFC] Cleanup off by one indexes in CallBase::dataOperandHasImpliedAttr()
Verified that previously nothing was calling dataOperandHasImpliedAttr()
with AttributeList::ReturnIndex even though we had a code path for it.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D109390
2021-09-07 14:52:12 -07:00
peter klausler 43a263f570 [flang] Implement semantic checks for ELEMENTAL subprograms
Adds missing semantic checks for ELEMENTAL functions and subroutines,
their dummy arguments, and their results from F'2018 15.8.1 C15100-15102.

Differential Revision: https://reviews.llvm.org/D109380
2021-09-07 14:37:23 -07:00
Aart Bik d02e12fadf [mlir][sparse] fix typos
Perhaps one of these days I will actually learn how to spell opaque....

Reviewed By: bixia

Differential Revision: https://reviews.llvm.org/D109391
2021-09-07 14:20:05 -07:00
Siva Chandra Reddy 2bf8be79b1 [libc][NFC] Add fenv and string headers to x86_64 headers list. 2021-09-07 21:06:39 +00:00
Nico Weber b32506cb86 Revert "[gn build] Add a file that should have been in cfe02847496b856aa"
This reverts commit 6be7f5c354.
We'll need this file eventually, but it in fact shouldn't have been in
cfe0284749. It's currently unreferenced.
2021-09-07 17:01:48 -04:00
Nico Weber d4071b2777 [gn build] Try to fix win build after cfe0284749 2021-09-07 16:58:57 -04:00