sameeran joshi [Mon, 21 Dec 2020 17:14:22 +0000 (22:44 +0530)]
[Flang][openmp][5/5] Make dist_schedule clause part of OmpClause
After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.
The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
`llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
TableGen, if incase we generate parser using TableGen we could have only a
single `let expression`.
This patch makes `OmpDistScheduleClause` clause part of `OmpClause`.
The unparse function for `OmpDistScheduleClause` is adapted since the keyword
and parenthesis are issued by the corresponding unparse function for
`parser::OmpClause::DistSchedule`.
Reviewed By: clementval, kiranktp
Differential Revision: https://reviews.llvm.org/D93644
Alex Zinenko [Mon, 21 Dec 2020 11:16:30 +0000 (12:16 +0100)]
[mlir] remove deprecated string-based OpBuilder from ODS
It has been deprecated with a warning for two months, removing.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D93623
sameeran joshi [Mon, 21 Dec 2020 14:04:12 +0000 (19:34 +0530)]
[Flang][openmp][4/5] Make nowait clause part of OmpClause
After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.
The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
`llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
TableGen, if incase we generate parser using TableGen we could have only a
single `let expression`.
This patch makes `OmpNoWait` clause part of `OmpClause`.
Reviewed By: clementval, kiranktp
Differential Revision: https://reviews.llvm.org/D93643
Gil Rapaport [Tue, 15 Dec 2020 20:47:12 +0000 (22:47 +0200)]
[LV] Avoid needless fold tail
When the trip-count is provably divisible by the maximal/chosen VF, folding the
loop's tail during vectorization is redundant. This commit extends the existing
test for constant trip-counts to any trip-count known to be divisible by
maximal/selected VF by SCEV.
Differential Revision: https://reviews.llvm.org/D93615
sameeran joshi [Mon, 21 Dec 2020 13:13:44 +0000 (18:43 +0530)]
[Flang][openmp][3/5] Make ProcBind clause part of OmpClause
After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.
The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
`llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
TableGen, if incase we generate parser using TableGen we could have only a
single `let expression`.
This patch makes `OmpProcBindClause` clause part of `OmpClause`.
The unparse function is dropped as the unparsing is done by `WALK_NESTED_ENUM`
for `OmpProcBindClause`.
Reviewed By: clementval, kiranktp
Differential Revision: https://reviews.llvm.org/D93642
Quentin Chateau [Tue, 22 Dec 2020 07:44:20 +0000 (08:44 +0100)]
[clangd] Trim memory periodically when using glibc malloc
This diff addresses the issue of the ever increasing memory usage of clangd. The key to understand what happens is to use `malloc_stats()`: malloc arenas keep getting bigger, although the actual memory used does not. It seems some operations while bulding the indices (both dynamic and background) create this problem. Specifically, 'FileSymbols::update' and 'FileSymbols::buildIndex' seem especially affected.
This diff adds a call to `malloc_trim()` periodically in
ClangdLSPServer.
Fixes: https://github.com/clangd/clangd/issues/251
Fixes: https://github.com/clangd/clangd/issues/115
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D93452
sameeran joshi [Mon, 21 Dec 2020 08:40:27 +0000 (14:10 +0530)]
[Flang][openmp][2/5] Make Default clause part of OmpClause
After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.
The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
`llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
TableGen, if incase we generate parser using TableGen we could have only a
single `let expression`.
This patch makes `OmpDefaultClause` clause part of `OmpClause`.
The unparse function is dropped as the unparsing is done by `WALK_NESTED_ENUM`
for `OmpDefaultClause`.
Reviewed By: clementval, kiranktp
Differential Revision: https://reviews.llvm.org/D93641
sameeran joshi [Fri, 18 Dec 2020 18:33:45 +0000 (00:03 +0530)]
[Flang][openmp][1/5] Make Allocate clause part of OmpClause
After discussion in `D93482` we found that the some of the clauses were not
following the common OmpClause convention.
The benefits of using OmpClause:
- Functionalities from structure checker are mostly aligned to work with
`llvm::omp::Clause`.
- The unparsing as well can take advantage.
- Homogeneity with OpenACC and rest of the clauses in OpenMP.
- Could even generate the parser with TableGen, when there is homogeneity.
- It becomes confusing when to use `flangClass` and `flangClassValue` inside
TableGen, if incase we generate parser using TableGen we could have only a
single `let expression`.
This patch makes `allocate` clause part of `OmpClause`.The unparse function for
`OmpAllocateClause` is adapted since the keyword and parenthesis are issued by
the corresponding unparse function for `parser::OmpClause::Allocate`.
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D93640
Hsiangkai Wang [Tue, 15 Dec 2020 23:06:07 +0000 (07:06 +0800)]
[RISCV] Define vector compare intrinsics.
Define vector compare intrinsics and lower them to V instructions.
We work with @rogfer01 from BSC to come out this patch.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Hsiangkai Wang <kai.wang@sifive.com>
Differential Revision: https://reviews.llvm.org/D93368
Zakk Chen [Fri, 18 Dec 2020 08:14:53 +0000 (00:14 -0800)]
[RISCV] Define vleff intrinsics.
Define vleff intrinsics and lower to V instructions.
We work with @rogfer01 from BSC to come out this patch.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Zakk Chen <zakk.chen@sifive.com>
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D93516
Bing1 Yu [Tue, 22 Dec 2020 05:09:22 +0000 (13:09 +0800)]
[LegalizeType] When LegalizeType procedure widens a masked_gather, set MemoryType's EltNum equal to Result's EltNum
When LegalizeType procedure widens a masked_gather, set MemoryType's EltNum equal to Result's EltNum.
As I mentioned in https://reviews.llvm.org/D91092, in previous code, If we have a v17i32's masked_gather in avx512, we widen it to a v32i32's masked_gather with a v17i32's MemoryType. When the SplitVecRes_MGATHER process this v32i32's masked_gather, GetSplitDestVTs will assert fail since what you are going to split is v17i32.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D93610
Zi Xuan Wu [Tue, 22 Dec 2020 02:56:43 +0000 (10:56 +0800)]
[CSKY 3/n] Add bare-bones C-SKY MCTargetDesc
Add basis of CSKY MCTargetDesc and it's enough to compile and link but doesn't yet do anything particularly useful.
Once an ASM parser and printer are added in the next two patches, the whole thing can be usefully tested.
Differential Revision: https://reviews.llvm.org/D93372
Tom Stellard [Mon, 21 Dec 2020 23:24:45 +0000 (15:24 -0800)]
scan-view: Remove Reporter.py and associated AppleScript files
I'm not exactly sure what this is, but it appears to be a tool for reporting
internal issues at Apple. These files haven't been meaningfully updated in
12 years, and it doesn't seem like there is any reason to keep them in tree.
Reviewed By: NoQ
Differential Revision: https://reviews.llvm.org/D93565
Nico Weber [Thu, 17 Dec 2020 18:30:18 +0000 (13:30 -0500)]
[lld/mac] Implement support for private extern symbols
Private extern symbols are used for things scoped to the linkage unit.
They cause duplicate symbol errors (so they're in the symbol table,
unlike TU-scoped truly local symbols), but they don't make it into the
export trie. They are created e.g. by compiling with
-fvisibility=hidden.
If two weak symbols have differing privateness, the combined symbol is
non-private external. (Example: inline functions and some TUs that
include the header defining it were built with
-fvisibility-inlines-hidden and some weren't).
A weak private external symbol implicitly has its "weak" dropped and
behaves like a regular strong private external symbol: Weak is an export
trie concept, and private symbols are not in the export trie.
If a weak and a strong symbol have different privateness, the strong
symbol wins.
If two common symbols have differing privateness, the larger symbol
wins. If they have the same size, the privateness of the symbol seen
later during the link wins (!) -- this is a bit lame, but it matches
ld64 and this behavior takes 2 lines less to implement than the less
surprising "result is non-private external), so match ld64.
(Example: `int a` in two .c files, both built with -fcommon,
one built with -fvisibility=hidden and one without.)
This also makes `__dyld_private` a true TU-local symbol, matching ld64.
To make this work, make the `const char*` StringRefZ ctor to correctly
set `size` (without this, writing the string table crashed when calling
getName() on the __dyld_private symbol).
Mention in CommonSymbol's comment that common symbols are now disabled
by default in clang.
Mention in -keep_private_externs's HelpText that the flag only has an
effect with `-r` (which we don't implement yet -- so this patch here
doesn't regress any behavior around -r + -keep_private_externs)). ld64
doesn't explicitly document it, but the commit text of
http://reviews.llvm.org/rL216146 does, and ld64's
OutputFile::buildSymbolTable() checks `_options.outputKind() ==
Options::kObjectFile` before calling `_options.keepPrivateExterns()`
(the only reference to that function).
Fixes PR48536.
Differential Revision: https://reviews.llvm.org/D93609
ShihPo Hung [Mon, 21 Dec 2020 06:41:47 +0000 (22:41 -0800)]
[RISCV] Add intrinsics for vmacc/vnmsac/vmadd/vnmsub instructions
This defines vmadd, vmacc, vnmsub, and vnmsac intrinsics and
lower to V instructions.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Differential Revision: https://reviews.llvm.org/D93632
Tres Popp [Tue, 22 Dec 2020 01:19:31 +0000 (02:19 +0100)]
Revert "[mlir] Add SmallVector sizes"
This reverts commit
83274a0773f6a20abdc848b448009e0195c42166.
Fixed in
a555ca8b3d67
Fangrui Song [Tue, 22 Dec 2020 01:18:28 +0000 (17:18 -0800)]
[MC][test] Reorganize .cfi_* tests
Delete tests which are covered by others.
Ta-Wei Tu [Tue, 22 Dec 2020 00:42:52 +0000 (08:42 +0800)]
[LoopNest] Extend `LPMUpdater` and adaptor to handle loop-nest passes
This is a follow-up patch of D87045.
The patch implements "loop-nest mode" for `LPMUpdater` and `FunctionToLoopPassAdaptor` in which only top-level loops are operated.
`createFunctionToLoopPassAdaptor` decides whether the returned adaptor is in loop-nest mode or not based on the given pass. If the pass is a loop-nest pass or the pass is a `LoopPassManager` which contains only loop-nest passes, the loop-nest version of adaptor is returned; otherwise, the normal (loop) version of adaptor is returned.
Reviewed By: Whitney
Differential Revision: https://reviews.llvm.org/D87531
Craig Topper [Mon, 21 Dec 2020 23:16:57 +0000 (15:16 -0800)]
[RISCV] Use more precise type constraints for the vmv.v.v and vmv.v.x intrinsics.
We can infer the input type from the result type. For vmv.v.v its
the same. For vmv.v.x its the element type.
Craig Topper [Mon, 21 Dec 2020 22:59:45 +0000 (14:59 -0800)]
[RISCV] Update vmv.v.v-rv32.ll and vmv.v.v-rv64.ll to test the correct intrinsics.
These were accidentally identical to the vmv.v.x tests. I must
have fumbled when I copied them from our downstream repo.
Tres Popp [Mon, 21 Dec 2020 21:57:34 +0000 (22:57 +0100)]
[mlir] Add SmallVector sizes
This is a temporary fix until figuring out how to correct the forward
declare in mlir/include/mlir/Support/LLVM.h
Differential Revision: https://reviews.llvm.org/D93666
Congzhe Cao [Mon, 21 Dec 2020 18:33:58 +0000 (13:33 -0500)]
[InstCombine] Add check of i1 types in select-to-zext/sext transformation
When doing select-to-zext/sext transformations, we should
not handle TrueVal and FalseVal of i1 type otherwise it
would result in zext/sext i1 to i1.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D93272
Fangrui Song [Mon, 21 Dec 2020 23:32:35 +0000 (15:32 -0800)]
[Driver] Default Generic_GCC ppc/ppc64/ppc64le to -fasynchronous-unwind-tables
GCC made the switch on 2018-04-10 ("rs6000: Enable -fasynchronous-unwind-tables by default").
In Clang, FreeBSD/NetBSD powerpc have already defaulted to -fasynchronous-unwind-tables.
This patch defaults Generic_GCC powerpc (which affects Linux) to use -fasynchronous-unwind-tables.
Reviewed By: #powerpc, nemanjai
Differential Revision: https://reviews.llvm.org/D92054
Tom Stellard [Mon, 21 Dec 2020 23:16:09 +0000 (15:16 -0800)]
HowToReleaseLLVM: Update document to match the current release process
Change Summary:
* Clarify that release manager can commit without code owner approval
(but are still highly encouraged to get approval).
* Clarify that there is no official release criteria.
* Document what types of changes are allowed in each release phase.
This is update is based on the RFC submitted here:
http://lists.llvm.org/pipermail/llvm-dev/2020-May/141730.html
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D93493
Tom Stellard [Mon, 21 Dec 2020 21:29:56 +0000 (13:29 -0800)]
llvm-profgen: Parse command line arguments after initializing targets
I am experimenting with turning backends into loadable modules and in
that scenario, target specific command line arguments won't be available
until after the targets are initialized.
Also, most other tools initialize targets before parsing arguments.
Reviewed By: wlei
Differential Revision: https://reviews.llvm.org/D93348
George Mitenkov [Mon, 21 Dec 2020 22:44:31 +0000 (01:44 +0300)]
[MLIR][SPIRVToLLVM] Updated documentation on spirv-cpu-runner
This patch adds documentation for the `mlir-spirv-cpu-runner`.
It provides an overview of applied transformations and passes, as
well as an example walk-through.
Some typos in the documentation have been fixed as well.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D93620
Arthur Eubanks [Mon, 21 Dec 2020 22:39:19 +0000 (14:39 -0800)]
[NFC] Remove unused function
Evandro Menezes [Sat, 19 Dec 2020 02:34:55 +0000 (20:34 -0600)]
[RISCV] Define the vand, vor and vxor RVV intrinsics
Define the `vand`, `vor` and `vxor` IR intrinsics for the respective V instructions.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Evandro Menezes <evandro.menezes@sifive.com>
Differential Revision: https://reviews.llvm.org/D93574
Aart Bik [Mon, 21 Dec 2020 21:42:38 +0000 (13:42 -0800)]
[mlir][sparse] adjust output tensor to synthetic tensor
Fixes a merge conflict with previous two CLs.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D93664
Fangrui Song [Mon, 21 Dec 2020 22:04:13 +0000 (14:04 -0800)]
[MC] Split MCContext::createTempSymbol, default AlwaysAddSuffix to true, and add comments
CanBeUnnamed is rarely false. Splitting to a createNamedTempSymbol makes the
intention clearer and matches the direction of reverted r240130 (to drop the
unneeded parameters).
No behavior change.
Fangrui Song [Mon, 21 Dec 2020 21:46:45 +0000 (13:46 -0800)]
Migrate MCContext::createTempSymbol call sites to AlwaysAddSuffix=true
Most call sites set AlwaysAddSuffix to true. The two use cases do not really
need false and can be more consistent with other temporary symbol usage.
Arthur Eubanks [Tue, 15 Dec 2020 02:06:10 +0000 (18:06 -0800)]
[NewPM] Add TargetMachine method to add alias analyses
AMDGPUTargetMachine::adjustPassManager() adds some alias analyses to the
legacy PM. We need a way to do the same for the new PM in order to port
AMDGPUTargetMachine::adjustPassManager() to the new PM.
Currently the new PM adds alias analyses by creating an AAManager via
PassBuilder and overriding the AAManager a PassManager uses via
FunctionAnalysisManager::registerPass().
We will continue to respect a custom AA pipeline that specifies an exact
AA pipeline to use, but for "default" we will now add alias analyses
that backends specify. Most uses of PassManager use the "default"
AAManager created by PassBuilder::buildDefaultAAPipeline(). Backends can
override the newly added TargetMachine::registerAliasAnalyses() to add custom
alias analyses.
Reviewed By: ychen
Differential Revision: https://reviews.llvm.org/D93261
Scott Linder [Mon, 21 Dec 2020 17:38:56 +0000 (17:38 +0000)]
Revert "[AMDGPU][HIP] Switch default DWARF version to 5"
This reverts commit
c4d10e7e9bb47b77fad43d8ddcfa328298f36c88.
Differential Revision: https://reviews.llvm.org/D93648
Thomas Raoux [Mon, 21 Dec 2020 21:17:17 +0000 (13:17 -0800)]
[mlir][vector] Extend vector unroll to all element-wise ops
Extend unroll to support all element-wise ops and allow unrolling for ops with
vector operands of with the same shape as the destination but different element
type (like Cmp or Select).
Differential Revision: https://reviews.llvm.org/D93121
ergawy [Mon, 21 Dec 2020 08:40:40 +0000 (09:40 +0100)]
[MLIR][Docs] Fix a small typo in documentation.
Just fixes a tiny typo in a link between 2 pages.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D93616
Michał Górny [Mon, 21 Dec 2020 21:26:33 +0000 (22:26 +0100)]
[lldb] [Process/FreeBSDRemote] Remove anonymous namespace
nicolasvasilache [Mon, 21 Dec 2020 18:03:12 +0000 (10:03 -0800)]
[mlir][Linalg] Revisit the Linalg on tensors abstraction
This revision drops init_tensor arguments from Linalg on tensors and instead uniformizes the output buffers and output tensors to be consistent.
This significantly simplifies the usage of Linalg on tensors and is a stepping stone for
its evolution towards a mixed tensor and shape abstraction discussed in https://llvm.discourse.group/t/linalg-and-shapes/2421/19.
Differential Revision: https://reviews.llvm.org/D93469
Valentin Clement [Mon, 21 Dec 2020 20:06:55 +0000 (15:06 -0500)]
[openacc] Use TableGen enum for default clause value
Use the TableGen feature to have enum values for clauses.
Next step will be to extend the MLIR part used currently by OpenMP
to use the same enum on the dialect side.
This patch also add function that convert the enum to StringRef to be
used on the dump-parse-tree from flang.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D93576
Jez Ng [Mon, 21 Dec 2020 19:44:01 +0000 (14:44 -0500)]
[lld-macho][nfc] Remove %T from headerpad.s
The llvm-lit docs indicate that it is deprecated.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D93605
Jez Ng [Mon, 21 Dec 2020 19:43:58 +0000 (14:43 -0500)]
[lld-macho][nfc] Clean up tests
* Migrate most of our tests to use `split-file` instead of `echo`
* Remove individual `rm -f %t/libfoo.a` commands in favor of a top-level `rm -rf %t`
* Remove unused `Inputs/libfunction.s`
Reviewed By: #lld-macho, compnerd
Differential Revision: https://reviews.llvm.org/D93604
Pavel Labath [Mon, 21 Dec 2020 19:39:05 +0000 (20:39 +0100)]
[lldb] Remove anonymous namespace from NativeRegisterContextLinux_x86_64
Use "static" instead.
Quentin Chateau [Mon, 21 Dec 2020 19:16:47 +0000 (20:16 +0100)]
[clangd][NFC] Improve clangd status messages
clangd actions have various naming schemes, the most
common being PascalCase. This commit applies PascalCase
to all clangd actions, and fix the status rendering
in `renderTUAction` to look more consistent.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D93546
Nikita Popov [Sun, 20 Dec 2020 20:30:33 +0000 (21:30 +0100)]
[AA] byval argument is identified function local
byval arguments should mostly get the same treatment as noalias
arguments in alias analysis. This was not the case for the
isIdentifiedFunctionLocal() function.
Marking byval arguments as identified function local means that
they cannot alias with other arguments, which I believe is correct.
Differential Revision: https://reviews.llvm.org/D93602
Hafiz Abid Qadeer [Mon, 21 Dec 2020 19:06:17 +0000 (19:06 +0000)]
Update references to 'master' branch.
This commit replace 'master' with 'main' in llvm/docs.
Reviewed By: sammccall, kristof.beyls
Differential Revision: https://reviews.llvm.org/D92831
Peter Collingbourne [Fri, 18 Dec 2020 05:02:01 +0000 (21:02 -0800)]
scudo: Remove ANDROID_EXPERIMENTAL_MTE macro.
Kernel support for MTE has been released in Linux 5.10. This means
that it is a stable API and we no longer need to make the support
conditional on a macro. We do need to provide conditional definitions
of the new macros though in order to avoid a dependency on new
kernel headers.
Differential Revision: https://reviews.llvm.org/D93513
Michael Liao [Mon, 21 Dec 2020 18:02:47 +0000 (13:02 -0500)]
[cuda][hip] Fix typoes in header wrappers.
Dmitry Preobrazhensky [Mon, 21 Dec 2020 17:42:35 +0000 (20:42 +0300)]
[AMDGPU][MC][NFC] Fix for sanitizer error in 8ab5770
Corrected to fix sanitizer error introduced by 8ab5770
Dmitry Preobrazhensky [Mon, 21 Dec 2020 17:21:07 +0000 (20:21 +0300)]
[AMDGPU][MC][NFC] Parser refactoring
See bug 48515 (https://bugs.llvm.org/show_bug.cgi?id=48515)
Reviewers: rampitec
Differential Revision: https://reviews.llvm.org/D93548
Dmitry Preobrazhensky [Mon, 21 Dec 2020 16:52:27 +0000 (19:52 +0300)]
[AMDGPU][MC][NFC] Lit tests cleanup
See bug 48513
Reviewers: rampitec
Differential Revision: https://reviews.llvm.org/D93550
Thomas Raoux [Fri, 18 Dec 2020 00:26:07 +0000 (16:26 -0800)]
[mlir[[vector] Extend Transfer read/write ops to support tensor types.
Transfer_ops can now work on both buffers and tensor. Right now, lowering of
the tensor case is not supported yet.
Differential Revision: https://reviews.llvm.org/D93500
David Spickett [Mon, 21 Dec 2020 16:45:57 +0000 (16:45 +0000)]
[clang] Fix expected errors in plugin attribute example
b2ba6867eac10874bd279c739639bdb9e60c1996 was landed
with updated error messages in the example file
but not in the test file.
Fangrui Song [Mon, 21 Dec 2020 16:47:04 +0000 (08:47 -0800)]
[ELF] Reject local-exec TLS relocations for -shared
For x86-64, D33100 added a diagnostic for local-exec TLS relocations referencing a preemptible symbol.
This patch generalizes it to non-preemptible symbols (see `-Bsymbolic` in `tls.s`)
on all targets.
Local-exec TLS relocations resolve to offsets relative to a fixed point within
the static TLS block, which are only meaningful for the executable.
With this change, `clang -fpic -shared -fuse-ld=bfd a.c` on the following example will be flagged for AArch64/ARM/i386/x86-64/RISC-V
```
static __attribute__((tls_model("local-exec"))) __thread long TlsVar = 42;
long bump() { return ++TlsVar; }
```
Note, in GNU ld, at least arm, riscv and x86's ports have the similar
diagnostics, but aarch64 and ppc64 do not error.
Differential Revision: https://reviews.llvm.org/D93331
Fangrui Song [Mon, 21 Dec 2020 16:45:41 +0000 (08:45 -0800)]
[ELF][PPC64] Detect missing R_PPC64_TLSGD/R_PPC64_TLSLD and disable TLS relaxation
Alternative to D91611.
The TLS General Dynamic/Local Dynamic code sequences need to mark
`__tls_get_addr` with R_PPC64_TLSGD or R_PPC64_TLSLD, e.g.
```
addis r3, r2, x@got@tlsgd@ha # R_PPC64_GOT_TLSGD16_HA
addi r3, r3, x@got@tlsgd@l # R_PPC64_GOT_TLSGD16_LO
bl __tls_get_addr(x@tlsgd) # R_PPC64_TLSGD followed by R_PPC64_REL24
nop
```
However, there are two deviations form the above:
1. direct call to `__tls_get_addr`. This is essential to implement ld.so in glibc/musl/FreeBSD.
```
bl __tls_get_addr
nop
```
This is only used in a -shared link, and thus not subject to the GD/LD to IE/LE
relaxation issue below.
2. Missing R_PPC64_TLSGD/R_PPC64_TLSGD for compiler generated TLS references
According to Stefan Pintille, "In the early days of the transition from the
ELFv1 ABI that is used for big endian PowerPC Linux distributions to the ELFv2
ABI that is used for little endian PowerPC Linux distributions, there was some
ambiguity in the specification of the relocations for TLS. The GNU linker has
implemented support for correct handling of calls to __tls_get_addr with a
missing relocation. Unfortunately, we didn't notice that the IBM XL compiler
did not handle TLS according to the updated ABI until we tried linking XL
compiled libraries with LLD."
In short, LLD needs to work around the old IBM XL compiler issue.
Otherwise, if the object file is linked in -no-pie or -pie mode,
the result will be incorrect because the 4 instructions are partially
rewritten (the latter 2 are not changed).
Work around the compiler bug by disable General Dynamic/Local Dynamic to
Initial Exec/Local Exec relaxation. Note, we also disable Initial Exec
to Local Exec relaxation for implementation simplicity, though technically it can be kept.
ppc64-tls-missing-gdld.s demonstrates the updated behavior.
Reviewed By: #powerpc, stefanp, grimar
Differential Revision: https://reviews.llvm.org/D92959
Paul C. Anagnostopoulos [Mon, 21 Dec 2020 15:45:30 +0000 (10:45 -0500)]
Revert "[TableGen] Add the !substr() bang operator"
This reverts commit
3a675c777dd5788e2313cb06fb27b01f8a2e7573.
Michael Forster [Mon, 21 Dec 2020 15:21:31 +0000 (16:21 +0100)]
Remove unused variables.
Differential Revision: https://reviews.llvm.org/D93635
Simon Pilgrim [Mon, 21 Dec 2020 15:22:27 +0000 (15:22 +0000)]
[AggressiveInstCombine] Generalize foldGuardedRotateToFunnelShift to generic funnel shifts (REAPPLIED)
The fold currently only handles rotation patterns, but with the maturation of backend funnel shift handling we can now realistically handle all funnel shift patterns.
This should allow us to begin resolving PR46896 et al.
Ensure we block poison in a funnel shift value - similar to rG0fe91ad463fea9d08cbcd640a62aa9ca2d8d05e0
Reapplied with fix for PR48068 - we weren't checking that the shift values could be hoisted from their basicblocks.
Differential Revision: https://reviews.llvm.org/D90625
Paul C. Anagnostopoulos [Wed, 16 Dec 2020 14:55:16 +0000 (09:55 -0500)]
[TableGen] Add the !substr() bang operator
Update the documentation and add a test.
Differential Revision: https://reviews.llvm.org/D93419
Sanjay Patel [Mon, 21 Dec 2020 13:48:04 +0000 (08:48 -0500)]
[InstSimplify] reduce logic with inverted add/sub ops
https://llvm.org/PR48559
This could be part of a larger ValueTracking API,
but I don't see that currently.
https://rise4fun.com/Alive/gR0
Name: and
Pre: C1 == ~C2
%sub = add i8 %x, C1
%sub1 = sub i8 C2, %x
%r = and i8 %sub, %sub1
=>
%r = 0
Name: or
Pre: C1 == ~C2
%sub = add i8 %x, C1
%sub1 = sub i8 C2, %x
%r = or i8 %sub, %sub1
=>
%r = -1
Name: xor
Pre: C1 == ~C2
%sub = add i8 %x, C1
%sub1 = sub i8 C2, %x
%r = xor i8 %sub, %sub1
=>
%r = -1
Sanjay Patel [Mon, 21 Dec 2020 13:26:55 +0000 (08:26 -0500)]
[InstSimplify] add tests for inverted logic operands; NFC
Kazushi (Jam) Marukawa [Fri, 18 Dec 2020 16:12:25 +0000 (01:12 +0900)]
[VE] Correct VMP allocation in calling conv
VE used to allocate VM1, VM2, VMP2 (VM4+VM5), and VM3. This patch
corrects to allocate VM1, VM2, VMP2 (VM4+VM5), and VM6. Also add
a regression test.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D93570
Florian Hahn [Mon, 21 Dec 2020 11:12:40 +0000 (11:12 +0000)]
[VPlan] Make VPRecipeBase inherit from VPDef.
This patch makes VPRecipeBase a direct subclass of VPDef, moving the
SubclassID to VPDef.
Reviewed By: gilr
Differential Revision: https://reviews.llvm.org/D90564
Denis Antrushin [Thu, 17 Dec 2020 09:36:57 +0000 (16:36 +0700)]
[Statepoints] Disable VReg lowering for values used on exception path of invoke.
Currently we lower invokes the same way as usual calls, e.g.:
V1 = STATEPOINT ... V (tied-def 0)
But this is incorrect is V1 is used on exceptional path.
By LLVM rules V1 neither dominates its uses in landing pad, nor
its live range is live on entry to landing pad. So compiler is
allowed to do various weird transformations like splitting live
range after statepoint and use split LR in catch block.
Until (and if) we find better solution to this problem, let's
use old lowering (spilling) for those values which are used on
exceptional path and allow VReg lowering for values used only
on normal path.
Differential Revision: https://reviews.llvm.org/D93449
Yafei Liu [Mon, 21 Dec 2020 13:22:56 +0000 (08:22 -0500)]
Refactoring the attribute plugin example to fit the new API
Make the example compile and the test case pass.
Kazushi (Jam) Marukawa [Fri, 27 Nov 2020 13:51:11 +0000 (22:51 +0900)]
[VE] Optimize LEA combinations
Change to optimize references of elements of aggregate data. Also
add regression tests.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D93627
Jan Svoboda [Fri, 18 Dec 2020 10:18:12 +0000 (11:18 +0100)]
[TableGen] NFC: Rename variables in OptParserEmitter
Switch to the LLVM naming convention.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D93527
Jan Svoboda [Fri, 18 Dec 2020 09:52:53 +0000 (10:52 +0100)]
[TableGen] NFC: Switch to range-based for loops in OptParserEmitter
This simplifies the code a bit. No functionality change.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D93526
Andrzej Warzynski [Mon, 21 Dec 2020 11:09:06 +0000 (11:09 +0000)]
[flang][driver] Make the names of files created in unit tests unique (nfc)
Using files with identical names leads to unexpected failures when tests
are run in parallel. This is tricky to reproduce, but has been happening
on some buildbots since merging https://reviews.llvm.org/D92854. In that
patch I added a unit test with a non-unique test file. This patch fixes
that.
Kazushi (Jam) Marukawa [Fri, 18 Dec 2020 14:21:10 +0000 (23:21 +0900)]
[VE] Support STACKSAVE and STACKRESTORE
Change to use default expanded code. Add regression tests also.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D93539
Kazushi (Jam) Marukawa [Tue, 15 Dec 2020 14:22:39 +0000 (23:22 +0900)]
[VE] Support RETURNADDR
Implement RETURNADDR for VE. Add a regression test also.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D93545
Florian Hahn [Mon, 21 Dec 2020 09:14:57 +0000 (09:14 +0000)]
[VPlan] Use VPDef for VPInterleaveRecipe.
This patch turns updates VPInterleaveRecipe to manage the values it defines
using VPDef. The VPValue is used during VPlan construction and
codegeneration instead of the plain IR reference where possible.
Reviewed By: gilr
Differential Revision: https://reviews.llvm.org/D90562
Simon Moll [Mon, 21 Dec 2020 09:59:22 +0000 (10:59 +0100)]
[VP][NFC] ISD::VP_Sub -> ISD::VP_SUB
Jan Svoboda [Fri, 18 Dec 2020 14:24:39 +0000 (15:24 +0100)]
[clang] Use enum for LangOptions::SYCLVersion instead of unsigned
`LangOptions::SYCLVersion` can only have two values. This patch introduces an enum that allows us to reduce the member size from 32 bits to 1 bit.
Consequently, this also makes marshalling of this option fit into our model for enums: D84674.
Reviewed By: bader
Differential Revision: https://reviews.llvm.org/D93540
Jan Svoboda [Fri, 18 Dec 2020 12:55:48 +0000 (13:55 +0100)]
[clang][cli] Let denormalizer decide how to render the option based on the option class
Before this patch, you needed to use `AutoNormalizeEnumJoined` whenever you wanted to **de**normalize joined enum.
Besides the naming confusion, this means the fact the option is joined is specified in two places: in the normalization multiclass and in the `Joined<["-"], ...>` multiclass.
This patch makes this work automatically, taking into account the `OptionClass` of options.
Also, the enum denormalizer now just looks up the spelling of the present enum case in a table and forwards it to the string denormalizer.
I also added more tests that exercise this.
Reviewed By: dexonsmith
Original patch by Daniel Grumberg.
Differential Revision: https://reviews.llvm.org/D84189
Jan Svoboda [Fri, 18 Dec 2020 15:14:18 +0000 (16:14 +0100)]
[clang][cli] Streamline MarshallingInfoFlag description
This replaces the existing `MarshallingInfoFlag<...>, IsNegative` with simpler `MarshallingInfoNegativeFlag`.
Reviewed By: dexonsmith
Original patch by Daniel Grumberg.
Differential Revision: https://reviews.llvm.org/D84675
David Sherwood [Mon, 21 Dec 2020 09:05:01 +0000 (09:05 +0000)]
[NFC][InstructionCost] Remove isValid() asserts in SLPVectorizer.cpp
An earlier patch introduced asserts that the InstructionCost is
valid because at that time the ReuseShuffleCost variable was an
unsigned. However, now that the variable is an InstructionCost
instance the asserts can be removed.
See this thread for context:
http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
See this patch for the introduction of the type:
https://reviews.llvm.org/D91174
George Mitenkov [Mon, 21 Dec 2020 08:19:32 +0000 (11:19 +0300)]
[MLIR][SPIRVToLLVM] Updated documentation on entry points and not supported ops
This patch addresses two issues:
1. Not supported ops are updated to pick up the changes in the
SPIR-V dialect.
2. Conversion on `spv.ExecutionMode` is updated.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D91881
Fangrui Song [Mon, 21 Dec 2020 07:45:48 +0000 (23:45 -0800)]
[AsmPrinter] Replace a reachable report_fatal_error with MCContext::reportError
Fangrui Song [Mon, 21 Dec 2020 07:23:12 +0000 (23:23 -0800)]
MCContext::reportError: don't call report_fatal_error
Errors from MCAssembler, MCObjectStreamer and *ObjectWriter typically cause a crash:
```
% cat c.c
int bar;
extern int foo __attribute__((alias("bar")));
% clang -c -fcommon c.c
fatal error: error in backend: Common symbol 'bar' cannot be used in assignment expr
PLEASE submit a bug report to ...
Stack dump:
...
```
`LLVMTargetMachine::addPassesToEmitFile` constructs `MachineModuleInfoWrapperPass`
which creates a MCContext without SourceMgr. `MCContext::reportError` calls
`report_fatal_error` which gets captured by Clang `LLVMErrorHandler` and gets translated
to the output above.
Since `MCContext::reportError` errors indicate user errors, such a crashing style error
is inappropriate. So this patch changes `report_fatal_error` to `SourceMgr().PrintMessage`.
```
% clang -c -fcommon c.c
<unknown>:0: error: Common symbol 'bar' cannot be used in assignment expr
```
Ideally we should at least recover the original filename (the line information
is generally lost). That requires general improvement to MC diagnostics,
because currently in many cases SMLoc information is lost.
Pushpinder Singh [Thu, 29 Oct 2020 06:34:06 +0000 (02:34 -0400)]
[FastRA] Fix handling of bundled MIs
Fast register allocator skips bundled MIs, as the main assignment
loop uses MachineBasicBlock::iterator (= MachineInstrBundleIterator)
This was causing SIInsertWaitcnts to crash which expects all
instructions to have registers assigned.
This patch makes sure to set everything inside bundle to the same
assignments done on BUNDLE header.
Reviewed By: qcolombet
Differential Revision: https://reviews.llvm.org/D90369
Monk Chiang [Mon, 21 Dec 2020 05:51:57 +0000 (21:51 -0800)]
[RISCV] Define the remaining vector fixed-point arithmetic intrinsics.
This patch base on D93366, and define vector fixed-point intrinsics.
1. vaaddu/vaadd/vasubu/vasub
2. vsmul
3. vssrl/vssra
4. vnclipu/vnclip
We work with @rogfer01 from BSC to come out this patch.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: ShihPo Hung <shihpo.hung@sifive.com>
Differential Revision: https://reviews.llvm.org/D93508
Jian Cai [Sun, 20 Dec 2020 22:55:20 +0000 (14:55 -0800)]
[AsmParser] make .ascii support spaces as separators
Currently the integrated assembler only allows commas as the separator
between string arguments in .ascii. This patch adds support to using
space as separators and make IAS consistent with GNU assembler.
Link: https://github.com/ClangBuiltLinux/linux/issues/1196
Reviewed By: nickdesaulniers, jrtc27
Differential Revision: https://reviews.llvm.org/D91460
Esme-Yi [Mon, 21 Dec 2020 06:16:50 +0000 (06:16 +0000)]
[PowerPC][NFC] Added assertion of shift exponent is too large for 'uint64_t'.
Fangrui Song [Mon, 21 Dec 2020 05:26:36 +0000 (21:26 -0800)]
[MC][ELF] Remove unneeded MCSymbol::setExternal calls
ELF code uses symbol bindings and does not call isExternal().
Esme-Yi [Mon, 21 Dec 2020 05:21:07 +0000 (05:21 +0000)]
[PowerPC] Materialize i64 constants by enumerated patterns.
Summary: Some constants can be handled with less instructions than our current results. And it seems our original approach is not very easy to extend. Therefore this patch proposes to materialize all 64-bit constants by enumerated patterns.
I traversed almost all constants to verified the functionality of these pattens. A traversed comparison of the number of instructions used by the original method and the new method has also been completed, where no degradation was caused by this patch. This patch also passed Bootstrap test and SPEC test.
Improvements of this patch are shown in llvm/test/CodeGen/PowerPC/constants-i64.ll
Reviewed By: steven.zhang, stefanp
Differential Revision: https://reviews.llvm.org/D92089
Fangrui Song [Mon, 21 Dec 2020 05:18:22 +0000 (21:18 -0800)]
[MC][ELF] Drop MCSymbol::isExternal call sites
ELF uses symbol bindings and MCSymbol::isExternal is not really useful.
The function is no longer used in ELF code now.
Fangrui Song [Mon, 21 Dec 2020 05:04:12 +0000 (21:04 -0800)]
[MC] Report locations for .symver errors
Fangrui Song [Mon, 21 Dec 2020 04:06:02 +0000 (20:06 -0800)]
[llvm-reduce][test] Make remove-alias.ll CHECK patterns more specific after D90302
`CHECK-FINAL-NOT: global` can match the input filename (e.g. clang-cmake-aarch64-global-isel)
and fail spuriously.
Fangrui Song [Mon, 21 Dec 2020 04:01:20 +0000 (20:01 -0800)]
[lld-macho] Fix memcpy ub after D93267
Fangrui Song [Mon, 21 Dec 2020 02:37:14 +0000 (18:37 -0800)]
[MC][ELF] Allow STT_SECTION referencing SHF_MERGE on REL targets
This relands D64327 with a more specific workaround for R_386_GOTOFF
(gold<2.34 bug https://sourceware.org/bugzilla/show_bug.cgi?id=16794)
.debug_info has quite a few .debug_str relocations (R_386_32/R_ARM_ABS32).
The original workaround was too general and introduced too many .L symbols
used just as relocation targets.
From the original review:
... it reduced the size of a big ARM-32 debug image by 33%. It contained ~68M
of relocations symbols out of total ~71M symbols (96% of symbols table was
generated for relocations with symbol).
Ben Shi [Mon, 21 Dec 2020 02:20:36 +0000 (10:20 +0800)]
[RISCV][NFC] Add tests for multiplication with constant
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D93589
Kazu Hirata [Mon, 21 Dec 2020 01:43:22 +0000 (17:43 -0800)]
[Target] Use llvm::erase_if (NFC)
Arthur Eubanks [Mon, 21 Dec 2020 01:13:15 +0000 (17:13 -0800)]
[test] Fix new-pass-manager-opt-bisect.c
Requires x86 target to be registered.
Chen Zheng [Thu, 5 Nov 2020 14:32:25 +0000 (09:32 -0500)]
[PowerPC] add has side effect for SAT bit clobber intrinsics/instructions
This patch does two things:
1: fix the typo that intrinsic mfvscr should be with no readmem property
2: since VSCR is not modeled yet, add has side effect for SAT bit clobber
intrinsics/instructions.
Reviewed By: steven.zhang
Differential Revision: https://reviews.llvm.org/D90807
Chen Zheng [Thu, 3 Dec 2020 09:53:23 +0000 (04:53 -0500)]
[MachineLICM] delete dead flag if the duplicated def outside of loop is dead.
Fixup dead flags for CSE-ed instructions.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D92557
Arthur Eubanks [Sun, 20 Dec 2020 23:39:59 +0000 (15:39 -0800)]
[test] Fix reg-usage.ll under NPM
The -O2 isn't used in the test.
Shilei Tian [Sun, 20 Dec 2020 23:39:19 +0000 (18:39 -0500)]
[OpenMP] Fixed the issue that CMake variables for OpenMP were not passed through when building OpenMP with LLVM_ENABLE_RUNTIMES
Currently when building OpenMP along with LLVM, CMake variables for OpenMP (prefix with `LIBOMP` and `LIBOMPTARGET`) will not be passed through because by default it uses the prefix of the runtime name, aka `OPENMP` in this case. This patch fixed this issue.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D93603
Fangrui Song [Sun, 20 Dec 2020 22:17:00 +0000 (14:17 -0800)]
[MC] Reject byte alignment if larger than or equal to 2**32
This is consistent with the resolution to power-of-2 alignments.
Otherwise, emitCodeAlignment and emitValueToAlignment cannot handle alignments
larger than 2**32 and will trigger assertion failure (PR35218).
Note: GNU as as of 2.35 will use 1 for such a large byte `.align`
Samuel Eubanks [Sun, 20 Dec 2020 21:47:46 +0000 (13:47 -0800)]
Make NPM OptBisectInstrumentation use global singleton OptBisect
Currently there is an issue where the legacy pass manager uses a different OptBisect counter than the new pass manager.
This fix makes the npm OptBisectInstrumentation use the global OptBisect.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D92897
David Green [Sun, 20 Dec 2020 21:20:39 +0000 (21:20 +0000)]
[ARM] Extra vecreduce tests with smaller than legal types. NFC
Nikita Popov [Sun, 20 Dec 2020 20:56:23 +0000 (21:56 +0100)]
[BasicAA] Add test for byval argument (NFC)