Commit Graph

381363 Commits

Author SHA1 Message Date
Tony Tye 2da13f1246 [NFC][AMDGPU] Document the AMDGPU target feature defaults
Document the default for the XNACK and SRAMECC target features for code object V2-V3 and V4.

Reviewed By: kzhuravl

Differential Revision: https://reviews.llvm.org/D97598
2021-02-27 18:28:15 +00:00
Jacques Pienaar dd2f50a4d0 [mlir] Improve test coverage for print-op-graph 2021-02-27 10:18:38 -08:00
Kazu Hirata 6a337f85c8 [IR] Use range-based for loops (NFC) 2021-02-27 10:09:25 -08:00
Kazu Hirata e8fa9014cc [llvm] Fix typos in documentation (NFC) 2021-02-27 10:09:23 -08:00
Kazu Hirata c81dde9292 [llvm-readobj] Use ListSeparator (NFC) 2021-02-27 10:09:22 -08:00
Jez Ng 82b3da6f6f [lld-macho] Extract embedded addends for arm64 UNSIGNED relocations
On arm64, UNSIGNED relocs are the only ones that use embedded addends
instead of the ADDEND relocation.

Also ensure that the addend works when UNSIGNED is part of a SUBTRACTOR
pair.

Reviewed By: #lld-macho, alexshap

Differential Revision: https://reviews.llvm.org/D97105
2021-02-27 12:31:34 -05:00
Jez Ng 8da88d4b60 [lld-macho] Add test for a variety of arm64 relocations
Reviewed By: #lld-macho, smeenai

Differential Revision: https://reviews.llvm.org/D97104
2021-02-27 12:31:34 -05:00
Jez Ng 541390131e [lld-macho] Don't emit rebase opcodes for subtractor minuend relocs
Also add a few asserts to verify that we are indeed handling an
UNSIGNED relocation as the minued. I haven't made it an actual
user-facing error since I don't think llvm-mc is capable of generating
SUBTRACTOR relocations without an associated UNSIGNED.

Reviewed By: #lld-macho, smeenai

Differential Revision: https://reviews.llvm.org/D97103
2021-02-27 12:31:34 -05:00
Jez Ng cc5c03e109 [lld-macho] Properly test subtractor relocations & fix their attributes
`llvm-mc` doesn't generate any relocations for subtractions
between local symbols -- they must be global -- so the previous test
wasn't actually testing any relocation logic. I've fixed that and
extended the test to cover r_length=3 relocations as well as both x86_64
and arm64.

Reviewed By: #lld-macho, smeenai

Differential Revision: https://reviews.llvm.org/D97057
2021-02-27 12:31:34 -05:00
Mehdi Amini ee90bb3486 Store (cache) the Argument number (index in the argument list) inside the BlockArgumentImpl
This avoids linear search in BlockArgument::getArgNumber().

Differential Revision: https://reviews.llvm.org/D97596
2021-02-27 17:21:08 +00:00
Gabor Horvath dd6738d93d [clang][Lifetimes] Fix false positive warning from BUG 49342
Differential Revision: https://reviews.llvm.org/D97605
2021-02-27 08:09:57 -08:00
Sanjay Patel 356cdabd3a [SimplifyCFG] avoid illegal phi with both poison and undef
In the example based on:
https://llvm.org/PR49218
...we are crashing because poison is a subclass of undef, so we merge blocks and create:

PHI node has multiple entries for the same basic block with different incoming values!
  %k3 = phi i64 [ poison, %entry ], [ %k3, %g ], [ undef, %entry ]

If both poison and undef values are incoming, we soften the poison values to undef.

Differential Revision: https://reviews.llvm.org/D97495
2021-02-27 09:10:32 -05:00
Wang, Pengfei 42e025f9de [X86] Disable rematerializion for PTILELOADDV
Per the discussion in D97453. We currently disable it due to it's not a
common scenario and has some problem in implementation.

