Jun Zhang [Tue, 14 Jun 2022 09:36:41 +0000 (17:36 +0800)]
Reland "[CodeGen] Keep track info of lazy-emitted symbols in ModuleBuilder"
This reverts commits:
d3ddc251acae631bf5ab4da13878f7e8b5b5a451
d90eecff5c9e7e9f8263de6cd72d70322400829f
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
Rosie Sumpter [Mon, 6 Jun 2022 15:06:43 +0000 (16:06 +0100)]
[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
Dmitry Preobrazhensky [Tue, 14 Jun 2022 09:56:38 +0000 (12:56 +0300)]
[AMDGPU][MC][GFX11] Correct ds_swizzle_b32
Enable offset parsing.
Differential Revision: https://reviews.llvm.org/D127404
Alon Kom [Tue, 14 Jun 2022 09:50:22 +0000 (10:50 +0100)]
[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
Pavel Labath [Tue, 14 Jun 2022 09:38:45 +0000 (11:38 +0200)]
[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).
Florian Hahn [Tue, 14 Jun 2022 09:37:12 +0000 (10:37 +0100)]
[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.
gbreynoo [Tue, 14 Jun 2022 09:32:56 +0000 (10:32 +0100)]
[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
Jean Perier [Tue, 14 Jun 2022 08:47:40 +0000 (10:47 +0200)]
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
Balazs Benics [Tue, 14 Jun 2022 08:22:37 +0000 (10:22 +0200)]
Reland "[analyzer] Deprecate the unused 'analyzer-opt-analyze-nested-blocks' cc1 flag"
It was previously reverted by
8406839d1926486de900c7cabeea9f841bd3edf2.
---
This flag was introduced by
https://github.com/llvm/llvm-project/commit/
6818991d7165f68fe196922d9e5c6648dd57cc47
commit
6818991d7165f68fe196922d9e5c6648dd57cc47
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:
https://github.com/llvm/llvm-project/commit/
5c32dfc5fb1cfcff8ae3671284e17daa8da3a188
commit
5c32dfc5fb1cfcff8ae3671284e17daa8da3a188
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
Denis Antrushin [Wed, 8 Jun 2022 13:53:54 +0000 (20:53 +0700)]
[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
Balazs Benics [Tue, 14 Jun 2022 07:42:58 +0000 (09:42 +0200)]
[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
Balazs Benics [Tue, 14 Jun 2022 07:20:41 +0000 (09:20 +0200)]
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
Kai Luo [Tue, 14 Jun 2022 06:55:28 +0000 (14:55 +0800)]
[PowerPC] Correct test RUN line. NFC.
Pavel Labath [Tue, 14 Jun 2022 06:44:48 +0000 (08:44 +0200)]
[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
Chuanqi Xu [Tue, 14 Jun 2022 06:44:51 +0000 (14:44 +0800)]
[NFC] Fix Wswitch warning triggered by 735e6c
Kai Luo [Tue, 14 Jun 2022 06:22:29 +0000 (14:22 +0800)]
[PowerPC][AtomicExpand] Precommit IR tests for D127609. NFC.
Chuanqi Xu [Fri, 10 Jun 2022 03:37:09 +0000 (11:37 +0800)]
[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
Kazu Hirata [Tue, 14 Jun 2022 06:08:49 +0000 (23:08 -0700)]
[CodeGen] Remove addSEHCatchHandler and addSEHCleanupHandler (NFC)
The last uses of these functions are removed on Oct 9, 2015 in commit
14e773500e036de57ed0ca4af6fddc1f8b6767d8.
Kazu Hirata [Tue, 14 Jun 2022 06:08:48 +0000 (23:08 -0700)]
[CodeGen] Remove restrictRef (NFC)
The last use was removed on Apr 14, 2017 in commit
4fe9d6c640e81457db1350766bf6dfef118bcacd.
zhongyunde [Tue, 14 Jun 2022 05:54:49 +0000 (13:54 +0800)]
[AArch64][NFC] Fix a comment error
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D127708
Thomas Raoux [Tue, 7 Jun 2022 02:34:35 +0000 (02:34 +0000)]
[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
Thomas Raoux [Tue, 14 Jun 2022 04:59:08 +0000 (04:59 +0000)]
[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
Mogball [Tue, 14 Jun 2022 05:04:56 +0000 (05:04 +0000)]
[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
Sunho Kim [Tue, 14 Jun 2022 05:06:08 +0000 (14:06 +0900)]
[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
Serguei Katkov [Wed, 8 Jun 2022 09:21:01 +0000 (16:21 +0700)]
[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
Sunho Kim [Tue, 14 Jun 2022 04:50:47 +0000 (13:50 +0900)]
[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
Nikolas Klauser [Mon, 13 Jun 2022 15:25:23 +0000 (17:25 +0200)]
[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
Argyrios Kyrtzidis [Thu, 9 Jun 2022 05:00:58 +0000 (22:00 -0700)]
[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
Kai Luo [Tue, 14 Jun 2022 04:44:20 +0000 (12:44 +0800)]
[PowerPC] Update cfence tests to avoid using undef. NFC.
Mogball [Tue, 14 Jun 2022 04:37:07 +0000 (04:37 +0000)]
[mlir][sparse_tensor] fix windows build
Jacques Pienaar [Tue, 14 Jun 2022 04:30:59 +0000 (21:30 -0700)]
[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.
Sunho Kim [Tue, 14 Jun 2022 01:58:06 +0000 (10:58 +0900)]
[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
Sunho Kim [Tue, 14 Jun 2022 01:58:05 +0000 (10:58 +0900)]
[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
Jacques Pienaar [Tue, 14 Jun 2022 04:01:31 +0000 (21:01 -0700)]
[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).
jacquesguan [Fri, 20 May 2022 06:40:14 +0000 (06:40 +0000)]
[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
jacquesguan [Mon, 6 Jun 2022 09:15:36 +0000 (09:15 +0000)]
[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
chenglin.bi [Tue, 14 Jun 2022 03:06:10 +0000 (11:06 +0800)]
[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
Chenbing Zheng [Tue, 14 Jun 2022 03:02:18 +0000 (11:02 +0800)]
[InstCombine] add tests for compare-signs
Fangrui Song [Tue, 14 Jun 2022 02:52:21 +0000 (19:52 -0700)]
[CodeGen] Initialize ISD after
800d222e53dabfe1e242bd06ab70f58c36e768ed
In the Intrinsic::fptosi_sat branch, ISD was uninitialized when Tys.empty().
Fangrui Song [Tue, 14 Jun 2022 02:44:24 +0000 (19:44 -0700)]
[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.
Peixin-Qiao [Tue, 14 Jun 2022 02:34:38 +0000 (10:34 +0800)]
[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
Peixin-Qiao [Tue, 14 Jun 2022 02:17:44 +0000 (10:17 +0800)]
[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
Fangrui Song [Tue, 14 Jun 2022 02:12:13 +0000 (19:12 -0700)]
[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.
Jake Egan [Tue, 14 Jun 2022 01:44:58 +0000 (21:44 -0400)]
[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
Heejin Ahn [Sat, 11 Jun 2022 04:51:16 +0000 (21:51 -0700)]
[InstCombine] Don't slice up PHIs when pred BB has catchswitch
If an integer PHI has an illegal type (according to the data layout) and
it is only used by `trunc` or `trunc(lshr)` operations, we split the PHI
into various instructions in its predecessors:
https://github.com/llvm/llvm-project/blob/
6d1543a16797fa07eecea7e542df5b42422fc721/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp#L1536-L1543
So this can produce code like the following:
Before:
```
pred:
...
bb:
%p = phi i8 [ %somevalue, %pred ], ...
...
%tobool = trunc i8 %p to i1
use %tobool
...
```
In this code, `%p` has an illegal integer type, `i8`, and its only used
in a `trunc` instruction later. In this case this pass puts extraction
code in its predecessors:
After:
```
pred:
...
%t = and i8 %somevalue, 1
%extract = icmp ne i8 %t, 0
bb:
%p.new = phi i1 [ %extract, %pred ], ...
use %p.new instead of %tobool
```
But this doesn't work if `pred` is a `catchswitch` BB because it cannot
have any non-PHI instructions. This CL ensures we bail out in that case.
Fixes https://github.com/llvm/llvm-project/issues/55803.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D127699
Ben Shi [Tue, 14 Jun 2022 01:23:05 +0000 (01:23 +0000)]
[Driver] Improve linking options for target AVR
1. Support user specified linker (-fuse-ld)
2. Support user specified linker script (-T)
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D126192
Philip Reames [Tue, 14 Jun 2022 01:19:50 +0000 (18:19 -0700)]
[BasicTTI] Remove unused support for multiple opcodes in getTypeBasedIntrinsicInstrCost [nfc]
ISDs only ever contains a single ISD opcode. We can simplify the code under this assumption. The code being removed was added back in 2016 in
0f26b0aeb4a91 to support FMAXNAN/FMINNAN, but at some point since then the motivating case was rewritten not to use the ISDs mechanism. No reason to keep the false generality around now.
Ben Shi [Tue, 14 Jun 2022 01:12:21 +0000 (09:12 +0800)]
Revert "[Driver] Improve linking options for target AVR"
This reverts commit
d7599be9e84fb205b7f50de406dc87858aebc0f4.
Lang Hames [Tue, 14 Jun 2022 00:14:23 +0000 (17:14 -0700)]
[C-API][ORC] Add C API to suspend lookups during definition generation.
Slow definition generators may suspend lookups to temporarily release the
session lock, allowing unrelated lookups to proceed.
Using this functionality is discouraged: it is best to make definition
generation fast, rather than suspending the lookup. As a last resort where
this is not possible, suspension may be used.
Kazu Hirata [Tue, 14 Jun 2022 00:10:23 +0000 (17:10 -0700)]
[CodeGen] Remove futureWeight (NFC)
The last use was removed on Jun 5, 2022 in
commit
5c06f7168fd1bd589b831cacd5f1cb8a928446fb, which itself was
a patch to remove unused code.
Ben Shi [Mon, 23 May 2022 10:22:51 +0000 (10:22 +0000)]
[Driver] Improve linking options for target AVR
1. Support linking with lld
2. Support user specifed linker script
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D126192
Lang Hames [Mon, 13 Jun 2022 23:30:24 +0000 (16:30 -0700)]
[C-API][ORC] Add LLVMOrcExecutionSessionLookup -- generic async symbol lookup.
An API to wrap ExecutionSession::lookup, this allows C API clients to use async
lookup.
The immediate motivation for adding this is to simplify upcoming
definition-generator unit tests.
As we're adding more tests that need to convert between C and C++ flag values
this commit adds helper functions to support this. This patch also updates the
CAPIDefinitionGenerator to use these new utilities.
Peter Klausler [Wed, 8 Jun 2022 22:23:56 +0000 (15:23 -0700)]
[flang][runtime] Skip remainder of bad input record even with ADVANCE='NO'
After a recoverable error condition in a READ statement with ADVANCE='NO',
skip the remainder of the current record.
Differential Revision: https://reviews.llvm.org/D127433
V Donaldson [Mon, 13 Jun 2022 22:16:07 +0000 (15:16 -0700)]
[flang] Intrinsic module procedure pure prefixes
Per 7.11.1p1 - All [ieee_arithmetic and ieee_exceptions] functions are
pure and all the subroutines are impure unless otherwise stated. Most of
these functions are elemental (and not impure), which implies pure.
Several of the remaining non-elemental functions are missing pure prefixes;
add them.
Peter Klausler [Wed, 8 Jun 2022 21:52:01 +0000 (14:52 -0700)]
[flang][runtime] Don't loop in runtime if blank appears in BOZ input
The code for scanning BOZ input allows for blanks and tabs to appear,
but can hang if they do and the BOZ input value is not followed by
extra valid digits; the repositioning for the second sweep simply
needed to be done in units of character, not valid digits.
Differential Revision: https://reviews.llvm.org/D127431
Peter Klausler [Wed, 8 Jun 2022 21:11:07 +0000 (14:11 -0700)]
[flang] Handle USE association in parse tree rewriting
f18 was treating "f() = 1" as a statement function definition
if it could be viewed as being in the specification part and
"f" was a USE-associated function returning a data pointer.
(The non-USE-associated case is fine.) Fix to allow for "f"
to be USE associated.
Differential Revision: https://reviews.llvm.org/D127430
Peter Klausler [Wed, 8 Jun 2022 20:50:43 +0000 (13:50 -0700)]
[flang] Fix crash on USE error
Handle the case of a non-generic procedure that is USE associated
into a scope that has a generic interface of the same name with an
appropriate error rather than crashing.
Differential Revision: https://reviews.llvm.org/D127429
Peter Klausler [Wed, 8 Jun 2022 19:44:12 +0000 (12:44 -0700)]
[flang][runtime] Detect overflow of fixed-sized exponent output field
When Ew.dEe or Gw.dEe output has an exponent requiring more than 'e'
digits, the whole output field must overflow to asterisks. The runtime
was detecting short fields and padding them with zeroes, but not
overflow.
Differential Revision: https://reviews.llvm.org/D127428
Peter Klausler [Thu, 9 Jun 2022 18:39:18 +0000 (11:39 -0700)]
[flang][runtime] Fix overflow detection for REAL input
The test for an overflow during decimal->binary conversion was taking
place too late, causing the data not to be rescanned from the beginning.
Differential Revision: https://reviews.llvm.org/D127427
Peter Klausler [Wed, 8 Jun 2022 17:42:40 +0000 (10:42 -0700)]
[flang][runtime] Don't emit any leading blanks for G0/E0 output editing
There were cases where E0.d output editing (or G0.d editing that is converted
to E0.d) would emit one or more leading blank characters; fix them.
Differential Revision: https://reviews.llvm.org/D127426
Craig Topper [Mon, 13 Jun 2022 22:28:29 +0000 (15:28 -0700)]
[RISCV] Fix use of texternalsym in output pattern where input was tglobaladdr. NFC
I don't think the name used in the output pattern is used to control
anything about the isel table emission, but it should match the input.
Mogball [Mon, 13 Jun 2022 22:35:51 +0000 (22:35 +0000)]
[mlir] Fix CMake file
Benjamin Kramer [Mon, 13 Jun 2022 22:23:17 +0000 (00:23 +0200)]
[bazel] Unbreak the build after
cf6a7c194793
Mogball [Mon, 13 Jun 2022 22:02:02 +0000 (22:02 +0000)]
[mlir] Support getSuccessorInputs from parent op
Ops that implement `RegionBranchOpInterface` are allowed to indicate that they can branch back to themselves in `getSuccessorRegions`, but there is no API that allows them to specify the forwarded operands. This patch enables that by changing `getSuccessorEntryOperands` to accept `None`.
Fixes #54928
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D127239
Florian Hahn [Mon, 13 Jun 2022 21:57:53 +0000 (22:57 +0100)]
[ConstraintElimination] Add tests with cmps with constant ops only.
Add extra test coverage for conditions with constant ops.
Stanislav Mekhanoshin [Fri, 10 Jun 2022 19:13:40 +0000 (12:13 -0700)]
[AMDGPU] Use null for dead sdst operand
Differential Revision: https://reviews.llvm.org/D127542
Amir Ayupov [Mon, 13 Jun 2022 21:26:14 +0000 (14:26 -0700)]
[BOLT][NFC] Pass Function to BC.printInstructions in BinaryBasicBlock::dump
BC::printInstruction(s) has many uses of Function ptr if it's available:
# printing CFI instructions (unconditional)
# printing debug line information (-print-debug-info)
# printing instruction relocations (-print-relocations)
Enable these uses by passing Function ptr from the primary printing entry point:
BinaryBasicBlock::dump.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D126916
Kazu Hirata [Mon, 13 Jun 2022 21:26:20 +0000 (14:26 -0700)]
[Analysis] Remove getUniqueInstruction (NFC)
The last use was removed on Apr 7, 2022 in commit
5cefe7d9f531fe6eac4cd22978861752498b2265.
Mitch Phillips [Mon, 13 Jun 2022 21:22:43 +0000 (14:22 -0700)]
Fix-forward broken ASan test on Windows.
Hopefully the final whack-a-mole.
Relevant differential revision: https://reviews.llvm.org/D126929
Florian Hahn [Mon, 13 Jun 2022 21:20:58 +0000 (22:20 +0100)]
[LV] Replace OrigPHIsToFix in native with VPlan traversal. (NFC)
OrigPHIsToFix is only used in the native path. Collecting phis can be
replaced by iterating over the plan. This also removes another
unnecessary use of a late getVPValue.
This also reduces the coupling between ILV and the VPlan utilities.
Alex Brachet [Mon, 13 Jun 2022 21:06:27 +0000 (21:06 +0000)]
[libc] Add explicit casts for string functions
This fixes warnings from `-Wimplicit-int-conversion`
Differential revision: https://reviews.llvm.org/D127694
Peter Collingbourne [Mon, 13 Jun 2022 21:02:58 +0000 (14:02 -0700)]
Revert "gn build: Add support for building the standalone ubsan runtime."
As well as followup commits.
Build is still failing on mac. I'll debug it locally.
http://45.33.8.238/macm1/37269/step_4.txt
This reverts commit
ee21411107aa18e191a25380b9e4679f3909a0c7.
This reverts commit
6ef9af6386fe7cd9d5d93342c430528baa8d1026.
This reverts commit
b49bd8e07faf0f4d04e6cdfe33d901a2cd8b2346.
Alex Brachet [Mon, 13 Jun 2022 21:03:51 +0000 (21:03 +0000)]
[libc] Add Fuchsia implementation of ::testing::Test
Hubert Tong [Mon, 13 Jun 2022 02:36:32 +0000 (22:36 -0400)]
[NFC] Undo AIX build compiler workaround
Removes the workaround from https://reviews.llvm.org/D98509#2732628 for
an AIX build compiler issue.
The AIX build compiler product that caused the issue has since been
fixed. Also, the AIX build compiler has been changed to one based on
LLVM.
Peter Collingbourne [Mon, 13 Jun 2022 20:52:27 +0000 (13:52 -0700)]
gn build: Don't define an action for gen_version_script on mac/win.
Nothing should depend on the action on those platforms,
as they don't use version scripts.
Should fix mac build:
http://45.33.8.238/macm1/37264/step_4.txt
Lang Hames [Mon, 13 Jun 2022 20:48:00 +0000 (13:48 -0700)]
[C-API][ORC] Add missing error check to unit test.
Lang Hames [Mon, 13 Jun 2022 19:15:53 +0000 (12:15 -0700)]
[C-API][ORC] Fix struct name.
This struct was using the wrong prefix (LLVMJIT... vs LLVMOrc...).
James Nagurne [Thu, 2 Jun 2022 22:30:55 +0000 (17:30 -0500)]
Restore missing runtimes-test-depends target that causes build failures when LLVM_INCLUDE_TESTS is ON
7cc8377f removed the 'runtimes-test-depends' target in runtimes builds that
is assumed to exist when using a bootstrapped runtime build.
For a full analysis, see:
https://discourse.llvm.org/t/looking-for-guidance-on-broken-downstream-bootstrapped-runtimes-builds/62934
Differential Revision: https://reviews.llvm.org/D127325
Peter Collingbourne [Mon, 13 Jun 2022 20:43:56 +0000 (13:43 -0700)]
gn build: Disable ubsan build on mac/win.
Build failures:
http://45.33.8.238/macm1/37263/step_4.txt
http://45.33.8.238/win/60034/step_4.txt
Craig Topper [Mon, 13 Jun 2022 20:30:36 +0000 (13:30 -0700)]
[RISCV] Disable matchSplatAsGather for i1 vectors to prevent creating illegal nodes.
We were incorrectly creating a VRGATHER node with i1 vector type. We
could support this by promoting the mask to i8 and truncating it, but
for now I want to prevent the crash.
Fixes PR56007.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D127681
Mahesh Ravishankar [Mon, 13 Jun 2022 19:56:32 +0000 (19:56 +0000)]
[mlir][TilingInterface] Add pattern to tile using TilingInterface and implement TilingInterface for Linalg ops.
This patch adds support for tiling operations that implement the
TilingInterface.
- It separates the loop constructs that are used to iterate over tile
from the implementation of the tiling itself. For example, the use
of destructive updates is more related to use of scf.for for
iterating over tiles that are tensors.
- To test the transformation, TilingInterface is implemented for
LinalgOps. The separation of the looping constructs used from the
implementation of tile code generation greatly simplifies the
latter.
- The implementation of TilingInterface for LinalgOp is kept as an
external model for now till this approach can be fully flushed out
to replace the existing tiling + fusion approaches in Linalg.
Differential Revision: https://reviews.llvm.org/D127133
Zequan Wu [Mon, 13 Jun 2022 20:20:44 +0000 (13:20 -0700)]
Stanislav Mekhanoshin [Fri, 10 Jun 2022 17:58:39 +0000 (10:58 -0700)]
[AMDGPU] Define SGPR_NULL64 register. NFCI.
On gfx10+ null register can be used as both 32 and 64 bit operand.
Define a 64 bit version of the register to use during codegen.
Differential Revision: https://reviews.llvm.org/D127527
Peter Collingbourne [Sat, 11 Jun 2022 05:07:39 +0000 (22:07 -0700)]
gn build: Add support for building the AArch64 LSE builtins.
Differential Revision: https://reviews.llvm.org/D127560
Peter Collingbourne [Fri, 29 Apr 2022 00:23:47 +0000 (17:23 -0700)]
gn build: Add support for building the standalone ubsan runtime.
Differential Revision: https://reviews.llvm.org/D127556
Jay Foad [Mon, 13 Jun 2022 15:35:44 +0000 (16:35 +0100)]
[AMDGPU] Add GFX11 llvm.amdgcn.permlane64 intrinsic
Compared to permlane16, permlane64 has no BC input because it has no
boundary conditions, no fi input because the instruction acts as if FI
were always enabled, and no OLD input because it always writes to every
active lane.
Also use the new intrinsic in the atomic optimizer pass.
Differential Revision: https://reviews.llvm.org/D127662
LLVM GN Syncbot [Mon, 13 Jun 2022 20:04:00 +0000 (20:04 +0000)]
[gn build] Port
ea9ff9fac3a6
Jay Foad [Wed, 6 Apr 2022 16:16:50 +0000 (17:16 +0100)]
[AMDGPU] Work around GFX11 flat scratch SVS swizzling bug
Differential Revision: https://reviews.llvm.org/D127635
Adrian Prantl [Mon, 13 Jun 2022 17:51:01 +0000 (10:51 -0700)]
[LLDB][formatters] Add formatter for libc++'s std::span
This patch adds a libcxx formatter for std::span. The
implementation is based on the libcxx formatter for
std::vector. The main difference is the fact that
std::span conditionally has a __size member based
on whether it has a static or dynamic extent.
Example output of formatted span:
(std::span<const int,
18446744073709551615>) $0 = size=6 {
[0] = 0
[1] = 1
[2] = 2
[3] = 3
[4] = 4
[5] = 5
}
The second template parameter here is actually std::dynamic_extent,
but the type declaration we get back from the TypeSystemClang is the
actual value (which in this case is (size_t)-1). This is consistent
with diagnostics from clang, which doesn't desugar this value either.
E.g.,:
span.cpp:30:31: error: implicit instantiation of undefined template
'Undefined<std::span<int,
18446744073709551615>>'
Testing:
Added API-tests
Confirmed manually using LLDB cli that printing spans works in various scenarios
Patch by Michael Buch!
Differential Revision: https://reviews.llvm.org/D127481
Jay Foad [Mon, 13 Jun 2022 15:12:12 +0000 (16:12 +0100)]
[AMDGPU] Add some GFX11 atomic optimizer testing
Differential Revision: https://reviews.llvm.org/D127661
Jay Foad [Mon, 13 Jun 2022 15:28:05 +0000 (16:28 +0100)]
[AMDGPU] Fix GFX11 codegen for V_MAD_U64_U32 and V_MAD_I64_I32
GFX11 uses different pseudos for these because of a new constraint
on which operands' registers can overlap.
Differential Revision: https://reviews.llvm.org/D127659
Daniel Bertalan [Mon, 13 Jun 2022 19:49:27 +0000 (15:49 -0400)]
[lld-macho] Fix symbol name returned from InputSection::getLocation
This commit fixes the issue that getLocation always printed the name of
the first symbol in the section.
For clarity, upper_bound is used instead of a linear search for finding
the closest symbol name. Note that this change does not affect
performance: this function is only called when printing errors and
`symbols` typically contains a single symbol because of
.subsections_via_symbols.
Differential Revision: https://reviews.llvm.org/D127670
LLVM GN Syncbot [Mon, 13 Jun 2022 19:41:30 +0000 (19:41 +0000)]
[gn build] Port
3abaefe64c22
Nikolas Klauser [Mon, 13 Jun 2022 15:54:20 +0000 (17:54 +0200)]
[libc++] Simplify the char_traits specializations
Reviewed By: ldionne, #libc
Spies: mgorny, EricWF, mclow.lists, libcxx-commits
Differential Revision: https://reviews.llvm.org/D127159
Eric Schweitz [Mon, 13 Jun 2022 19:35:23 +0000 (21:35 +0200)]
[flang] Fix type mismatch in verification error
FIR models Fortran intrinsic types with deliberate KIND values. Like
Fortran, COMPLEX and REAL have related KINDs in FIR. Lowering now
converts REAL types to floating point (MLIR) up front. This patch moves
the code to convert from FIR RealType to MLIR FloatType out of codegen
and into the builder, allowing FIR ComplexTypes to have their element
type returned as an MLIR FloatType.
We should consider whether to replace fir::ComplexType with
mlir::ComplexType at some point. I believe these types are presently
used to convey distinctins in the target ABIs in the Tilikum bridge
however.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D127636
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Nikolas Klauser [Mon, 13 Jun 2022 15:36:53 +0000 (17:36 +0200)]
[libc++] Granularize some more of <type_traits>
Reviewed By: ldionne, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D127631
Eric Schweitz [Mon, 13 Jun 2022 19:30:41 +0000 (21:30 +0200)]
[flang][NFC] Add source location information to report unsupported complex types
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D127634
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Mitch Phillips [Mon, 13 Jun 2022 19:12:31 +0000 (12:12 -0700)]
Reland "Add sanitizer metadata attributes to clang IR gen."
RE-LAND (reverts a revert):
This reverts commit
8e1f47b596b28fbc88cf32e8f46eb2fecb145fb2.
This patch adds generation of sanitizer metadata attributes (which were
added in D126100) to the clang frontend.
We still currently generate the llvm.asan.globals that's consumed by
the IR pass, but the plan is to eventually migrate off of that onto
purely debuginfo and these IR attributes.
Reviewed By: vitalybuka, kstoimenov
Differential Revision: https://reviews.llvm.org/D126929
Balazs Benics [Mon, 13 Jun 2022 19:19:55 +0000 (21:19 +0200)]
[analyzer][NFC] Remove unused Analyses enum
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D127485
Mitch Phillips [Mon, 13 Jun 2022 19:10:40 +0000 (12:10 -0700)]
Revert "Add sanitizer metadata attributes to clang IR gen."
This reverts commit
e7766972a6790e25dbb4ce3481f57e9792b49269.
Broke the Windows buildbots.