Commit graph

426690 commits

Author SHA1 Message Date
Guillaume Chatelet d9b8d13f8b [NFC][Alignment] Use MaybeAlign in CGCleanup/CGExpr 2022-06-14 10:56:36 +00:00
Guillaume Chatelet 77bba68de6 [NFC][Alignment] Use Align in CoroFrame 2022-06-14 10:56:36 +00:00
Guillaume Chatelet c0e85f1c3b [NFC][Alignment] Use Align in SafeStack 2022-06-14 10:56:36 +00:00
Guillaume Chatelet 6725d80640 [NFC][Alignment] Use Align in shouldAlignPointerArgs 2022-06-14 10:56:36 +00:00
Guillaume Chatelet 6fd480d957 [NFC][Alignment] use getAlign in AddressSanitizer 2022-06-14 10:56:36 +00:00
Jay Foad e0ae4b50fe [AMDGPU] Add GFX11 llvm-objdump tests 2022-06-14 11:39:50 +01:00
Jun Zhang 781ee538da
Reland "[CodeGen] Keep track info of lazy-emitted symbols in ModuleBuilder"
This reverts commits:
d3ddc251ac
d90eecff5c

This relands below commit with asan fix:

The intent of this patch is to selectively carry some states over to
the Builder so we won't lose the information of the previous symbols.

This used to be several downstream patches of Cling, it aims to fix
errors in Clang Interpreter when trying to use inline functions.
Before this patch:

clang-repl> inline int foo() { return 42;}
clang-repl> int x = foo();

JIT session error: Symbols not found: [ _Z3foov ]
error: Failed to materialize symbols:
{ (main, { x, $.incr_module_1.__inits.0, __orc_init_func.incr_module_1 }) }

Co-authored-by: Axel Naumann <Axel.Naumann@cern.ch>
Signed-off-by: Jun Zhang <jun@junz.org>

Differential Revision: https://reviews.llvm.org/D127730
2022-06-14 18:36:03 +08:00
Rosie Sumpter 2c4e44752d [AArch64][SME] Add load/store intrinsics
This patch adds implementations for the load/store SME ACLE intrinsics:
  - @llvm.aarch64.sme.ld1*
  - @llvm.aarch64.sme.st1*

Differential Revision: https://reviews.llvm.org/D127210
2022-06-14 11:11:22 +01:00
Dmitry Preobrazhensky 365d827f65 [AMDGPU][MC][GFX11] Correct ds_swizzle_b32
Enable offset parsing.

Differential Revision: https://reviews.llvm.org/D127404
2022-06-14 12:58:03 +03:00
Alon Kom 3397236c4e
[SCEV] Add tests where assumes can be used to improve trip multiple.
Add tests combing assume on trip count divisibility (tc % vf) and minimum values (tc > N).
Github issue #55645

Reviewed By: fhahn

Differential Revision: https://reviews.llvm.org/D126460
2022-06-14 10:50:22 +01:00
Pavel Labath cf2c8e419d [lldb] Fix TestDyldExecLinux with xml enabled
NativeProcessLinux is not able to properly read libraries-svr4 data when
running with ld.so as the "main" executable. Normally, this is not a big
problem, as it returns an error message, and lldb can fallback to manual
library loading.

Unfortunately, lldb-server also does not clear cached svr4 data on exec,
which means that it does *not* return an error when the application
execs from the "regular" to the "ld.so" mode. Instead it returns
incorrect data (it is missing the main executable) and causes
TestDyldExecLinux to fail (but only when building with xml support
enabled).

This patch makes ensures that cached process data is cleared on exec,
fixing the test. Since TestDyldExecLinux has shown to be sensitive to
the way we read library info, I fork it into two (with svr4 enabled and
disabled).
2022-06-14 11:44:59 +02:00
Florian Hahn 782e912246
[ConstraintElimination] Support constraints with only const ops.
Remove the early exit if both constraints contain no variables. This
restriction is unnecessayr for correctness and removing it simplifies
handling of trivial constant conditions in follow-up changes.
2022-06-14 10:37:12 +01:00
gbreynoo c4a35c78aa [llvm-cxxfilt] Add description for --types in help text
It appears that in the move to tablegen the description of --types was
lost:
https://reviews.llvm.org/D105605