Differential Revision: https://reviews.llvm.org/D97453
2021-02-27 21:08:58 +08:00
Stephen Kelly 42ce00ec39 [clang-tidy] Simplify suspicious memset usage check
Differential Revision: https://reviews.llvm.org/D97150
2021-02-27 12:17:09 +00:00
Stephen Kelly 302cc8421e [clang-tidy] Simplify boolean expr check
Differential Revision: https://reviews.llvm.org/D97153
2021-02-27 12:13:24 +00:00
Stephen Kelly b672870886 [clang-tidy] Simplify special member functions check
Differential Revision: https://reviews.llvm.org/D97152
2021-02-27 12:13:24 +00:00
Stephen Kelly a5feefa3c7 [clang-tidy] Simplify redundant branch condition check
Differential Revision: https://reviews.llvm.org/D97151
2021-02-27 12:13:23 +00:00
Stephen Kelly df42f9950d [clang-tidy] Simplify suspicious enum usage check
Differential Revision: https://reviews.llvm.org/D97149
2021-02-27 12:11:45 +00:00
Stephen Kelly 35763baf9a [clang-tidy] Simplify redundant member init check
Differential Revision: https://reviews.llvm.org/D97147
2021-02-27 12:11:44 +00:00
Stephen Kelly 9ba557cc03 [clang-tidy] Simplify default member init check
Differential Revision: https://reviews.llvm.org/D97145
2021-02-27 12:11:43 +00:00
Stephen Kelly 296c6e85c1 [clang-tidy] Simplify shrink to fit check
Differential Revision: https://reviews.llvm.org/D97144
2021-02-27 12:11:42 +00:00
Stephen Kelly a5e3d87f66 [clang-tidy] Handle uninstantiated templates in redundant get check
Differential Revision: https://reviews.llvm.org/D96222
2021-02-27 12:08:41 +00:00
Ella Ma df6fb4d392 [llvm] Add assertions for the smart pointers with the possibility to be null in DWARFLinker::loadClangModule
Split from D91844.

The local variable `Unit` in function `DWARFLinker::loadClangModule`
in file `llvm/lib/DWARFLinker/DWARFLinker.cpp`. If the variable is not set
in the loop below its definition, it will trigger a null pointer dereference
after the loop.

Patch By: OikawaKirie

Reviewed By: avl

Differential Revision: https://reviews.llvm.org/D97185
2021-02-27 10:14:39 +03:00
Kazu Hirata 1d4a2f3778 [Transforms/Utils] Use range-based for loops (NFC) 2021-02-26 22:36:40 -08:00
Kazu Hirata f0e6d8dad5 [TableGen] Use ListSeparator (NFC) 2021-02-26 22:36:38 -08:00
Vitaly Buka c88c46080a [NFC] Remove tab from the source 2021-02-26 19:40:24 -08:00
Fangrui Song 2e2ee4300d [test] Add -triple x86_64 to attr-retain.cpp 2021-02-26 19:35:53 -08:00
Eric Schweitz ac473bb2b2 [flang][fir] Upstream utility function valueHasFirAttribute()
This function will be used in subsequent upstreaming merges.

Author: Jean Perier

Differential Revision: https://reviews.llvm.org/D97502
2021-02-26 18:31:32 -08:00
River Riddle e6260ad043 [mlir] Simplify various pieces of code now that Identifier has access to the Context/Dialect
This also exposed a bug in Dialect loading where it was not correctly identifying identifiers that had the dialect namespace as a prefix.

Differential Revision: https://reviews.llvm.org/D97431
2021-02-26 18:00:05 -08:00
Rob Suderman 16abacaea9 [MLIR][TOSA] Resubmit Tosa to Standard/SCF Lowerings (const, if, while)"
Includes a lowering for tosa.const, tosa.if, and tosa.while to Standard/SCF dialects. TosaToStandard is
used for constant lowerings and TosaToSCF handles the if/while ops.

Resubmission of https://reviews.llvm.org/D97518 with ASAN fixes.

Differential Revision: https://reviews.llvm.org/D97529
2021-02-26 17:44:12 -08:00
Jessica Clarke 9e0d55024d [clang][NFC] Clean up whitespace in ClangOpcodesEmitter output
This should now be about as style-conforming as TableGen'ed code ever
can reasonably be.
2021-02-27 01:28:56 +00:00
Fangrui Song a0c1cd642d [test] Add -triple x86_64 to attr-retain.c 2021-02-26 17:26:26 -08:00
Eric Schweitz 0b785a46b7 [flang][fir] Add remaining Ops. Updates to pre-existing Ops.
- add ops: rebox, insert_on_range, absent, is_present
  - embox, coordinate_of: replace old hand-written parser/pretty-printer with assembly format
  - remove dead floating point ops, since buitlins work for all types
  - update call op
  - update documentation
  - misc. NFC to formatting
  - add op round trip tests

Authors: Eric Schweitz, Jean Perier, Zachary Selk, Kiran Chandramohan, et.al.

