Craig Topper [Fri, 26 Feb 2021 22:50:01 +0000 (14:50 -0800)]
[DAGCombiner] Optimize SMULO/UMULO if we can prove that overflow is impossible.
Using ComputeNumSignBits or computeKnownBits we might be able
to determine that overflow is impossible.
This especially helps after type legalization if the type was
promoted from a type with half the bits or more. Type legalization
conservatively creates a promoted smulo/umulo and an overflow
check for the promoted bits. The overflow from the promoted
smulo/umulo is ORed with the result of the promoted bits
overflow check. Proving that the promoted smulo/umulo can never
overflow will leave us with just the promoted bits overflow check.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D97160
Peter Steinfeld [Mon, 22 Feb 2021 16:59:15 +0000 (08:59 -0800)]
[flang] Detect circularly defined interfaces of procedures
It's possible to define a procedure whose interface depends on a procedure
which has an interface that depends on the original procedure. Such a circular
definition was causing the compiler to fall into an infinite loop when
resolving the name of the second procedure. It's also possible to create
circular dependency chains of more than two procedures.
I fixed this by adding the function HasCycle() to the class DeclarationVisitor
and calling it from DeclareProcEntity() to detect procedures with such
circularly defined interfaces. I marked the associated symbols of such
procedures by calling SetError() on them. When processing subsequent
procedures, I called HasError() before attempting to analyze their interfaces.
Unfortunately, this did not work.
With help from Tim, we determined that the SymbolSet used to track the
erroneous symbols was instantiated using a "<" operator which was
defined using the name of the procedure. But the procedure name was
being changed by a call to ReplaceName() between the times that the
calls to SetError() and HasError() were made. This caused HasError() to
incorrectly report that a symbol was not in the set of erroneous
symbols. I fixed this by making SymbolSet be an ordered set, which does
not use the "<" operator.
I also added tests that will crash the compiler without this change.
And I fixed the formatting on an error message from a previous update.
Differential Revision: https://reviews.llvm.org/D97201
George Balatsouras [Wed, 24 Feb 2021 19:42:30 +0000 (11:42 -0800)]
[dfsan] Record dfsan metadata in globals
This will allow identifying exactly how many shadow bytes were used
during compilation, for when fast8 mode is introduced.
Also, it will provide a consistent matching point for instrumentation
tests so that the exact llvm type used (i8 or i16) for the shadow can
be replaced by a pattern substitution. This is handy for tests with
multiple prefixes.
Reviewed by: stephan.yichao.zhao, morehouse
Differential Revision: https://reviews.llvm.org/D97409
Vitaly Buka [Fri, 26 Feb 2021 22:32:01 +0000 (14:32 -0800)]
[sanitizers][NFC] Change typesto avoid warnings
Warning was enabled by D94640
Vitaly Buka [Fri, 26 Feb 2021 22:29:06 +0000 (14:29 -0800)]
[NFC][libc++] Suppress "warning: ignoring return value"
According to the comment on the next line
it's expected behaviour.
Vitaly Buka [Fri, 26 Feb 2021 22:27:24 +0000 (14:27 -0800)]
[NFC] Suppress "warning: ignoring return value"
Aart Bik [Fri, 26 Feb 2021 02:04:39 +0000 (18:04 -0800)]
[mlir][vector] add higher dimensional support to gather/scatter
Similar to mask-load/store and compress/expand, the gather and
scatter operation now allow for higher dimension uses. Note that
to support the mixed-type index, the new syntax is:
vector.gather %base [%i,%j] [%kvector] ....
The first client of this generalization is the sparse compiler,
which needs to define scatter and gathers on dense operands
of higher dimensions too.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D97422
Dan Gohman [Fri, 26 Feb 2021 22:17:51 +0000 (14:17 -0800)]
[WebAssembly] Avoid `bit_cast` when printing f32 and f64 immediates
Use `APInt` to convert a 32-bit or 64-bit immediate to an `APFloat` rather than
`bit_cast` to a `float` or `double` to avoid going through host floating-point and
potentially changing the bit pattern of NaNs.
Differential Revision: https://reviews.llvm.org/D97490
Nico Weber [Fri, 26 Feb 2021 00:56:31 +0000 (19:56 -0500)]
[lld/mac] Add some support for dynamic lookup symbols, and implement -U
Dynamic lookup symbols are symbols that work like dynamic symbols
in ELF: They're not bound to a dylib like normal Mach-O twolevel lookup
symbols, but they live in a global pool and dyld resolves them against
exported symbols from all loaded dylibs.
This adds support for dynamical lookup symbols to lld/mac. They are
represented as DylibSymbols with file set to nullptr.
This also uses this support to implement the -U flag, which makes
a specific symbol that's undefined at the end of the link a
dynamic lookup symbol.
For -U, it'd be sufficient to just to a pass over remaining undefined symbols
at the end of the link and to replace them with dynamic lookup symbols then.
But I'd like to use this code to implement flat_namespace too, and that will
require real support for resolving dynamic lookup symbols in SymbolTable. So
this patch adds this now already.
While writing tests for this, I noticed that we didn't set N_WEAK_DEF in the
symbol table for DylibSymbols, so this fixes that too.
Differential Revision: https://reviews.llvm.org/D97521
Casey Carter [Fri, 26 Feb 2021 21:39:22 +0000 (13:39 -0800)]
[libcxx][test] Don't require Container<cv T> extension on non-libc++
... when testing `default_initializable`. Also, include `<memory>` for `unique_ptr`.
Heejin Ahn [Thu, 25 Feb 2021 20:50:04 +0000 (12:50 -0800)]
[WebAssembly] Fix remapping branch dests in fixCatchUnwindMismatches
This is a case D97178 tried to solve but missed. D97178 could not handle
the case when
multiple consecutive delegates are generated:
- Before:
```
block
br (a)
try
catch
end_try
end_block
<- (a)
```
- After
```
block
br (a)
try
...
try
try
catch
end_try
<- (a)
delegate
delegate
end_block
<- (b)
```
(The `br` should point to (b) now)
D97178 assumed `end_block` exists two BBs later than `end_try`, because
it assumed the order as `end_try` BB -> `delegate` BB -> `end_block` BB.
But it turned out there can be multiple `delegate`s in between. This
patch changes the logic so we just search from `end_try` BB until we
find `end_block`.
Fixes https://github.com/emscripten-core/emscripten/issues/13515.
(More precisely, fixes
https://github.com/emscripten-core/emscripten/issues/13515#issuecomment-
784711318.)
Reviewed By: dschuff, tlively
Differential Revision: https://reviews.llvm.org/D97569
Philip Reames [Fri, 26 Feb 2021 21:11:13 +0000 (13:11 -0800)]
[tests] Precommit for upcoming patch
Rob Suderman [Wed, 24 Feb 2021 22:12:03 +0000 (14:12 -0800)]
[MLIR][TOSA] Lower tosa.reshape to linalg.reshape
Lowering from the tosa.reshape op to linalg.reshape. For same-rank or
non-collapsed/expanded cases two linalg.reshapes are inserted.
Differential Revision: https://reviews.llvm.org/D97439
Stanislav Mekhanoshin [Thu, 25 Feb 2021 23:03:34 +0000 (15:03 -0800)]
[AMDGPU] Avoid second rescheduling for some regions
If a region was not constrained by a high register pressure
and was not rescheduled without clustering we can skip
rescheduling it ClusteredLowOccupancyReschedule stage.
This improves scheduling speed by 25% on some kernels.
Differential Revision: https://reviews.llvm.org/D97506
Stanislav Mekhanoshin [Tue, 23 Feb 2021 23:26:12 +0000 (15:26 -0800)]
[AMDGPU] Skip unclusterd rescheduling w/o ld/st
We are attempting rescheduling without load store clustering
if occupancy limits were not met with clustering. Skip this
for regions which do not have any loads or stores at all.
In a set of kernels I am experimenting with this improves
scheduling time by ~30%.
Differential Revision: https://reviews.llvm.org/D97342
Anirudh Prasad [Fri, 26 Feb 2021 19:19:40 +0000 (14:19 -0500)]
[SystemZ] Introducing assembler dialects for the Z backend
- This patch introduces a different assembler dialect ("hlasm") for z/OS.
The default dialect has now been given the "att" dialect name. For this
appropriate changes have been added to SystemZ.td.
- This patch also makes a few changes to SystemZInstrFormats.td which
restrict a few condition code mnemonics to just the "att" dialect
variant (he, le, lh, nhe, nle, nlh). These extended condition code
mnemonics are not available in HLASM.
- A new private function has been introduced in SystemZAsmParser.cpp to
return the assembler dialect set in SystemZMCAsmInfo.cpp. The reason we
couldn't/haven't explicitly queried the overriden getAssemblerDialect
function from AsmParser is outlined in this thread here. This returned
dialect is directly passed onto the relevant matcher functions which taken
in a variantID, so that the matcher functions can appropriately choose an
instruction based on the variant.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D94250
James Y Knight [Mon, 22 Feb 2021 20:36:20 +0000 (15:36 -0500)]
Use getAlign() on atomicrmw/cmpxchg instructions, now that it's available.
These locations were missed as part of adding alignment to the
instructions, and were still making their own alignment assumptions.
Philip Reames [Fri, 26 Feb 2021 19:50:40 +0000 (11:50 -0800)]
[cgp] Minor code improvement - reuse an existing named helper [NFC]
Jianzhou Zhao [Fri, 26 Feb 2021 19:44:18 +0000 (19:44 +0000)]
[dfsan] Do not test origin-tracking in atomic.cpp
This would cause linking errors after https://reviews.llvm.org/D97483
that introduced new prefixes for ABI wrappers with origin tracking mode.
We will renable this after the full origin tracking is checked in.
Craig Topper [Fri, 26 Feb 2021 18:53:55 +0000 (10:53 -0800)]
[RISCV] Call SelectBaseAddr on the base pointer in the custom isel for vector loads and stores.
This will allow FrameIndex as the base address instead of
emitting a separate ADDI from isel. eliminateFrameIndex will likely turn
it back into an ADDI, but this makes things consistent with the
SDPatterns and VLPatterns.
I only tested one case for simplicity. I can test more if reviewers
want.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D97221
Philip Reames [Fri, 26 Feb 2021 19:17:47 +0000 (11:17 -0800)]
Be more mathematicly precise about definition of recurrence [NFC]
This clarifies the interface of the matchSimpleRecurrence helper introduced in
8020be0b8 for non-commutative operators. After
ebd3aeba, I realized the original way I framed the routine was inconsistent. For shifts, we only matched the the LHS form, but for sub we matched both and the caller wanted that information. So, instead, we now consistently match both forms for non-commutative operators and the caller becomes responsible for filtering if needed. I tried to put a clear warning in the header because I suspect the RHS form of e.g. a sub recurrence is non-obvious for most folks. (It was for me.)
Leonard Chan [Fri, 26 Feb 2021 19:13:42 +0000 (11:13 -0800)]
[scudo][test] Disable -Wfree-nonheap-object
As of
4f395db86b5cc11bb56853323d3cb1d4b6db5a0b which contains updates to
-Wfree-nonheap-object, a line in this test will trigger the warning. This
particular line is ok though since it's meant to test a free on a bad pointer.
Differential Revision: https://reviews.llvm.org/D97516
Jianzhou Zhao [Thu, 25 Feb 2021 05:35:07 +0000 (05:35 +0000)]
[dfsan] Propagate origins for callsites
This is a part of https://reviews.llvm.org/D95835.
Each customized function has two wrappers. The
first one dfsw is for the normal shadow propagation. The second one dfso is used
when origin tracking is on. It calls the first one, and does additional
origin propagation. Which one to use can be decided at instrumentation
time. This is to ensure minimal additional overhead when origin tracking
is off.
Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D97483
Nathan James [Fri, 26 Feb 2021 19:10:25 +0000 (19:10 +0000)]
[clang-tidy][NFC] Tweak some generation of diag messages
Fix up cases where diag is called by piecing together a string in favour of placeholders.
Fix up cases where select could be used instead of duplicating the message for sake of 1 word difference.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D97488
Fangrui Song [Fri, 26 Feb 2021 19:10:02 +0000 (11:10 -0800)]
[SanitizerCoverage] Clarify llvm.used/llvm.compiler.used and partially fix unmatched metadata sections on Windows
`__sancov_pcs` parallels the other metadata section(s). While some optimizers
(e.g. GlobalDCE) respect linker semantics for comdat and retain or discard the
sections as a unit, some (e.g. GlobalOpt/ConstantMerge) do not. So we have to
conservatively retain all unconditionally in the compiler.
When a comdat is used, the COFF/ELF linkers' GC semantics ensure the
associated parallel array elements are retained or discarded together,
so `llvm.compiler.used` is sufficient.
Otherwise (MachO (see rL311955/rL311959), COFF special case where comdat is not
used), we have to use `llvm.used` to conservatively make all sections retain by
the linker. This will fix the Windows problem once internal linkage
GlobalObject's in `llvm.used` are retained via `/INCLUDE:`.
Reviewed By: morehouse, vitalybuka
Differential Revision: https://reviews.llvm.org/D97432
Nathan James [Fri, 26 Feb 2021 19:09:27 +0000 (19:09 +0000)]
[clang-tidy] Remove some test c++ mode restrictions.
Some comments are redundant, others just simple fixes.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D97544
Philip Reames [Fri, 26 Feb 2021 18:46:28 +0000 (10:46 -0800)]
Use helper introduced in
8020be0b8 to simplify ValueTracking [NFC]
Direct rewrite of the code the helper was extracted from.
Christopher Di Bella [Fri, 19 Feb 2021 01:54:52 +0000 (01:54 +0000)]
[libcxx] cleans up __cpp_concepts mess
libc++ was previously a bit confused by what the value of __cpp_concepts
should be. Also replaces `__floating_point` with `floating_point` now
that it exists.
Differential Revision: https://reviews.llvm.org/D97015
Fangrui Song [Fri, 26 Feb 2021 18:42:07 +0000 (10:42 -0800)]
Change some addUsedGlobal to addUsedOrCompilerUsedGlobal
An global value in the `llvm.used` list does not have GC root semantics on ELF targets.
This will be changed in a subsequent backend patch.
Change some `llvm.used` in the ELF code path to use `llvm.compiler.used` to
prevent undesired GC root semantics.
Change one extern "C" alias (due to `__attribute__((used))` in extern "C") to use `llvm.compiler.used` on all targets.
GNU ld has a rule "`__start_/__stop_` references from a live input section retain the associated C identifier name sections",
which LLD may drop entirely (currently refined to exclude SHF_LINK_ORDER/SHF_GROUP) in a future release (the rule makes it clumsy to GC metadata sections; D96914 added a way to try the potential future behavior).
For `llvm.used` global values defined in a C identifier name section, keep using `llvm.used` so that
the future LLD change will not affect them.
rnk kindly categorized the changes:
```
ObjC/blocks: this wants GC root semantics, since ObjC mainly runs on Mac.
MS C++ ABI stuff: wants GC root semantics, no change
OpenMP: unsure, but GC root semantics probably don't hurt
CodeGenModule: affected in this patch to *not* use GC root semantics so that __attribute__((used)) behavior remains the same on ELF, plus two other minor use cases that don't want GC semantics
Coverage: Probably want GC root semantics
CGExpr.cpp: refers to LTO, wants GC root
CGDeclCXX.cpp: one is MS ABI specific, so yes GC root, one is some other C++ init functionality, which should form GC roots (C++ initializers can have side effects and must run)
CGDecl.cpp: Changed in this patch for __attribute__((used))
```
Differential Revision: https://reviews.llvm.org/D97446
Philip Reames [Fri, 26 Feb 2021 18:18:56 +0000 (10:18 -0800)]
Add a helper for matching simple recurrence cycles
This helper came up in another review, and I've got about 4 different patches with copies of this copied into it. Time to precommit the routine. :)
Louis Dionne [Fri, 26 Feb 2021 18:11:00 +0000 (13:11 -0500)]
[libc++] Make the from-scratch config work on macOS out-of-the-box
Alexey Bataev [Fri, 26 Feb 2021 17:52:03 +0000 (09:52 -0800)]
[InstCombine][NFC]Add a test for logical reductions.
Mircea Trofin [Fri, 26 Feb 2021 17:54:20 +0000 (09:54 -0800)]
[NFC][regalloc] const-ed APIs, using MCRegister instead of unsigned
Mircea Trofin [Fri, 26 Feb 2021 17:32:09 +0000 (09:32 -0800)]
[NFC] Const-ed 2 APIs in VirtRegMap
Louis Dionne [Fri, 26 Feb 2021 17:13:51 +0000 (12:13 -0500)]
[libc++] Allow running CI on macOS when Ninja isn't installed outside of Xcode
Xcode does bundle Ninja, so we can use that Ninja if there's no system-wide
Ninja installed. This is useful on some CI bots we have that don't come
with Ninja pre-installed.
Mircea Trofin [Fri, 26 Feb 2021 16:52:34 +0000 (08:52 -0800)]
[NFC] MCRegister fixes in RegisterClassInfo, and const-ed APIs
Jay Foad [Fri, 26 Feb 2021 16:31:11 +0000 (16:31 +0000)]
[AMDGPU] Add selection pattern for v_xnor_b32
This allows GlobalISel to use this instruction where available. I assume
SelectionDAG always selects s_xnor_b32 so it isn't affected by this
change.
Differential Revision: https://reviews.llvm.org/D97560
Geoffrey Martin-Noble [Fri, 26 Feb 2021 01:20:25 +0000 (17:20 -0800)]
[MLIR][linalg] Make integer matmul ops cast before multiplying
Right now they multiply before casting which means they would frequently
overflow. There are various reasonable ways to do this, but until we
have robust op description infra, this is a simple and safe default. More
careful treatments are likely to be hardware specific, as well (e.g.
using an i8*i8->i16 mul instruction).
Reviewed By: nicolasvasilache, mravishankar
Differential Revision: https://reviews.llvm.org/D97505
Nico Weber [Fri, 26 Feb 2021 16:14:26 +0000 (11:14 -0500)]
[PDB] Fix unsigned integer overflow
When building with -fsanitize=unsigned-integer-overflow, this code
causes a diagnostic like:
../../llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp:159:15:
runtime error: unsigned integer overflow:
90 - 229 cannot be represented in type 'unsigned long'
unsigned integer overflow is well defined and it isn't an issue in
practice, but in obscure scenarios (S1.size() small, S2.size over 2GB
on 32-bit systems) it could even be a bug.
So use the usual idiom for implementing cmp functions instead of the
gernally considered buggy idiom :)
See e.g. https://www.gnu.org/software/libc/manual/html_node/Comparison-Functions.html
or https://stackoverflow.com/questions/
10996418/efficient-integer-compare-function/
10997428#
10997428
Differential Revision: https://reviews.llvm.org/D97557
Simon Pilgrim [Fri, 26 Feb 2021 16:12:59 +0000 (16:12 +0000)]
[X86][AVX] SimplifyDemandedBitsForTargetNode - add basic X86ISD::VBROADCAST handling.
Simplify through to the scalar/vector source operand.
Dave Lee [Fri, 26 Feb 2021 16:04:53 +0000 (08:04 -0800)]
[llvm][utils] Fix innocuous off by one in lldb formatters
num_children is "last_index" + 1, thus
num_children + 1 = "last_index" + 2
this worked anyway because the index of `$$dereference$$` would work as long as
it was past the last index.
James Y Knight [Fri, 26 Feb 2021 15:33:24 +0000 (10:33 -0500)]
Fix assert to use getTypeStoreSize instead of getPrimitiveSizeInBits,
per comment on D97223.
Jay Foad [Fri, 26 Feb 2021 13:40:03 +0000 (13:40 +0000)]
[AMDGPU] Better codegen for i64 bitreverse
Differential Revision: https://reviews.llvm.org/D97547
Dave Lee [Fri, 26 Feb 2021 15:45:04 +0000 (07:45 -0800)]
[llvm][utils] Rename lldb dict variables to internal_dict
Most lldb scripts use `internal_dict`. Also, `dict` is a builtin constructor,
it's good habit to avoid using it as a variable name.
Dave Lee [Mon, 22 Feb 2021 05:45:04 +0000 (21:45 -0800)]
[llvm][utils] Support dereferencing llvm::Optional lldb formatter
Add deref support to `llvm::Optional` in `lldbDataFormatters.py`.
This creates a synthetic provider that adds dereference support, but otherwise proxies all access to the underlying value.
With this change, an optional value can be displayed by running `v *someOptional`, and its contents can be accessed with the arrow `operator->`, for example `v someOpt->HasThing`. This matches expressions usable from expression evaluation.
See also D97165 and D97524.
Differential Revision: https://reviews.llvm.org/D97525
Dave Lee [Thu, 25 Feb 2021 21:27:22 +0000 (13:27 -0800)]
[lldb] Add deref support to libc++ unique_ptr synthetic
Add frame variable dereference suppport to libc++ `std::unique_ptr`.
This change allows for commands like `v *thing_up` and `v thing_up->m_id`. These commands now work the same way they would with raw pointers, and as they would with expression. This is done by adding an unaccounted for child member named `$$dereference$$`.
Without this change, the command would have to be written as `v *thing_up.__value_` or v thing_up.__value_->m_id` which exposes internal structure and is more clumsy to type.
Additionally, the existing tests were updated. See also https://reviews.llvm.org/D97165 which added deref support for `std::shared_ptr`.
Differential Revision: https://reviews.llvm.org/D97524
Vladislav Vinogradov [Thu, 28 Jan 2021 12:51:58 +0000 (15:51 +0300)]
[ADT][NFC] Add extra typedefs to `ArrayRef` and `MutableArrayRef`
* `value_type`
* `pointer`
* `const_pointer`
* `reference`
* `const_reference`
* `const_reverse_iterator`
* `size_type`
* `difference_type`
It makes `ArrayRef` and `MutableArrayRef` types fully compliant with STL Container concept.
Reviewed By: lattner, courbet
Differential Revision: https://reviews.llvm.org/D95611
Louis Dionne [Fri, 26 Feb 2021 15:26:33 +0000 (10:26 -0500)]
[libc++] Remove the now unused macos-trunk and macos-backdeployment CI scripts
We use the run-buildbot script everywhere now.
Hanhan Wang [Fri, 26 Feb 2021 15:17:02 +0000 (07:17 -0800)]
[mlir][linalg] Add pooling ops to Linalg TC ops.
- Add EDSC builders for std_cmpf_ogt and std_cmpf_olt.
- Add pooling_nhwc_min/max/sum ops
Depends On D97384
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D97385
Simon Pilgrim [Fri, 26 Feb 2021 14:55:02 +0000 (14:55 +0000)]
[Utils] collectBitParts - bail for integers > 128-bits
collectBitParts uses int8_t for the bit indices, leaving a 128-bit limit.
We already test for this before calling collectBitParts, but rGb94c215592bd added truncate handling which meant we could end up processing wider integers.
Thanks to @manojgupta for the repro.
Hanhan Wang [Fri, 26 Feb 2021 14:45:08 +0000 (06:45 -0800)]
[mlir][linalg] Allow TC ops taking an unused shaped operand.
If one operand is not used in the formula, it will be considered a
shaped operand. And the result of indexing map of the operand will be the first
reduction dims.
Depends On D97383
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D97384
Benjamin Kramer [Fri, 26 Feb 2021 14:14:16 +0000 (15:14 +0100)]
[mlir] Silence some deprecation warnings after
dffc487b07d9a50f8c65eccb9241f72af3486c79
Nico Weber [Fri, 26 Feb 2021 14:00:32 +0000 (09:00 -0500)]
[libcxxabi] Fewer assumptions about path from libcxx to libcxxabi
This is useful for projects that pull in libcxx and libcxxabi and build
them using out-of-tree build files, but don't make them sibling
directories (or don't call the sibling directories libcxx and libcxxabi
for some reason).
Fixes PR49313.
Differential Revision: https://reviews.llvm.org/D97379
Kadir Cetinkaya [Mon, 22 Feb 2021 08:49:08 +0000 (09:49 +0100)]
[clangd][remote] Add flag to set idletimeout
By default gRPC has no idletimeout and some firewalls might drop idle
connections after a certain period. This results in idle clients
shouting into void until server resets the connection.
Differential Revision: https://reviews.llvm.org/D97536
Wang, Pengfei [Fri, 26 Feb 2021 13:20:03 +0000 (21:20 +0800)]
[X86] Allow PTILEZEROV and PTILELOADDV to be rematerializable
Spilling and reloading AMX registers are expensive. We allow PTILEZEROV
and PTILELOADDV to be rematerializable to avoid the register spilling.
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D97453
Marius Brehler [Fri, 26 Feb 2021 13:28:32 +0000 (13:28 +0000)]
[mlir] Replace deprecated 'getAttrs'
'getAttrs' has been explicitly marked deprecated. This patch refactors
to use Operation::getAttrs().
Reviewed By: csigg
Differential Revision: https://reviews.llvm.org/D97546
Stephen Tozer [Fri, 26 Feb 2021 13:04:33 +0000 (13:04 +0000)]
[InstCombine] Avoid redundant or out-of-order debug value sinking
This patch modifies TryToSinkInstruction in the InstCombine pass, to prevent
redundant debug intrinsics from being produced, and also prevent the intrinsics
from being emitted in an incorrect order. It does this by ensuring that when
this pass sinks an instruction and creates clones of the debug intrinsics that
use that instruction, it inserts those debug intrinsics in their original order,
and only inserts the last debug intrinsic for each variable in the Instruction's
block.
Differential revision: https://reviews.llvm.org/D95463
Evgeniy Brevnov [Fri, 26 Feb 2021 12:23:32 +0000 (19:23 +0700)]
Revert "[NARY-REASSOCIATE] Support reassociation of min/max"
This reverts commit
83d134c3c4222e8b8d3d90c099f749a3b3abc8e0.
Jan Svoboda [Thu, 25 Feb 2021 12:20:59 +0000 (13:20 +0100)]
[clang][cli] Implement '-cuid=' marshalling
This patch adds marshalling to the `-cuid=` option introduced in D95007.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D97461
Jan Svoboda [Fri, 26 Feb 2021 11:54:42 +0000 (12:54 +0100)]
[clang][cli] Fix build failure in CompilerInvocation
There is a report that https://reviews.llvm.org/D96280 causes a build failure with error: too few template arguments for class template 'SmallVector'. This patch attempts to fix that by explicitly specifying N for SmallVector<T, N>.
Stefan Gränitz [Fri, 26 Feb 2021 12:11:57 +0000 (13:11 +0100)]
[Orc] Use extensible RTTI for the orc::ObjectLayer class hierarchy
So far we had no way to distinguish between JITLink and RuntimeDyld in lli. Instead, we used implicit knowledge that RuntimeDyld would be used for linking ELF. In order to get D97337 to work with lli though, we have to move on and allow JITLink for ELF. This patch uses extensible RTTI to allow external clients to add their own layers without touching the LLVM sources.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D97338
Simon Pilgrim [Fri, 26 Feb 2021 12:10:10 +0000 (12:10 +0000)]
[X86] Remove unnecessary custom lowering of vXi1 SADDSAT/SSUBSAT/UADDSAT/USUBSAT
As discussed on D97478. The removal of the custom tag causes some changes in the add/sub-overflow expansion as it no longer expands to sat-arith codegen.
Serge Pavlov [Fri, 26 Feb 2021 10:44:29 +0000 (17:44 +0700)]
[Driver] Flush file in locked area
When writing report file by option -proc-stat-report some part of output
can be written to unlocked file because destructor of raw_fd_ostream
calls `flush()`. In high thread contention environment it can result in
file operation failure. With this change `flush` is called explicitly when
file is locked, so call of `flush()` in the destructor does not cause
write to file.
Stefan Gränitz [Fri, 26 Feb 2021 11:56:31 +0000 (12:56 +0100)]
[docs][JITLink] Few typo fixes in JITLink design/API doc
Simon Pilgrim [Fri, 26 Feb 2021 11:45:59 +0000 (11:45 +0000)]
[DAG] Fold vXi1 multiplies -> and
This allows us to remove X86 custom lowering of vXi1 MUL, which helps simplify a load of mask math.
Mentioned in D97478 post review.
Simon Pilgrim [Fri, 26 Feb 2021 11:10:54 +0000 (11:10 +0000)]
[X86] Remove unnecessary custom lowering of v16i1/v32i1 ADD/SUB
These were missed in D97478
Christian Sigg [Fri, 26 Feb 2021 09:08:40 +0000 (10:08 +0100)]
[mlir] Mark OpState::removeAttr() deprecated.
Fix call sites.
The method will be removed 2 weeks later.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D97530
Simon Pilgrim [Fri, 26 Feb 2021 10:59:54 +0000 (10:59 +0000)]
[DAG] expandAddSubSat - break if-else chain. NFCI.
Fix styleguide issue - each if() block always returns so we don't need to make them a if-else chain.
Max Kazantsev [Fri, 26 Feb 2021 10:19:50 +0000 (17:19 +0700)]
[Test] Two more interesting test cases & their codegen counterparts
Vinayaka Bandishti [Fri, 26 Feb 2021 09:56:12 +0000 (15:26 +0530)]
[MLIR][affine] Certain Call Ops to prevent fusion
Fixes a bug in affine fusion pipeline where an incorrect fusion is performed
despite a Call Op that potentially modifies memrefs under consideration
exists between source and target.
Fixes part of https://bugs.llvm.org/show_bug.cgi?id=49220
Reviewed By: bondhugula, dcaballe
Differential Revision: https://reviews.llvm.org/D97252
Fraser Cormack [Thu, 25 Feb 2021 14:23:59 +0000 (14:23 +0000)]
[RISCV] Use existing method for the LMUL1 type. NFCI.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D97467
Clement Courbet [Mon, 2 Nov 2020 14:01:21 +0000 (15:01 +0100)]
[llvm-exegesis][X86] Ignore a few unmeasurable opcodes.
Differential Revision: https://reviews.llvm.org/D90744
Yang Fan [Fri, 26 Feb 2021 09:27:44 +0000 (17:27 +0800)]
[Sema] Fix MSVC "attribute is not recognized" warning (NFC)
MSVC warning:
```
\llvm-project\clang\lib\Sema\SemaChecking.cpp(10323): warning C5030: attribute 'clang::fallthrough' is not recognized
```
Max Kazantsev [Fri, 26 Feb 2021 08:44:06 +0000 (15:44 +0700)]
[Test] Add one more test with corner cases for non-wrapping IVs
Yang Fan [Fri, 26 Feb 2021 09:14:13 +0000 (17:14 +0800)]
[Basic] Fix Wreturn-type gcc warning (NFC)
Yu-Hsun Chiang [Fri, 26 Feb 2021 08:12:32 +0000 (09:12 +0100)]
[clang][NFC] Extract Target and AuxTarget creation in CompilerInstance to new function
As @sammccall mentioned in [[ https://reviews.llvm.org/D97109 | D97109 ]], I've extract the logic of creating Target and AuxTarget into a new function called `createTargetAndAuxTarget`.
Since there are many similar code in clang or other related tools, consolidating them into a single function may help others to maintain the logic handling target related things.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D97493
Jakub Budiský [Fri, 26 Feb 2021 08:05:35 +0000 (09:05 +0100)]
[clang-format] [PR19056] Add support for access modifiers indentation
Adds support for coding styles that make a separate indentation level for access modifiers, such as Code::Blocks or QtCreator.
The new option, `IndentAccessModifiers`, if enabled, forces the content inside classes, structs and unions (“records”) to be indented twice while removing a level for access modifiers. The value of `AccessModifierOffset` is disregarded in this case, aiming towards an ease of use.
======
The PR (https://bugs.llvm.org/show_bug.cgi?id=19056) had an implementation attempt by @MyDeveloperDay already (https://reviews.llvm.org/D60225) but I've decided to start from scratch. They differ in functionality, chosen approaches, and even the option name. The code tries to re-use the existing functionality to achieve this behavior, limiting possibility of breaking something else.
Reviewed By: MyDeveloperDay, curdeius, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D94661
Christian Sigg [Thu, 25 Feb 2021 21:20:45 +0000 (22:20 +0100)]
[mlir] Remove some rarely used OpState members and use Operation members instead.
Skipping the deprecation dance here.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D97494
Petr Hosek [Fri, 26 Feb 2021 06:27:18 +0000 (22:27 -0800)]
[Driver] Don't pass -ffile-compilation-dir through to cc1
This is a driver only flag so it has to be expanded when invoking cc1.
Differential Revision: https://reviews.llvm.org/D97528
Craig Topper [Fri, 26 Feb 2021 05:16:47 +0000 (21:16 -0800)]
[RISCV] Add test cases for fixed vector extract element with non-constant index. NFC
Fangrui Song [Fri, 26 Feb 2021 06:29:49 +0000 (22:29 -0800)]
[MC] Allow .cfi_sections with empty section list
GNU as supports this. This mode silently ignores
.cfi_startproc/.cfi_endproc and .cfi_* in between.
Also drop a diagnostic `in '.cfi_sections' directive`: the diagnostic
already includes the line and it is clear the line is a `.cfi_sections` directive.
Petr Hosek [Thu, 25 Feb 2021 03:04:36 +0000 (19:04 -0800)]
[Driver] Rename -fprofile-{prefix-map,compilation-dir} to -fcoverage-{prefix-map,compilation-dir}
These flags affect coverage mapping (-fcoverage-mapping), not
-fprofile-[instr-]generate so it makes more sense to use the
-fcoverage-* prefix.
Differential Revision: https://reviews.llvm.org/D97434
Petr Hosek [Thu, 25 Feb 2021 01:48:27 +0000 (17:48 -0800)]
[Driver] Create -ffile-compilation-dir alias
We introduce -ffile-compilation-dir shorthand to avoid having to set
-fdebug-compilation-dir and -fprofile-compilation-dir separately. This
is similar to -ffile-prefix-map.
Differential Revision: https://reviews.llvm.org/D97433
Bill Wendling [Tue, 23 Feb 2021 20:39:39 +0000 (12:39 -0800)]
[X86] Use correct padding when in 16-bit mode
In 16-bit mode, some of the nop patterns used in 32-bit mode can end up
mangling other instructions. For instance, an aligned "movz" instruction
may have the 0x66 and 0x67 prefixes omitted, because the nop that's used
messes things up.
xorl %ebx, %ebx
.p2align 4, 0x90
movzbl (%esi,%ebx), %ecx
Use instead nop patterns we know 16-bit mode can handle.
Differential Revision: https://reviews.llvm.org/D97268
Fangrui Song [Fri, 26 Feb 2021 04:05:05 +0000 (20:05 -0800)]
[llvm-dwarfdump] StringMap -> MapVector to make iteration order stable
Exposed by D97396
Kazu Hirata [Fri, 26 Feb 2021 03:54:38 +0000 (19:54 -0800)]
[Scalar] Use range-based for loops (NFC)
Kazu Hirata [Fri, 26 Feb 2021 03:54:36 +0000 (19:54 -0800)]
[TableGen] Use ListSeparator (NFC)
Eric Schweitz [Wed, 24 Feb 2021 16:02:58 +0000 (08:02 -0800)]
[flang][fir] Add array value operations.
We lower expressions with rank > 0 to a set of high-level array operations.
These operations are then analyzed and refined to more primitve
operations in subsequent pass(es).
This patch upstreams these array operations and some other helper ops.
Authors: Eric Schweitz, Rajan Walia, Kiran Chandramohan, et.al.
https://github.com/flang-compiler/f18-llvm-project/pull/565
Differential Revision: https://reviews.llvm.org/D97421
Justin Lebar [Fri, 26 Feb 2021 02:14:40 +0000 (18:14 -0800)]
Fix signed-compare warning.
Introduced in my
c90dac27e94ec354a3e8919556ac5bc89b62c731.
Rob Suderman [Fri, 26 Feb 2021 02:04:34 +0000 (18:04 -0800)]
Revert [MLIR][TOSA] Added Tosa to Standard/SCF Lowerings (const, if, while)
This reverts commit
a813e9be5bc91203508bde239c1a15c5b8f8c0cc.
Results in an ASAN failure due to bypassing rewriter.
Differential Revision: https://reviews.llvm.org/D97518
Chen Zheng [Fri, 26 Feb 2021 01:39:45 +0000 (20:39 -0500)]
[debug-info] refactor emitDwarfUnitLength
remove `Hi` `Lo` argument from `emitDwarfUnitLength`, so we
can make caller of emitDwarfUnitLength easier.
Reviewed By: MaskRay, dblaikie, ikudrin
Differential Revision: https://reviews.llvm.org/D96409
Justin Lebar [Sun, 31 Jan 2021 03:00:24 +0000 (19:00 -0800)]
[clang] Print 32 candidates on the first failure, with -fshow-overloads=best.
Previously, -fshow-overloads=best always showed 4 candidates. The
problem is, when this isn't enough, you're kind of up a creek; the only
option available is to recompile with different flags. This can be
quite expensive!
With this change, we try to strike a compromise. The *first* error with
more than 4 candidates will show up to 32 candidates. All further
errors continue to show only 4 candidates.
The hope is that this way, users will have *some chance* of making
forward progress, without facing unbounded amounts of error spam.
Differential Revision: https://reviews.llvm.org/D95754
Peter Collingbourne [Fri, 26 Feb 2021 00:50:02 +0000 (16:50 -0800)]
Revert
7a0da8894348, "scudo: Support memory tagging in the secondary allocator."
We measured a 2.5 seconds (17.5%) regression in Android boot time
performance with this change.
Craig Topper [Fri, 26 Feb 2021 00:30:21 +0000 (16:30 -0800)]
[RISCV] Support fixed vector extract_element for FP types.
Fangrui Song [Thu, 25 Feb 2021 23:46:37 +0000 (15:46 -0800)]
[ELF] Add -z start-stop-gc to let __start_/__stop_ not retain C identifier name sections
For one metadata section usage, each text section references a metadata section.
The metadata sections have a C identifier name to allow the runtime to collect them via `__start_/__stop_` symbols.
Since `__start_`/`__stop_` references are always present from live sections, the
C identifier name sections appear like GC roots, which means they cannot be
discarded by `ld --gc-sections`.
To make such sections GCable, either SHF_LINK_ORDER or a section group is needed.
SHF_LINK_ORDER is not suitable for the references can be inlined into other functions
(See D97430:
Function A (in the section .text.A) references its `__sancov_guard` section.
Function B inlines A (so now .text.B references `__sancov_guard` - this is invalid with the semantics of SHF_LINK_ORDER).
In the linking stage,
if `.text.A` gets discarded, and `__sancov_guard` is retained via the reference from `.text.B`,
the output will be invalid because `__sancov_guard` references the discarded `.text.A`.
LLD errors "sh_link points to discarded section".
)
A section group have size overhead, and is cumbersome when there is just one metadata section.
Add `-z start-stop-gc` to drop the "__start_/__stop_ references retain
non-SHF_LINK_ORDER non-SHF_GROUP C identifier name sections" rule.
We reserve the rights to switch the default in the future.
Reviewed By: phosek, jrtc27
Differential Revision: https://reviews.llvm.org/D96914
Yonghong Song [Thu, 25 Feb 2021 23:34:48 +0000 (15:34 -0800)]
BPF: Add LLVMTransformUtils in CMakefile LINK_COMPONENTS
Commit
1959ead525b8 ("BPF: Implement TTI.getCmpSelInstrCost()
properly") introduced a dependency on LLVMTransformUtils
library. Let us encode this dependency explicitly in
CMakefile to avoid build error.
Ryan Prichard [Wed, 10 Feb 2021 09:25:58 +0000 (01:25 -0800)]
[Android] Use -l:libunwind.a with --rtlib=compiler-rt
On Android, the unwinder isn't part of the C++ STL and isn't (in older
versions) exported from libc.so. Instead, the driver links the static
unwinder archive implicitly. Currently, the Android NDK implicitly
links libgcc.a to provide both builtins and the unwinder.
To support switching to compiler-rt builtins and libunwind, make
--rtlib=compiler-rt behave the same way on Android, and implicitly pass
-l:libunwind.a to the linker.
Adjust the -ldl logic. For the Android NDK, the unwinder (whether
libgcc.a or libunwind.a) is linked statically and calls a function in
the dynamic loader for finding unwind tables (e.g. dl_iterate_phdr).
On Android, this function is in libc.a for static executables and
libdl.so otherwise, so -ldl is needed. (glibc doesn't need -ldl because
its libc.so exports dl_iterate_phdr.)
Differential Revision: https://reviews.llvm.org/D96403
Jianzhou Zhao [Tue, 23 Feb 2021 16:48:26 +0000 (16:48 +0000)]
[dfsan] Conservative solution to atomic load/store
DFSan at store does store shadow data; store app data; and at load does
load shadow data; load app data.
When an application data is atomic, one overtainting case is
thread A: load shadow
thread B: store shadow
thread B: store app
thread A: load app
If the application address had been used by other flows, thread A reads
previous shadow, causing overtainting.
The change is similar to MSan's solution.
1) enforce ordering of app load/store
2) load shadow after load app; store shadow before shadow app
3) do not track atomic store by reseting its shadow to be 0.
The last one is to address a case like this.
Thread A: load app
Thread B: store shadow
Thread A: load shadow
Thread B: store app
This approach eliminates overtainting as a trade-off between undertainting
flows via shadow data race.
Note that this change addresses only native atomic instructions, but
does not support builtin libcalls yet.
https://llvm.org/docs/Atomics.html#libcalls-atomic
Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D97310
Kostya Kortchinsky [Thu, 25 Feb 2021 21:30:40 +0000 (13:30 -0800)]
[Clang][ASan] Correct AsanDtorKindToString to return non-void in default case
Post D96572, a warning started showing up for me:
`clang/lib/Basic/Sanitizers.cpp:73:1: warning: control reaches end of non-void function [-Wreturn-type]`
So this adds a default to the case to return invalid, which seems appropriate,
and appears to correct the issue.
Differential Revision: https://reviews.llvm.org/D97496
James Y Knight [Tue, 9 Feb 2021 04:07:12 +0000 (23:07 -0500)]
Add Alignment argument to IRBuilder CreateAtomicRMW and CreateAtomicCmpXchg.
And then push those change throughout LLVM.
Keep the old signature in Clang's CGBuilder for now -- that will be
updated in a follow-on patch (D97224).
The MLIR LLVM-IR dialect is not updated to support the new alignment
attribute, but preserves its existing behavior.
Differential Revision: https://reviews.llvm.org/D97223