This change adds the missing description.

Differential revision: https://reviews.llvm.org/D127656
2022-06-14 10:32:56 +01:00
Jean Perier 9de831aa2c
Add lowering TODO for bindings returning derived types or arrays
Codegen does not support fir.addressof of functions returning derived
types, arrays are descriptors inside GlobalOp region.

This is because the  abstract-result-opt is required to rewrite such
functions (a hidden argument must be added), but this pass is meant to
run in GlobalOp currently.

Such fir.address_of may be created when lowering procedure pointers
initial value (TODO), or when creating derived type descriptors for
types with bindings.

Add a TODO in lowering until abstract-result-opt is modified to run
on GlobalOp too.

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

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D127722
2022-06-14 10:48:44 +02:00
Balazs Benics 9da697e1bc Reland "[analyzer] Deprecate the unused 'analyzer-opt-analyze-nested-blocks' cc1 flag"
It was previously reverted by 8406839d19.

---

This flag was introduced by
6818991d71
    commit 6818991d71
    Author: Ted Kremenek <kremenek@apple.com>
    Date:   Mon Dec 7 22:06:12 2009 +0000

  Add clang-cc option '-analyzer-opt-analyze-nested-blocks' to treat
  block literals as an entry point for analyzer checks.

The last reference was removed by this commit:
5c32dfc5fb

    commit 5c32dfc5fb
    Author: Anna Zaks <ganna@apple.com>
    Date:   Fri Dec 21 01:19:15 2012 +0000

  [analyzer] Add blocks and ObjC messages to the call graph.
  This paves the road for constructing a better function dependency graph.
  If we analyze a function before the functions it calls and inlines,
  there is more opportunity for optimization.
  Note, we add call edges to the called methods that correspond to
  function definitions (declarations with bodies).

Consequently, we should remove this dead flag.
However, this arises a couple of burning questions.
 - Should the `cc1` frontend still accept this flag - to keep
   tools/users passing this flag directly to `cc1` (which is unsupported,
   unadvertised) working.
 - If we should remain backward compatible, how long?
 - How can we get rid of deprecated and obsolete flags at some point?

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D126067
2022-06-14 10:22:37 +02:00
Denis Antrushin c0e965e222 [Statepoints] FixupStatepoint: Clear isKill flag if COPY is not deleted.
When spilling CSRs, FixupStatepoint pass does simple copy propagation,
trying to find COPY instruction which defines register being spilled
and spill COPY source instead. I.e., if we have CSR $x and found
  $x = COPY $y
we will spill $y instead.
But we may be unable to delete COPY instruction for some reason.
Then, spill will be inserted after it, adding another use of $y.
If COPY instruction was last use of $y (killed it), after insertion of
the spill it is not, so `isKill` flag must be cleared. We failed to do
so and this patch fixes this issue.

Reviewed By: skatkov

Differential Revision: https://reviews.llvm.org/D127308
2022-06-14 10:52:32 +03:00
Balazs Benics 24bd47dc17 [analyzer][NFC] Inline AnalyzerOptions::getUserMode()
When I read the code I found it easier to reason about if `getUserMode`
is inlined. It might be a personal preference though.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D127486
2022-06-14 09:42:58 +02:00
Balazs Benics ffe7950ebc Reland "[analyzer] Deprecate -analyzer-store region flag"
I'm trying to remove unused options from the `Analyses.def` file, then
merge the rest of the useful options into the `AnalyzerOptions.def`.
Then make sure one can set these by an `-analyzer-config XXX=YYY` style
flag.
Then surface the `-analyzer-config` to the `clang` frontend;

After all of this, we can pursue the tablegen approach described
https://discourse.llvm.org/t/rfc-tablegen-clang-static-analyzer-engine-options-for-better-documentation/61488

In this patch, I'm proposing flag deprecations.
We should support deprecated analyzer flags for exactly one release. In
this case I'm planning to drop this flag in `clang-16`.

In the clang frontend, now we won't pass this option to the cc1
frontend, rather emit a warning diagnostic reminding the users about
this deprecated flag, which will be turned into error in clang-16.