Differential Revision: https://reviews.llvm.org/D97500
2021-02-26 17:21:35 -08:00
Heejin Ahn aa097ef8d4 [WebAssembly] Fix reverse mapping in WasmEHFuncInfo
D97247 added the reverse mapping from unwind destination to their
source, but it had a critical bug; sources can be multiple, because
multiple BBs can have a single BB as their unwind destination.

This changes `WasmEHFuncInfo::getUnwindSrc` to `getUnwindSrcs` and makes
it return a vector rather than a single BB. It does not return the const
reference to the existing vector but creates a new vector because
`WasmEHFuncInfo` stores not `BasicBlock*` or `MachineBasicBlock*` but
`PointerUnion` of them. Also I hoped to unify those methods for
`BasicBlock` and `MachineBasicBlock` into one using templates to reduce
duplication, but failed because various usages require `BasicBlock*` to
be `const` but it's hard to make it `const` for `MachineBasicBlock`
usages.

Fixes https://github.com/emscripten-core/emscripten/issues/13514.
(More precisely, fixes
https://github.com/emscripten-core/emscripten/issues/13514#issuecomment-784708744)

Reviewed By: dschuff, tlively

Differential Revision: https://reviews.llvm.org/D97583
2021-02-26 17:12:10 -08:00
Sam Clegg 14ffbb84aa [lld][WebAssembly] Rename methods/members to match ELF backend. NFC.
Specifically:

- InputChunk::outputOffset -> outSecOffset
- Symbol::get/setVirtualAddress -> get/setVA
- add InputChunk::getOffset helper that takes an offset

These are mostly in preparation for adding support for
SHF_MERGE/SHF_STRINGS but its also good to align with ELF where
possible.

Differential Revision: https://reviews.llvm.org/D97595
2021-02-26 17:05:59 -08:00
Kevin Zhou 1ab2753d4c [Polly] Refactoring IsInnermostParallel() in ISL to take the C++ wrapper object. NFC
Currently, the IslAst library is a C library that would be incompatible with the rest of the LLVM because LLVM is written in C++.
I took one function, IsInnermostParallel(), and refactored it so that it would take the C++ wrapper object instead of using reference counters with the C ISL library. As well, all the references that use IsInnermostParallel() will use manage_copy() since they are still expecting the C object.

Reviewed By: Meinersbur

Differential Revision: https://reviews.llvm.org/D97425
2021-02-26 18:41:44 -06:00
Fangrui Song 47c5576d7d ELF: Create unique SHF_GNU_RETAIN sections for llvm.used global objects
If a global object is listed in `@llvm.used`, place it in a unique section with
the `SHF_GNU_RETAIN` flag. The section is a GC root under `ld --gc-sections`
with LLD>=13 or GNU ld>=2.36.

For front ends which do not expect to see multiple sections of the same name,
consider emitting `@llvm.compiler.used` instead of `@llvm.used`.

SHF_GNU_RETAIN is restricted to ELFOSABI_GNU and ELFOSABI_FREEBSD in
binutils. We don't do the restriction - see the rationale in D95749.

The integrated assembler has supported SHF_GNU_RETAIN since D95730.
GNU as>=2.36 supports section flag 'R'.
We don't need to worry about GNU ld support because older GNU ld just ignores
the unknown SHF_GNU_RETAIN.

With this change, `__attribute__((retain))` functions/variables emitted
by clang will get the SHF_GNU_RETAIN flag.

Differential Revision: https://reviews.llvm.org/D97448
2021-02-26 16:38:44 -08:00
Fangrui Song 8afdacba9d Add GNU attribute 'retain'
For ELF targets, GCC 11 will set SHF_GNU_RETAIN on the section of a
`__attribute__((retain))` function/variable to prevent linker garbage
collection. (See AttrDocs.td for the linker support).

This patch adds `retain` functions/variables to the `llvm.used` list, which has
the desired linker GC semantics. Note: `retain` does not imply `used`,
so an unused function/variable can be dropped by Sema.

Before 'retain' was introduced, previous ELF solutions require inline asm or
linker tricks, e.g.  `asm volatile(".reloc 0, R_X86_64_NONE, target");`
(architecture dependent) or define a non-local symbol in the section and use
`ld -u`. There was no elegant source-level solution.

With D97448, `__attribute__((retain))` will set `SHF_GNU_RETAIN` on ELF targets.

Differential Revision: https://reviews.llvm.org/D97447
2021-02-26 16:37:50 -08:00
Kazu Hirata 233ba2709b [Driver] Fix a warning about the the initialization order 2021-02-26 16:32:30 -08:00
Jianzhou Zhao c0dc885d29 [msan] Use non-transparent-huge-page at SetShadow
This prevents from getting THP ranges more and more.

Did not see any issues in practice, just found this by code review.

Reviewed By: eugenis, vitalybuka

Differential Revision: https://reviews.llvm.org/D97593
2021-02-27 00:28:57 +00:00
Jessica Paquette f5d5a7d7ea [AArch64][GlobalISel] Import FMOV patterns rather than manually selecting it
There are existing patterns for FMOVHi, FMOVSi, and FMOVDi in
AArch64InstrFormats.td.

Importing these allows us to remove the manual selection code for FMOV.

It also allows us to select FMOVHi for non-zero constants when we have full
fp-16 support.

Refactor some of the code in AArch64InstrFormats.td so that we can create
equivalent custom renderers in GlobalISel.

Differential Revision: https://reviews.llvm.org/D97511
2021-02-26 16:27:39 -08:00
Fangrui Song 1d7f8c7517 [test] Fix PGOProfile/comdat_internal.ll 2021-02-26 16:27:23 -08:00
Jacques Pienaar 91ab48ea6b [mlir] Add regions to OpAdaptor
Allows querying regions too via OpAdaptor's generated. This does not yet move region verification to adaptor nor require regions for ops where needed.

Differential Revision: https://reviews.llvm.org/D97519
2021-02-26 16:25:00 -08:00
Ryan Prichard d202201410 Reland "[builtins] Define fmax and scalbn inline"
This reverts commit 680f836c2f.

Disable the non-default-rounding-mode scalbn[f] tests when we're using
the MSVC libraries.

Differential Revision: https://reviews.llvm.org/D91841
2021-02-26 16:20:14 -08:00
Vladimir Vereschaka 155c49e087 [Driver] Print process statistics report on CC_PRINT_PROC_STAT env variable.
Added supporting CC_PRINT_PROC_STAT and CC_PRINT_PROC_STAT_FILE
environment variables to trigger clang driver reporting the process
statistics into specified file (alternate for -fproc-stat-report
option).

Differential Revision: https://reviews.llvm.org/D97094
2021-02-26 16:16:00 -08:00
Fangrui Song bf176c49e8 [InstrProfiling] Use llvm.compiler.used instead of llvm.used for ELF
Many optimizers (e.g.  GlobalOpt/ConstantMerge) do not respect linker semantics
for comdat and may not discard the sections as a unit.

The interconnected `__llvm_prf_{cnts,data}` sections (in comdat for ELF)
are similar to D97432: `__profd_` is not directly referenced, so
`__profd_` may be discarded while `__profc_` is retained, breaking the
interconnection.  We currently conservatively add all such sections to
`llvm.used` and let the linker do GC for ELF.

In D97448, we will change GlobalObject's in the llvm.used list to use SHF_GNU_RETAIN,
causing the metadata sections to be unnecessarily retained (some `check-profile` tests check for GC).
Use `llvm.compiler.used` to retain the current GC behavior.

Differential Revision: https://reviews.llvm.org/D97585
2021-02-26 16:14:03 -08:00
Eric Schweitz 5077d42cfa [flang][fir][NFC] Removes deprecated messages in builds. 2021-02-26 16:12:49 -08:00
Matheus Izvekov 4a8530fc30 [clang] implicitly delete space ship operator with function pointers
See bug #48856

Definitions of classes with member function pointers and default
spaceship operator were getting accepted with no diagnostic on
release build, and triggering assert on builds with runtime checks
enabled. Diagnostics were only produced when actually comparing
instances of such classes.

This patch makes it so Spaceship and Less operators are not considered
as builtin operator candidates for function pointers, producing
equivalent diagnostics for the cases where pointers to member function
and pointers to data members are used instead.

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D95409
2021-02-26 16:03:01 -08:00
Rob Suderman f685c9ac86 [MLIR][TOSA] Lower tosa.identity and tosa.identitiyn to linalg
Both identity ops can be loweried by replacing their results with their
inputs. We keep this as a linalg lowering as other backends may choose to
create copies.

Differential Revision: https://reviews.llvm.org/D97517
2021-02-26 15:45:07 -08:00
Arthur Eubanks 016f0ee686 [docs] Add documentation on using the new pass manager
And clarify in the "writing a pass" docs that both the legacy and new
PMs are being used for the codegen/optimization pipelines.

Reviewed By: ychen, asbirlea

Differential Revision: https://reviews.llvm.org/D97515
2021-02-26 15:28:19 -08:00