Amara Emerson [Sun, 27 Jun 2021 06:36:46 +0000 (23:36 -0700)]
[GlobalISel] Add re-association combine for G_PTR_ADD to allow better addressing mode usage.
We're trying to match a few pointer computation patterns here for
re-association opportunities.
1) Isolating a constant operand to be on the RHS, e.g.:
G_PTR_ADD(BASE, G_ADD(X, C)) -> G_PTR_ADD(G_PTR_ADD(BASE, X), C)
2) Folding two constants in each sub-tree as long as such folding
doesn't break a legal addressing mode.
G_PTR_ADD(G_PTR_ADD(BASE, C1), C2) -> G_PTR_ADD(BASE, C1+C2)
AArch64 code size improvements on CTMark with -Os:
Program before after diff
pairlocalalign 251048 251044 -0.0%
consumer-typeset 421820 421812 -0.0%
kc 431348 431320 -0.0%
SPASS 413404 413300 -0.0%
clamscan 384396 384220 -0.0%
tramp3d-v4 370640 370412 -0.1%
lencod 432096 431772 -0.1%
bullet 479400 478796 -0.1%
sqlite3 288504 288072 -0.1%
7zip-benchmark 573796 570768 -0.5%
Geomean difference -0.1%
Differential Revision: https://reviews.llvm.org/D105069
Roman Lebedev [Fri, 2 Jul 2021 18:57:49 +0000 (21:57 +0300)]
[NFCI][SimplifyCFG] simplifyUnreachable(): Use poison constant to represent the result of unreachable instrs
Mimics similar change for InstCombine:
ce192ced2b901be67444c481ab5ca0d731e6d982 / D104602
All these uses are in blocks that aren't reachable from function's entry,
and said blocks are removed by SimplifyCFG itself,
so we can't really test this change.
Heejin Ahn [Thu, 1 Jul 2021 19:22:41 +0000 (12:22 -0700)]
[InstCombine] Don't combine PHI before catchswitch
This tries to bail out if the PHI is in a `catchswitch` BB in
InstCombine. A PHI cannot be combined into a non-PHI instruction if it
is in a `catchswitch` BB, because `catchswitch` BB cannot have any
non-PHI instruction other than `catchswitch` itself.
The given test case started crashing after D98058.
Reviewed By: lebedev.ri, rnk
Differential Revision: https://reviews.llvm.org/D105309
Adam Paszke [Fri, 2 Jul 2021 17:03:46 +0000 (10:03 -0700)]
Add C API files for the LLVM dialect
For now only expose a builder for the LLVM pointer type.
Reviewed By: jpienaar, ftynse
Differential Revision: https://reviews.llvm.org/D105346
Roman Lebedev [Fri, 2 Jul 2021 18:47:12 +0000 (21:47 +0300)]
[SimplifyCFG] Volatile memory operations do not trap
Somewhat related to D105338.
While it is up for discussion whether or not volatile store traps,
so far there has been no complaints that volatile load/cmpxchg/atomicrmw also may trap.
And even if simplifycfg currently concervatively believes that to be the case,
instcombine does not: https://godbolt.org/z/5vhv4K5b8
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D105343
Jonas Devlieghere [Fri, 2 Jul 2021 18:27:37 +0000 (11:27 -0700)]
[lldb] Replace default bodies of special member functions with = default;
Replace default bodies of special member functions with = default;
$ run-clang-tidy.py -header-filter='lldb' -checks='-*,modernize-use-equals-default' -fix ,
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-equals-default.html
Differential revision: https://reviews.llvm.org/D104041
Eric Astor [Fri, 2 Jul 2021 18:17:15 +0000 (14:17 -0400)]
[ms] [llvm-ml] Standardize blocking of lexical substitution
In MASM, the ifdef family of directives treats its argument literally, without expanding it as a text macro. Add support for this, and also replace the special handling that was previously used for echo.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D104196
MaheshRavishankar [Fri, 2 Jul 2021 17:43:29 +0000 (10:43 -0700)]
[mlir][Linalg] Fix incorrect logic in deciding when to fuse reshapes by linearization.
Fusion by linearization should not happen when
- The reshape is expanding and it is a consumer
- The reshape is collapsing and is a producer.
The bug introduced in this logic by some recent refactoring resulted
in a crash.
To enforce this (negetive) use case, add a test that reproduces the
error and verifies the fix.
Differential Revision: https://reviews.llvm.org/D104970
Krzysztof Parzyszek [Fri, 2 Jul 2021 15:20:41 +0000 (10:20 -0500)]
[OpaquePtr] Add type parameter to emitLoadLinked
Differential Revision: https://reviews.llvm.org/D105353
Krzysztof Parzyszek [Fri, 2 Jul 2021 14:39:56 +0000 (09:39 -0500)]
[Hexagon] Handle opaque pointers in vector combine
Sam Clegg [Wed, 23 Jun 2021 19:02:32 +0000 (12:02 -0700)]
[clang][emscripten] Reduce alignof long double from 16 to 8 bytes
This means `max_align_t` is 8 bytes which also sets the alignment
malloc. Since this is technically and ABI breaking change we have
limited to just the emscripten OS target. It is also relatively low
import breakage since it will only effect the alignement of struct that
contai `long double`s (extremerly rare I imagine).
Emscripten's malloc implementation already use 8 byte alignement
(dlmalloc uses and alignement of 2*sizeof(void*) == 8 rather than
checking max_align_t) so will not be effected by this change. By
bringing the ABI in line with the current malloc code this will fix
several issue we have seen in the wild.
See: https://github.com/emscripten-core/emscripten/pull/14456
Differential Revision: https://reviews.llvm.org/D104808
Mitch Phillips [Fri, 2 Jul 2021 17:54:20 +0000 (10:54 -0700)]
Revert "[clang-repl] Allow passing in code as positional arguments."
This reverts commit
e386871e1d21cf206a1287356e88c5853563fc77.
Reason: Broke the ASan buildbots
(https://lab.llvm.org/buildbot/#/builders/5/builds/9291). See comments
on https://reviews.llvm.org/D104898 for more information.
Mehdi Amini [Fri, 2 Jul 2021 17:55:06 +0000 (17:55 +0000)]
Revert "[mlir][Vector] NFC - Compress vector to outerproduct lowering."
This reverts commit
db188adfb12f6783c5419d5165a1123b9f5b56b0.
Breaks the GCC tests, likely because of some order of evaluation
difference between clang and gcc.
Vy Nguyen [Wed, 30 Jun 2021 16:50:24 +0000 (12:50 -0400)]
[lld-macho] Ignore debug symbols while preparing relocations.
Details: see https://bugs.llvm.org/show_bug.cgi?id=50812
Differential Revision: https://reviews.llvm.org/D105210
Amir Ayupov [Fri, 2 Jul 2021 17:26:22 +0000 (10:26 -0700)]
[X86] Modify LOOP*, HLT control flow attributes
Add missing control flow attributes:
- LOOP*: isBranch, isTerminator
- HLT: isTerminator
This helps downstream disassemblers (such as BOLT) reconstruct the control
flow graph more accurately.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D102297
Alexey Bataev [Fri, 2 Jul 2021 17:12:41 +0000 (10:12 -0700)]
[SLP][NFC]Refactor findLaneForValue and make it static member, NFC, by
V.Dmitriev.
Reduces number of arguments
Jacob Hegna [Fri, 2 Jul 2021 17:28:25 +0000 (17:28 +0000)]
[MLGO] Update Oz model url.
Jon Roelofs [Wed, 30 Jun 2021 23:49:48 +0000 (16:49 -0700)]
[Intrinsics] Make MemCpyInlineInst a MemCpyInst
This opens up more optimization opportunities in passes that already handle MemCpyInst's.
Differential revision: https://reviews.llvm.org/D105247
wmbat [Fri, 2 Jul 2021 17:08:36 +0000 (17:08 +0000)]
[libcxx][type_traits] remove `std::is_literal_type` and `std::result_of` for C++20
C++17 deprecated `std::is_literal_type` and `std::result_of`, C++20 removed them.
Implements parts of:
* P0174R2 'Deprecating Vestigial Library Parts in C++17'.
* P0619R4 'Reviewing Deprecated Facilities of C++17 for C++20'.
Reviewed By: ldionne, Mordante, Quuxplusone, #libc
Differential Revision: https://reviews.llvm.org/D102992
LLVM GN Syncbot [Fri, 2 Jul 2021 17:03:49 +0000 (17:03 +0000)]
[gn build] Port
99f00635d7ac
Joachim Meyer [Thu, 1 Jul 2021 23:24:29 +0000 (01:24 +0200)]
[NFC][OpenMP][CUDA] Add test for using `-x cuda -fopenmp`
This adds a very basic test in `cuda_with_openmp.cu` that just checks whether the CUDA & OpenMP integrated headers do compile, when a CUDA file is compiled with OpenMP (CPU) enabled.
Thus this basically adds the missing test for https://reviews.llvm.org/D90415.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D105322
Jacob Hegna [Thu, 10 Jun 2021 02:16:04 +0000 (02:16 +0000)]
Unpack the CostEstimate feature in ML inlining models.
This change yields an additional 2% size reduction on an internal search
binary, and an additional 0.5% size reduction on fuchsia.
Differential Revision: https://reviews.llvm.org/D104751
Siva Chandra Reddy [Thu, 1 Jul 2021 20:41:05 +0000 (20:41 +0000)]
[libc] Make ULP error reflect the bit distance more closely.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D105334
Marco Vanotti [Fri, 2 Jul 2021 16:44:54 +0000 (09:44 -0700)]
Revert "Refactor mutation strategies into a standalone library"
This reverts commit
361f742f168de0f0f256802a329c19d081615d0d.
Nicolas Vasilache [Fri, 2 Jul 2021 15:32:53 +0000 (15:32 +0000)]
[mlir][Vector] NFC - Compress vector to outerproduct lowering.
The implementation has become too unwieldy and cognitive overhead wins.
Instead compress the implementation in preparation for additional lowering paths.
Differential Revision: https://reviews.llvm.org/D105359
Atmn Patel [Fri, 2 Jul 2021 00:00:02 +0000 (20:00 -0400)]
[Libomptarget] Experimental Remote Plugin Fixes
D97883 introduced a compile-time error in the experimental remote offloading
libomptarget plugin, this patch fixes it and resolves a number of
inconsistencies in the plugin as well:
1. Non-functional Asynchronous API
2. Unnecessarily verbose debug printing
3. Misc. code clean ups
This is not intended to make any functional changes to the plugin.
Differential Revision: https://reviews.llvm.org/D105325
Tobias Gysi [Fri, 2 Jul 2021 16:08:22 +0000 (16:08 +0000)]
[mlir][linalg][python] Add min operation in OpDSL.
Add the min operation to OpDSL and introduce a min pooling operation to test the implementation. The patch is a sibling of the max operation patch https://reviews.llvm.org/D105203 and the min operation is again lowered to a compare and select pair.
Differential Revision: https://reviews.llvm.org/D105345
Geoffrey Martin-Noble [Fri, 2 Jul 2021 16:09:59 +0000 (09:09 -0700)]
[Bazel] Fix build for
c0a6318d96
This adds explicit deps to satisfy layering_check
Differential Revision: https://reviews.llvm.org/D105356
Aaron Green [Fri, 2 Jul 2021 16:15:17 +0000 (09:15 -0700)]
Refactor mutation strategies into a standalone library
This change introduces libMutagen/libclang_rt.mutagen.a as a subset of libFuzzer/libclang_rt.fuzzer.a. This library contains only the fuzzing strategies used by libFuzzer to produce new test inputs from provided inputs, dictionaries, and SanitizerCoverage feedback.
Most of this change is simply moving sections of code to one side or the other of the library boundary. The only meaningful new code is:
* The Mutagen.h interface and its implementation in Mutagen.cpp.
* The following methods in MutagenDispatcher.cpp:
* UseCmp
* UseMemmem
* SetCustomMutator
* SetCustomCrossOver
* LateInitialize (similar to the MutationDispatcher's original constructor)
* Mutate_AddWordFromTORC (uses callbacks instead of accessing TPC directly)
* StartMutationSequence
* MutationSequence
* DictionaryEntrySequence
* RecommendDictionary
* RecommendDictionaryEntry
* FuzzerMutate.cpp (which now justs sets callbacks and handles printing)
* MutagenUnittest.cpp (which adds tests of Mutagen.h)
A note on performance: This change was tested with a 100 passes of test/fuzzer/LargeTest.cpp with 1000 runs per pass, both with and without the change. The running time distribution was qualitatively similar both with and without the change, and the average difference was within 30 microseconds (2.240 ms/run vs 2.212 ms/run, respectively). Both times were much higher than observed with the fully optimized system clang (~0.38 ms/run), most likely due to the combination of CMake "dev mode" settings (e.g. CMAKE_BUILD_TYPE="Debug", LLVM_ENABLE_LTO=OFF, etc.). The difference between the two versions built similarly seems to be "in the noise" and suggests no meaningful performance degradation.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D102447
LLVM GN Syncbot [Fri, 2 Jul 2021 16:12:54 +0000 (16:12 +0000)]
[gn build] Port
bf64210fd88f
Jinsong Ji [Fri, 2 Jul 2021 15:46:49 +0000 (15:46 +0000)]
[AIX] Use AsmParser to do inline asm parsing
Add a flag so that target can choose to use AsmParser for parsing inline asm.
And set the flag by default for AIX.
-no-intergrated-as will override this default if specified explicitly.
Reviewed By: #powerpc, shchenz
Differential Revision: https://reviews.llvm.org/D105314
Jinsong Ji [Fri, 2 Jul 2021 15:46:26 +0000 (15:46 +0000)]
[AIX] Add dummy XCOFF MCAsmParserExtension
Implement XCOFFMCAsmParser so that we can use MC to parse inline asm.
The directives and storage mapping classes will be added later
iteratively.
Reviewed By: xgupta
Differential Revision: https://reviews.llvm.org/D105259
David Green [Fri, 2 Jul 2021 16:03:49 +0000 (17:03 +0100)]
[AArch64] Neon saturated truncate tests. NFC
Gus Smith [Thu, 1 Jul 2021 21:45:18 +0000 (21:45 +0000)]
Refactor TensorExp parameters into a union
To make TensorExp clearer, this change refactors the e0/e1 fields into a union: e0/e1 for a binary op tensor expression, and tensor_num for a tensor-kinded tensor expression.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D105303
Sam McCall [Fri, 2 Jul 2021 14:30:19 +0000 (16:30 +0200)]
Reapply [clangd] Fix possible assertion fail in TUScheduler
This reverts commit
fff966b6855aee6fc0d0d4cd401cdd525a838572.
Seems I managed to delete a critical ! after running the tests :-\
Roman Lebedev [Fri, 2 Jul 2021 14:28:33 +0000 (17:28 +0300)]
[NFC][InstCombine] visitUnreachableInst(): enhance comments somewhat
Sam McCall [Fri, 2 Jul 2021 14:26:01 +0000 (16:26 +0200)]
Revert "[clangd] Unbreak mac build differently
0c96a92d8666b8"
This reverts commit
2f79acb7b701c41494abff588b5f03a74ea2e11d.
Should no longer be needed after
26e1553a107f52667be879e99739a4153f8799d8
Nicolas Vasilache [Fri, 2 Jul 2021 07:41:22 +0000 (07:41 +0000)]
[mlir][Linalg] Add comprehensive bufferization support for TiledLoopOp (14/n)
Differential Revision: https://reviews.llvm.org/D105335
Roman Lebedev [Fri, 2 Jul 2021 14:18:48 +0000 (17:18 +0300)]
[InstCombine] visitUnreachableInst(): iteratively erase instructions leading to unreachable
In the original review D87149 it was mentioned that this approach was tried,
and it lead to infinite combine loops, but i'm not seeing anything like that now,
neither in the `check-llvm`, nor on some codebases i tried.
This is a recommit of
d9d65527c289fb27a9f92f150723bbb3c58e413f,
which i immediately reverted because i have messed up something
during branch switch, and
597ccc92ce4b0f90883406d1f78d9d776f602804
accidentally ended up being pushed, which was very much not the intention.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D105339
Roman Lebedev [Fri, 2 Jul 2021 14:17:55 +0000 (17:17 +0300)]
Revert "https://godbolt.org/z/5vhv4K5b8"
This reverts commit
597ccc92ce4b0f90883406d1f78d9d776f602804.
Roman Lebedev [Fri, 2 Jul 2021 14:17:47 +0000 (17:17 +0300)]
Revert "[NFCI][InstCombine] visitUnreachableInst(): iteratively erase instructions leading to unreachable"
This reverts commit
d9d65527c289fb27a9f92f150723bbb3c58e413f.
Roman Lebedev [Fri, 2 Jul 2021 14:16:33 +0000 (17:16 +0300)]
[NFCI][InstCombine] visitUnreachableInst(): iteratively erase instructions leading to unreachable
In the original review D87149 it was mentioned that this approach was tried,
and it lead to infinite combine loops, but i'm not seeing anything like that now,
neither in the `check-llvm`, nor on some codebases i tried.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D105339
Roman Lebedev [Fri, 2 Jul 2021 10:06:37 +0000 (13:06 +0300)]
https://godbolt.org/z/5vhv4K5b8
Sam McCall [Fri, 2 Jul 2021 14:07:11 +0000 (16:07 +0200)]
Revert "[clangd] Fix possible assertion fail in TUScheduler"
This reverts commit
50566947e98ea845030cfa3b4c199fb9a2052d53.
Sam McCall [Fri, 2 Jul 2021 13:55:43 +0000 (15:55 +0200)]
[clangd] Fix possible assertion fail in TUScheduler
BlockUntilIdle is supposed to return false if it fails.
If an intermediate step fails to clear the queue, we shouldn't
charge ahead and assert on the state of the queue.
Nico Weber [Fri, 2 Jul 2021 13:56:21 +0000 (09:56 -0400)]
[llvm-dwarfdump] Add comment saying where DumpDebugFrame comes from
Simon Pilgrim [Fri, 2 Jul 2021 13:50:24 +0000 (14:50 +0100)]
[X86][SLM] Keep similar scheduler costs types together. NFCI.
The SLM model is inconsistent about where it kept its 'unsupported' schedule classes - better to keep them close to similar classes.
I'm not sure why some ymm classes are defined and others are unsupported though (but I haven't altered them) - the only SLM-like CPU supporting any ymm is KNL and that currently uses the HSW model.
Simon Pilgrim [Fri, 2 Jul 2021 13:29:18 +0000 (14:29 +0100)]
[CostModel][X86] Update comment describing source of costs - we now use llvm-mca more than IACA
Simon Pilgrim [Fri, 2 Jul 2021 13:27:27 +0000 (14:27 +0100)]
[CostModel][X86] Drop some hard coded fp<->int scalarization costs
Scalarization costs handling is a lot better now, and the hard coded costs were higher than the worse case numbers from the script in D103695
LLVM GN Syncbot [Fri, 2 Jul 2021 13:05:44 +0000 (13:05 +0000)]
[gn build] Port
a92964779cb5
Nico Weber [Fri, 2 Jul 2021 13:05:12 +0000 (09:05 -0400)]
Revert "[InstrProfiling] Use external weak reference for bias variable"
This reverts commit
33a7b4d9d8e6a113108aa71ed78ca32a83c68523.
Breaks check-profile on macOS, see comments on https://reviews.llvm.org/D105176
Florian Hahn [Fri, 2 Jul 2021 12:48:05 +0000 (13:48 +0100)]
[Matrix] Fix crash during fusion if the same load is re-used.
This patch fixes a crash when the same load is used for both operands of
a fuseable multiply.
Simon Pilgrim [Fri, 2 Jul 2021 12:41:27 +0000 (13:41 +0100)]
[CostModel][X86] Find AVX conversion costs using legalized types if custom types didn't match
Building on rG2a1ef8784ad9a, fallback to attempting to match against legalized types like we do for SSE targets.
Michał Górny [Wed, 14 Apr 2021 09:56:09 +0000 (11:56 +0200)]
[lldb] [gdb-remote client] Refactor SetCurrentThread*()
Refactor SetCurrentThread() and SetCurrentThreadForRun() to reduce code
duplication and simplify it. Both methods now call common
SendSetCurrentThreadPacket() that implements the common protocol
exchange part (the only variable is sending `Hg` vs `Hc`) and returns
the selected TID. The logic is rewritten to use a StreamString
instead of snprintf().
A side effect of the change is that thread-id sent is now zero-padded.
However, this should not have practical impact on the server as both
forms are equivalent.
Differential Revision: https://reviews.llvm.org/D100459
Simon Pilgrim [Fri, 2 Jul 2021 12:07:07 +0000 (13:07 +0100)]
[CostModel][X86] Adjust uitofp(vXi64) SSE/AVX legalized costs based on llvm-mca reports.
Update v4i64 -> v4f32/v4f64 uitofp costs based on the worst case costs from the script in D103695.
Fixes a few regressions before we start adding AVX costs for legalized types.
Alexey Bataev [Thu, 1 Jul 2021 12:14:24 +0000 (05:14 -0700)]
[SLP]Fix gathering of the scalars by not ignoring UndefValues.
The compiler should not ignore UndefValue when gathering the scalars,
otherwise the resulting code may be less defined than the original one.
Also, grouped scalars to insert them at first to reduce the analysis in
further passes.
Differential Revision: https://reviews.llvm.org/D105275
Alexandru Octavian Butiu [Fri, 2 Jul 2021 10:50:07 +0000 (18:50 +0800)]
[MachineCopyPropagation] Fix differences in code gen when compiling with -g
Fixes bugs [[ https://bugs.llvm.org/show_bug.cgi?id=50580 | 50580 ]] and [[ https://bugs.llvm.org/show_bug.cgi?id=49446 | 49446 ]]
When compiling with -g "DBG_VALUE <reg>" instructions are added in the MIR, if such a instruction is inserted between instructions that use <reg> then MachineCopyPropagation invalidates <reg> , this causes some copies to not be propagated and causes differences in code generation (ex bugs 50580 and 49446 ). DBG_VALUE instructions should be ignored since they don't actually modify the register.
Reviewed By: lkail
Differential Revision: https://reviews.llvm.org/D104394
Alex Richardson [Fri, 2 Jul 2021 10:25:43 +0000 (11:25 +0100)]
Place the BlockAddress type in the address space of the containing function
While this should not matter for most architectures (where the program
address space is 0), it is important for CHERI (and therefore Arm Morello).
We use address space 200 for all of our code pointers and without this
change we assert in the SelectionDAG handling of BlockAddress nodes.
It is also useful for AVR: previously programs targeting
AVR that attempt to read their own machine code
via a pointer to a label would instead read from RAM
using a pointer relative to the the start of program flash.
Reviewed By: dylanmckay, theraven
Differential Revision: https://reviews.llvm.org/D48803
Adrian Kuegel [Fri, 2 Jul 2021 09:03:19 +0000 (11:03 +0200)]
Add LogOp to Complex dialect.
Differential Revision: https://reviews.llvm.org/D105337
Sven van Haastregt [Fri, 2 Jul 2021 10:39:17 +0000 (11:39 +0100)]
[NFC] Fix typo in comment
Reported-by: Marco Cali <marco.cali@arm.com>
Florian Hahn [Fri, 2 Jul 2021 09:03:22 +0000 (10:03 +0100)]
[AArch64] Use custom lowering for fp16 vector copysign.
The custom copysign lowering already supports fp16. Use it.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D105277
Roman Lebedev [Fri, 2 Jul 2021 09:59:01 +0000 (12:59 +0300)]
[NFC][SimplifyCFG] Autogenerate checklines in trapping-load-unreachable.ll test
Michał Górny [Fri, 2 Jul 2021 09:44:41 +0000 (11:44 +0200)]
[lldb] [test] Add missing category to test_detach_current
Florian Hahn [Fri, 2 Jul 2021 08:42:47 +0000 (09:42 +0100)]
[Matrix] Hoist address computation before multiply to enable fusion.
If the store address does not dominate the matrix multiply, try to hoist
address computation instructions without side-effects and/or memory
reads before the multiply, to allow fusion.
Reviewed By: thegameg
Differential Revision: https://reviews.llvm.org/D105193
Roman Lebedev [Fri, 2 Jul 2021 08:48:44 +0000 (11:48 +0300)]
Revert "[WebAssembly] Implementation of global.get/set for reftypes in LLVM IR"
This reverts commit
4facbf213c51e4add2e8c19b08d5e58ad71c72de.
```
********************
FAIL: LLVM :: CodeGen/WebAssembly/funcref-call.ll (44466 of 44468)
******************** TEST 'LLVM :: CodeGen/WebAssembly/funcref-call.ll' FAILED ********************
Script:
--
: 'RUN: at line 1'; /builddirs/llvm-project/build-Clang12/bin/llc < /repositories/llvm-project/llvm/test/CodeGen/WebAssembly/funcref-call.ll --mtriple=wasm32-unknown-unknown -asm-verbose=false -mattr=+reference-types | /builddirs/llvm-project/build-Clang12/bin/FileCheck /repositories/llvm-project/llvm/test/CodeGen/WebAssembly/funcref-call.ll
--
Exit Code: 2
Command Output (stderr):
--
llc: /repositories/llvm-project/llvm/include/llvm/Support/LowLevelTypeImpl.h:44: static llvm::LLT llvm::LLT::scalar(unsigned int): Assertion `SizeInBits > 0 && "invalid scalar size"' failed.
```
Michał Górny [Sun, 11 Apr 2021 10:31:06 +0000 (12:31 +0200)]
[lldb] [gdb-remote server] Support selecting process via Hg
Support using the extended thread-id syntax with Hg packet to select
a subprocess. This makes it possible to start providing support for
running some of the debugger packets against another subprocesses.
Differential Revision: https://reviews.llvm.org/D100261
Balázs Kéri [Fri, 2 Jul 2021 07:08:54 +0000 (09:08 +0200)]
[clang][AST] Add support for BindingDecl to ASTImporter.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D102492
Sam McCall [Fri, 2 Jul 2021 07:48:58 +0000 (09:48 +0200)]
[clangd] CMake: express -Iclangd/ at top level and inherit
For files directly under clangd/, -Iclang-tools-extra/clangd (and the
equivalent for generated files) are not required, as CMake/the compiler puts
these directories on the include path by default.
However this means each subdirectory needs to
include_directories(.. ${CMAKE_CURRENT_BINARY_DIR}/..) etc, and this
proved annoying and error-prone to maintain and debug.
Since include_directories is inherited by subdirectories, we just
configure this explicitly at the top level instead.
Paulo Matos [Thu, 10 Jun 2021 08:02:10 +0000 (10:02 +0200)]
[WebAssembly] Implementation of global.get/set for reftypes in LLVM IR
Reland of
31859f896.
This change implements new DAG notes GLOBAL_GET/GLOBAL_SET, and
lowering methods for load and stores of reference types from IR
globals. Once the lowering creates the new nodes, tablegen pattern
matches those and converts them to Wasm global.get/set.
Differential Revision: https://reviews.llvm.org/D104797
Tobias Gysi [Fri, 2 Jul 2021 07:20:09 +0000 (07:20 +0000)]
[mlir][linalg][python] Introduce python integration test folder.
Introduce an integration test folder in the test/python subfolder and move the opsrun.py test into the newly created folder. The test verifies named operations end-to-end using both the yaml and the python path.
Differential Revision: https://reviews.llvm.org/D105276
Tobias Gysi [Fri, 2 Jul 2021 06:45:34 +0000 (06:45 +0000)]
[mlir][linalg][python] Add max operation in OpDSL
Add the max operation to the OpDSL and introduce a max pooling operation to test the implementation. As MLIR has no builtin max operation, the max function is lowered to a compare and select pair.
Differential Revision: https://reviews.llvm.org/D105203
Sam McCall [Fri, 2 Jul 2021 06:55:34 +0000 (08:55 +0200)]
[clangd] Add some more missing include dirs for completeness
Martin Storsjö [Thu, 17 Jun 2021 18:51:37 +0000 (21:51 +0300)]
[LLD] [COFF] Fix up missing stdcall decorations in MinGW mode
If linking directly against a DLL without an import library, the
DLL export symbols might not contain stdcall decorations.
If we have an undefined symbol with decoration, and we happen to have
a matching undecorated symbol (which either is lazy and can be loaded,
or already defined), then alias it against that instead.
This matches what's done in reverse, when we have a def file
declaring to export a symbol without decoration, but we only have
a defined decorated symbol. In that case we do a fuzzy match
(SymbolTable::findMangle). This case is more straightforward; if we
have a decorated undefined symbol, just strip the decoration and look
for the corresponding undecorated symbol name.
Add warnings and options for either silencing the warning or disabling
the whole feature, corresponding to how ld.bfd does it.
(This feature works for any symbol decoration mismatch, not only when
linking against a DLL directly; ld.bfd also tolerates it anywhere,
and also fixes up mismatches in the other direction, like
SymbolTable::findMangle, for any symbol, not only exports. But in
practice, at least for lld, it would primarily end up used for linking
against DLLs.)
Differential Revision: https://reviews.llvm.org/D104532
Martin Storsjö [Thu, 17 Jun 2021 12:57:20 +0000 (15:57 +0300)]
[LLD] [MinGW] Allow linking to DLLs directly
As the COFF linker is capable of linking directly against a DLL now
(after D104530, as long as it is running in mingw mode), don't error
out here but successfully load libraries specified with "-l" from DLLs
if that's what ld.bfd would have matched.
Differential Revision: https://reviews.llvm.org/D104531
Martin Storsjö [Wed, 16 Jun 2021 13:59:46 +0000 (16:59 +0300)]
[LLD] [COFF] Support linking directly against DLLs in MinGW mode
GNU ld.bfd supports linking directly against DLLs without using an
import library, and some projects have picked up on this habit.
(There's no one single unsurmountable issue with using import
libraries, but this is a regularly surfacing missing feature.)
As long as one is linking by name (instead of by ordinal), the DLL
export table contains most of the information needed. (One can
inspect what section a symbol points at, to see if it's a function
or data symbol. The practical implementation of this loops over all
sections for each symbol, but as long as they're not very many, that
should hopefully be tolerable performance wise.)
One exception where the information in the DLL isn't entirely enough
is on i386 with stdcall functions; depending on how they're done,
the exported function name can be a plain undecorated name, while
the import library would contain the full decorated symbol name. This
issue is addressed separately in a different patch.
This is implemented mimicing the structure of a regular import library,
with one InputFile corresponding to the static archive that just adds
lazy symbols, which then are fetched when they are needed. When such
a symbol is fetched, we synthesize a coff_import_header structure
in memory and create a regular ImportFile out of it.
The implementation could be even smaller by just creating ImportFiles
for every symbol available immediately, but that would have the
drawback of actually ending up importing all symbols unless running
with GC enabled (and mingw mode defaults to having it disabled for
historical reasons).
Differential Revision: https://reviews.llvm.org/D104530
Sam McCall [Fri, 2 Jul 2021 06:47:46 +0000 (08:47 +0200)]
[clangd] Fix XPC build due to missing include path
(Tentative, untested as I don't have a mac)
Douglas Yung [Fri, 2 Jul 2021 06:08:48 +0000 (23:08 -0700)]
Relax newly added opcode check to check only for a number instead of a specific opcode.
Vitaly Buka [Fri, 2 Jul 2021 04:40:04 +0000 (21:40 -0700)]
[scudo] Fix test on aarch64 without MTE
Evgeniy Brevnov [Fri, 2 Jul 2021 02:59:06 +0000 (09:59 +0700)]
[NFC][DSE]Change 'do-while' to 'for' loop to simplify code structure
With 'for' loop there is is a single place where 'Current' is adjusted. It helps to avoid copy paste and makes a bit easy to understand overall loop controll flow.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D101044
Fangrui Song [Fri, 2 Jul 2021 02:43:49 +0000 (19:43 -0700)]
[llvm-symbolizer] Move setGroupedShortOptions and don't ignore case
setGroupedShortOptions in the ctor seems more popular.
Lang Hames [Fri, 2 Jul 2021 02:37:22 +0000 (12:37 +1000)]
[ORC] Rename SPSTargetAddress to SPSExecutorAddress.
Also removes SPSTagTargetAddress, which was accidentally introduced at some
point (and never used).
Craig Topper [Fri, 2 Jul 2021 00:08:23 +0000 (17:08 -0700)]
[ScalarizeMaskedMemIntrin][SelectionDAGBuilder] Use the element type to calculate alignment for gather/scatter when alignment operand is 0.
Previously we used the vector type, but we're loading/storing
invididual elements so I think only element alignment should matter.
Noticed while looking at the code for something else so I don't
have a test case.
Differential Revision: https://reviews.llvm.org/D105220
Richard Smith [Fri, 2 Jul 2021 01:43:01 +0000 (18:43 -0700)]
Support for merging UsingPackDecls across modules.
Fixes a false-positive error if the same std::variant<...> type is
instantiated across multiple modules.
Jez Ng [Fri, 2 Jul 2021 00:33:55 +0000 (20:33 -0400)]
[lld-macho] Factor out common InputSection members
We have been creating many ConcatInputSections with identical values due
to .subsections_via_symbols. This diff factors out the identical values
into a Shared struct, to reduce memory consumption and make copying
cheaper.
I also changed `callSiteCount` from a uint32_t to a 31-bit field to save an
extra word.
All in all, this takes InputSection from 120 to 72 bytes (and
ConcatInputSection from 160 to 112 bytes), i.e. 30% size reduction in
ConcatInputSection.
Numbers for linking chromium_framework on my 3.2 GHz 16-Core Intel Xeon W:
N Min Max Median Avg Stddev
x 20 4.14 4.24 4.18 4.183 0.
027548999
+ 20 4.04 4.11 4.075 4.0775 0.
018027756
Difference at 95.0% confidence
-0.1055 +/- 0.0149005
-2.52211% +/- 0.356215%
(Student's t, pooled s = 0.0232803)
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D105305
Jez Ng [Sun, 27 Jun 2021 19:31:34 +0000 (15:31 -0400)]
[lld-macho][nfc] Remove unnecessary vertical spacing
This makes NonLazyPointerSectionBase's style more in line with the rest
of the classes in its file.
Jez Ng [Fri, 2 Jul 2021 00:33:44 +0000 (20:33 -0400)]
[lld-macho] Deduplicate CFStrings
`__cfstring` is a special literal section, so instead of breaking it up
at symbol boundaries, we break it up at fixed-width boundaries (since
each literal is the same size). Symbols can only occur at one of those
boundaries, so this is strictly more powerful than
`.subsections_via_symbols`.
With that in place, we then run the section through ICF.
This change is about perf-neutral when linking chromium_framework.
Reviewed By: #lld-macho, gkm
Differential Revision: https://reviews.llvm.org/D105045
Jez Ng [Fri, 2 Jul 2021 00:33:42 +0000 (20:33 -0400)]
[lld-macho] Move ICF earlier to avoid emitting redundant binds
This is a pretty big refactoring diff, so here are the motivations:
Previously, ICF ran after scanRelocations(), where we emitting
bind/rebase opcodes etc. So we had a bunch of redundant leftovers after
ICF. Having ICF run before Writer seems like a better design, and is
what LLD-ELF does, so this diff refactors it accordingly.
However, ICF had two dependencies on things occurring in Writer: 1) it
needs literals to be deduplicated beforehand and 2) it needs to know
which functions have unwind info, which was being handled by
`UnwindInfoSection::prepareRelocations()`.
In order to do literal deduplication earlier, we need to add literal
input sections to their corresponding output sections. So instead of
putting all input sections into the big `inputSections` vector, and then
filtering them by type later on, I've changed things so that literal
sections get added directly to their output sections during the 'gather'
phase. Likewise for compact unwind sections -- they get added directly
to the UnwindInfoSection now. This latter change is not strictly
necessary, but makes it easier for ICF to determine which functions have
unwind info.
Adding literal sections directly to their output sections means that we
can no longer determine `inputOrder` from iterating over
`inputSections`. Instead, we store that order explicitly on
InputSection. Bloating the size of InputSection for this purpose would
be unfortunate -- but LLD-ELF has already solved this problem: it reuses
`outSecOff` to store this order value.
One downside of this refactor is that we now make an additional pass
over the unwind info relocations to figure out which functions have
unwind info, since want to know that before `processRelocations()`. I've
made sure to run that extra loop only if ICF is enabled, so there should
be no overhead in non-optimizing runs of the linker.
The upside of all this is that the `inputSections` vector now contains
only ConcatInputSections that are destined for ConcatOutputSections, so
we can clean up a bunch of code that just existed to filter out other
elements from that vector.
I will test for the lack of redundant binds/rebases in the upcoming
cfstring deduplication diff. While binds/rebases can also happen in the
regular `.text` section, they're more common in `.data` sections, so it
seems more natural to test it that way.
This change is perf-neutral when linking chromium_framework.
Reviewed By: oontvoo
Differential Revision: https://reviews.llvm.org/D105044
Matthias Springer [Fri, 2 Jul 2021 00:44:41 +0000 (09:44 +0900)]
[mlir] Move BufferizeDimOp to Tensor/Transforms/Bufferize.cpp
Differential Revision: https://reviews.llvm.org/D105256
Rob Suderman [Fri, 2 Jul 2021 00:44:52 +0000 (17:44 -0700)]
[mlir][tosa] Update Bazel files for TOSA pass changes
There were some missing bazel dependencies for the Tosa dialect.
Added these deps.
Reviewed By: GMNGeoffrey
Differential Revision: https://reviews.llvm.org/D105326
Rob Suderman [Fri, 2 Jul 2021 00:04:37 +0000 (17:04 -0700)]
[mlir][tosa] Include TosaDialect as include in tosa PassDetail.h
Tosa's PassDetail.h may be used in non-TOSA transforms. Include
TosaDialect to avoid transient dependency.
Differential Revision: https://reviews.llvm.org/D105324
Matt Arsenault [Fri, 11 Jun 2021 16:02:38 +0000 (12:02 -0400)]
Mips/GlobalISel: Use accurate memory LLTs
Akira Hatanaka [Fri, 2 Jul 2021 00:02:45 +0000 (17:02 -0700)]
Precommit test cases in https://reviews.llvm.org/D104953
Rob Suderman [Thu, 1 Jul 2021 23:35:49 +0000 (16:35 -0700)]
[mlir][tosa] Added missing includes on PassDetails.h
Includes were missing in the PassDetails.h that cause downstream failures
on TOSA passes.
Differential Revision: https://reviews.llvm.org/D105323
Jessica Paquette [Thu, 1 Jul 2021 20:32:07 +0000 (13:32 -0700)]
[GlobalISel] Translate <1 x N> getelementptrs to scalar G_PTR_ADDs
In `IRTranslator::translateGetElementPtr`, when we run into a vector gep with
some scalar operands, we try to normalize those operands using
`buildSplatVector`.
This is fine except for when the getelementptr has a <1 x N> type. In that case
it is treated as a scalar. If we run into one of these then every call to
```
// With VectorWidth = 1
LLT::fixed_vector(VectorWidth, PtrTy)
```
will assert.
Here's an example (equivalent to the added testcase):
https://godbolt.org/z/hGsTnMYdW
To get around this, this patch adds a variable, `WantSplatVector`, which
is true when our vector type ought to actually be represented using a vector.
When it's false, we'll translate as a scalar. This checks if `VectorWidth > 1`.
This fixes this bug:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=35496
Differential Revision: https://reviews.llvm.org/D105316
Rob Suderman [Thu, 17 Jun 2021 22:58:37 +0000 (15:58 -0700)]
[mlir][tosa] Add tosa shape inference with InferReturnTypeComponent
Added InferReturnTypeComponents for NAry operations, reshape, and reverse.
With the additional tosa-infer-shapes pass, we can infer/propagate shapes
across a set of TOSA operations. Current version does not modify the
FuncOp type by inserting an unrealized conversion cast prior to any new
non-matchin returns.
Differential Revision: https://reviews.llvm.org/D105312
Eli Friedman [Thu, 1 Jul 2021 22:35:48 +0000 (15:35 -0700)]
[AArch64] Optimize SVE bitcasts of unpacked types.
Target-independent code only knows how to spill to the stack; instead,
use AArch64ISD::REINTERPRET_CAST.
Differential Revision: https://reviews.llvm.org/D104573
LLVM GN Syncbot [Thu, 1 Jul 2021 22:26:09 +0000 (22:26 +0000)]
[gn build] Port
33a7b4d9d8e6
Petr Hosek [Wed, 30 Jun 2021 07:19:04 +0000 (00:19 -0700)]
[InstrProfiling] Use external weak reference for bias variable
We need the compiler generated variable to override the weak symbol of
the same name inside the profile runtime, but using LinkOnceODRLinkage
results in weak symbol being emitted which leads to an issue where the
linker might choose either of the weak symbols potentially disabling the
runtime counter relocation.
This change replaces the use of weak definition inside the runtime with
an external weak reference to address the issue. We also place the
compiler generated symbol inside a COMDAT group so dead definition can
be garbage collected by the linker.
Differential Revision: https://reviews.llvm.org/D105176
Jon Roelofs [Thu, 1 Jul 2021 15:25:30 +0000 (08:25 -0700)]
[GISel] Print better error messages for missing Combiner Observer calls
Differential revision: https://reviews.llvm.org/D105290
Mehdi Amini [Thu, 1 Jul 2021 20:57:53 +0000 (20:57 +0000)]
Update MLIRContext to allow injecting an external ThreadPool (NFC)
The context can be created with threading disabled, to avoid creating a thread pool
that may be destroyed when injecting another one later.
Differential Revision: https://reviews.llvm.org/D105302