Unfortunately, I had to remove all the tests referring to this flag,
causing a mass change. I've also added a test for checking this warning.

I've seen that `scan-build` also uses this flag, but I think we should
remove that part only after we turn this into a hard error.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D126215
2022-06-14 09:20:41 +02:00
Kai Luo 8091f7120c [PowerPC] Correct test RUN line. NFC. 2022-06-14 14:56:00 +08:00
Pavel Labath 926a7ecdc8 [lldb] Fix TCPSocket::Connect when getaddrinfo returns multiple addrs
TCPSocket::Connect() calls SocketAddress::GetAddressInfo() and tries to
connect any of them (in a for loop).

This used to work before commit 4f6d3a376c9f("[LLDB] Fix setting of
success in Socket::Close()") https://reviews.llvm.org/D116768.

As a side effect of that commit, TCPSocket can only connect to the first
address returned by SocketAddress::GetAddressInfo().

1. If the attempt to connect to the first address fails,
   TCPSocket::Connect(), calls CLOSE_SOCKET(GetNativeSocket()), which
   closes the fd, but DOES NOT set m_socket to kInvalidSocketValue.
2. On the second attempt, TCPSocket::CreateSocket() calls
   Socket::Close().
3. Socket::Close() proceeds, because IsValid() is true (m_socket was not
   reset on step 1).
4. Socket::Close() calls ::close(m_socket), which fails
5. Since commit 4f6d3a376c9f("[LLDB] Fix setting of success in
   Socket::Close()"), this is error is detected. Socket::Close() returns
   an error.
6. TCPSocket::CreateSocket() therefore returns an error.
7. TCPSocket::Connect() detects the error and continues, skipping the
   second (and the third, fourth...) address.

This commit fixes the problem by changing step 1: by calling
Socket::Close, instead of directly calling close(m_socket), m_socket is
also se to kInvalidSocketValue. On step 3, Socket::Close() is going to
return immediately and, on step 6, TCPSocket::CreateSocket() does not
fail.

How to reproduce this problem:

On my system, getaddrinfo() resolves "localhost" to "::1" (first) and to
"127.0.0.1" (second).

Start a gdbserver that only listens on 127.0.0.1:

```
gdbserver 127.0.0.1:2159 /bin/cat
Process /bin/cat created; pid = 2146709
Listening on port 2159
```

Start lldb and make it connect to "localhost:2159"

```
./bin/lldb
(lldb) gdb-remote localhost:2159
```

Before 4f6d3a376c9f("[LLDB] Fix setting of success in Socket::Close()"),
this used to work. After that commit, it stopped working. This commit
fixes the problem.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D126702
2022-06-14 08:49:02 +02:00
Chuanqi Xu d029db9e8a [NFC] Fix Wswitch warning triggered by 735e6c 2022-06-14 14:45:15 +08:00
Kai Luo 029fc37270 [PowerPC][AtomicExpand] Precommit IR tests for D127609. NFC. 2022-06-14 14:24:21 +08:00
Chuanqi Xu 735e6c40b5 [Coroutines] Convert coroutine.presplit to enum attr
This is required by @nikic in https://reviews.llvm.org/D127383 to
decrease the cost to check whether a function is a coroutine and this
fixes a FIXME too.

Reviewed By: rjmccall, ezhulenev

Differential Revision: https://reviews.llvm.org/D127471
2022-06-14 14:23:46 +08:00
Kazu Hirata a2232da2a5 [CodeGen] Remove addSEHCatchHandler and addSEHCleanupHandler (NFC)
The last uses of these functions are removed on Oct 9, 2015 in commit
14e773500e.
2022-06-13 23:08:49 -07:00
Kazu Hirata 34ff78c5cf [CodeGen] Remove restrictRef (NFC)
The last use was removed on Apr 14, 2017 in commit
4fe9d6c640.
2022-06-13 23:08:48 -07:00
zhongyunde 0cb33551ec [AArch64][NFC] Fix a comment error
Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D127708
2022-06-14 13:57:41 +08:00
Thomas Raoux 087aba4f0f [mlir][vector] Add pattern to distribute vector reduction to GPU shuffles
Add a pattern to do ad hoc lowering of vector.reduction to a sequence of
warp shuffles. This allow distributing reduction on a warp for GPU targets.
Also add an execution test for warp reduction.

co-authored with @springerm

Differential Revision: https://reviews.llvm.org/D127176
2022-06-14 05:49:16 +00:00
Thomas Raoux 76cf33dab2 [mlir][vector] Add patterns to ppropagate vector distribution
Add patterns to propagate vector distribution and remove dead
arguments. This handles propagation for several vector operations.

recommit after minor bug fix.

Differential Revision: https://reviews.llvm.org/D127167
2022-06-14 05:26:10 +00:00
Mogball baca1c1ac4 [mlir][ods] Make Attr/Type def accessors match the dialect
The generated attribute and type def accessors are changed to match the setting on the dialect. Most importantly, "prefixed" will now correctly convert snake case to camel case (e.g. `weight_zp` -> `getWeightZp`)

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D127688
2022-06-14 05:13:24 +00:00
Sunho Kim 3d8061a3be [JITLink][ELF][AArch64] Implement R_AARCH64_MOVW_UABS_G*_NC.
Implements  R_AARCH64_MOVW_UABS_G*_NC fixup edges. These relocation entries can be generated when code is compiled without a PIC flag. With this patch, clang-repl can printf Hello World with ObjectLinkerLayer on aarch64 linux.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D127585
2022-06-14 14:06:59 +09:00
Serguei Katkov 095bf6be28 [Greedy RegAlloc] Fix the handling of split register in last chance re-coloring.
This is a fix for https://github.com/llvm/llvm-project/issues/55827.

When register we are trying to re-color is split the original register (we tried to recover)
has no uses after the split. However in rollback actions we assign back physical register to it.
Later it causes different assertions. One of them is in attached test.

This CL fixes this by avoiding assigning physical register back to register which has no usage
or its live interval now is empty.

Reviewed By: arsenm, qcolombet
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D127281
2022-06-14 12:04:17 +07:00
Sunho Kim 398df667d6 [JITLink][AArch64] Implement MoveWide16 generic edge.
Implements MoveWide16 generic edge kind that can be used to patch MOVZ/MOVK (imm16) instructions.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D127584
2022-06-14 13:51:47 +09:00
Nikolas Klauser ac251726f8 [libc++][NFC] clang-format <__config>
It's not perfect, but it's a lot better than the status quo.

Reviewed By: ldionne, #libc

Spies: EricWF, aheejin, libcxx-commits, dschuff, krytarowski, fedor.sergeev, mstorsjo, phosek, abrachet

Differential Revision: https://reviews.llvm.org/D127644
2022-06-14 06:47:38 +02:00
Argyrios Kyrtzidis f7e19a5928 [Lex] Keep track of skipped preprocessor blocks and advance the lexer directly if they are revisited
This speeds up preprocessing, specifically for preprocessing the clang sources time is reduced by about -36%,
using measurements on M1Pro with a release+thinLTO build.

Differential Revision: https://reviews.llvm.org/D127379
2022-06-13 21:46:46 -07:00
Kai Luo 7735653e16 [PowerPC] Update cfence tests to avoid using undef. NFC. 2022-06-14 12:45:46 +08:00
Mogball f8ec4dfa94 [mlir][sparse_tensor] fix windows build 2022-06-14 04:37:27 +00:00
Jacques Pienaar 743791d6d5 [mlir] Include attributes in ML program dialect ops def
I considered adding a new dialect top-level file with all ops,
attributes & types included, but didn't see practical benefit to it.
2022-06-13 21:35:34 -07:00
Sunho Kim 6cc3450a52 [JITLink][AArch64] Lift fixup functions from aarch64.cpp to aarch64.h. (NFC)
Lift fixup functions from aarch64.cpp to aarch64.h so that they have better chance of getting inlined. Also, adds some comments documenting the purpose of functions.

Reviewed By: sgraenitz

Differential Revision: https://reviews.llvm.org/D127559
2022-06-14 13:34:00 +09:00
Sunho Kim db37225803 [JITLink][AArch64] Unify table managers of ELF and MachO.
Unifies GOT/PLT table managers of ELF and MachO on aarch64 architecture. Additionally, it migrates table managers from PerGraphGOTAndPLTStubsBuilder to generic crtp TableManager.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D127558
2022-06-14 13:16:03 +09:00
Jacques Pienaar 3c68d58841 [mlir][doc] Move pass to passes list and remove redundant doc
The types are already included in the dialect doc (the attributes is not
properly yet, so retaining).
2022-06-13 21:01:31 -07:00
jacquesguan 5179f885d1 [mlir][Arithmetic] Fold NegF in MulF and DivF.
This patch adds the following combination:

mulf(negf(x), negf(y)) -> mulf(x, y)
divf(negf(x), negf(y)) -> divf(x, y)

Differential Revision: https://reviews.llvm.org/D126044
2022-06-14 03:15:19 +00:00
jacquesguan 059ee5d937 [mlir][Vector] Support vectorize to vector.reduction or/and.
This patch supports to vectorize affine.for of ori/andi to vector.reduction or/and.

Differential Revision: https://reviews.llvm.org/D127090
2022-06-14 03:11:45 +00:00
chenglin.bi 286198ff04 [InstCombine] Optimize lshr+shl+and conversion pattern
if `C1` and `C3` are pow2 and `Log2(C3) >= C2`:
    ((C1 >> X) << C2) & C3 -> X == (Log2(C1)+C2-Log2(C3)) ? C3 : 0
https://alive2.llvm.org/ce/z/zvrkKF

Reviewed By: spatel

Differential Revision: https://reviews.llvm.org/D127469
2022-06-14 11:06:10 +08:00
Chenbing Zheng e99c07a30e [InstCombine] add tests for compare-signs 2022-06-14 11:02:18 +08:00
Fangrui Song bf0bac43ff [CodeGen] Initialize ISD after 800d222e53
In the Intrinsic::fptosi_sat branch, ISD was uninitialized when Tys.empty().
2022-06-13 19:52:21 -07:00
Fangrui Song 11cf75f602 [Driver][test] Make ananas.c and solaris-ld.c robust
`{{.*}}crt{{[^.]+}}.o` may match `"-r" "/tmp/lit-tmp-9ur5crtx/solaris-ld-4fa504.o"`
in a lit invocation.
2022-06-13 19:44:24 -07:00
Peixin-Qiao dafd3cf8b1 [flang] Complement one-to-one association check of bind name and entity name
As Fortran 2018 C802 and C873, if bind name is specified, there can only
be only one entity. The check for common block is missed before. As
Fortran 2018 8.5.5 point 2, the bind name is one identifier, which is
unique. That is, one entity can not have multiple bind names. Also add
this check.

Reviewed By: klausler, Jean Perier

Differential Revision: https://reviews.llvm.org/D126961
2022-06-14 10:34:38 +08:00
Peixin-Qiao c6d8aa27c5 [flang] Add semantic check for multiple part-ref with nonzero rank for TBP
As Fortran 2018 C919, there shall not be more than one part-ref with
nonzero rank. Support this semantic check for type-bound procedure to
address the issue https://github.com/llvm/llvm-project/issues/55811.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D127602
2022-06-14 10:17:44 +08:00
Fangrui Song 0ba43f4c2b [sanitizer] Add -lresolv only for non-Android non-musl Linux
Refine the D127145 logic with my original suggestion.
It turns out that many OSes don't have libresolv.
2022-06-13 19:12:13 -07:00
Jake Egan 1cf4113952 [libcxx][AIX] Switch build compiler to clang
This patch switches the build compiler for AIX from ibm-clang to clang. ibm-clang++_r has `-pthread` by default, but clang for AIX doesn't, so `-pthread` had to be added to the test config. A bunch of tests now pass, so the `XFAIL` was removed. This patch also switch the build to use the visibility support available in clang-15 to control symbols exported by the shared library (AIX traditionally uses explicit export lists for this purpose).

Reviewed By: #libc, #libc_abi, daltenty, #libunwind, ldionne

Differential Revision: https://reviews.llvm.org/D127470
2022-06-13 21:45:18 -04:00