MaheshRavishankar [Thu, 15 Oct 2020 05:32:52 +0000 (22:32 -0700)]
[mlir][SPIRV] Adding an attribute to capture configuration for cooperative matrix operations.
Each hardware that supports SPV_C_CooperativeMatrixNV has a list of
configurations that are supported natively. Add an attribute to
specify the configurations supported to the `spv.target_env`.
Reviewed By: antiagainst, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D89364
David Blaikie [Thu, 15 Oct 2020 05:10:18 +0000 (22:10 -0700)]
llvm-dwarfdump: Exit non-zero on an error path
Richard Smith [Thu, 15 Oct 2020 05:05:30 +0000 (22:05 -0700)]
Perform lvalue conversions on the left of a pseudo-destructor call 'p->~T()'.
Previously we failed to convert 'p' from array/function to pointer type,
and to represent the load of 'p' in the AST. The latter causes problems
for constant evaluation.
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 18:36:00 +0000 (14:36 -0400)]
clang-{tools,unittests}: Stop using SourceManager::getBuffer, NFC
Update clang-tools-extra, clang/tools, clang/unittests to migrate from
`SourceManager::getBuffer`, which returns an always dereferenceable
`MemoryBuffer*`, to `getBufferOrNone` or `getBufferOrFake`, both of
which return a `MemoryBufferRef`, depending on whether the call site was
checking for validity of the buffer. No functionality change intended.
Differential Revision: https://reviews.llvm.org/D89416
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 18:06:37 +0000 (14:06 -0400)]
clang/StaticAnalyzer: Stop using SourceManager::getBuffer
Update clang/lib/StaticAnalyzer to stop relying on a `MemoryBuffer*`,
using the `MemoryBufferRef` from `getBufferOrNone` or the
`Optional<MemoryBufferRef>` from `getBufferOrFake`, depending on whether
there's logic for checking validity of the buffer. The change to
clang/lib/StaticAnalyzer/Core/IssueHash.cpp is potentially a
functionality change, since the logic was wrong (it checked for
`nullptr`, which was never returned by the old API), but if that was
reachable the new behaviour should be better.
Differential Revision: https://reviews.llvm.org/D89414
Vinay Madhusudan [Thu, 15 Oct 2020 03:25:51 +0000 (08:55 +0530)]
[AArch64] Combine UADDVs to generate vector add
ADD(UADDV a, UADDV b) --> UADDV(ADD a, b)
This partially solves the bug: https://bugs.llvm.org/show_bug.cgi?id=46888
Meta ticket: https://bugs.llvm.org/show_bug.cgi?id=46929
Differential Revision: https://reviews.llvm.org/D88731
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 17:48:52 +0000 (13:48 -0400)]
clang/CodeGen: Stop using SourceManager::getBuffer, NFC
Update `clang/lib/CodeGen` to use a `MemoryBufferRef` from
`getBufferOrNone` instead of `MemoryBuffer*` from `getBuffer`. No
functionality change here.
Differential Revision: https://reviews.llvm.org/D89411
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 17:28:34 +0000 (13:28 -0400)]
clang/Frontend: Mostly stop using SourceManager::getBuffer, NFC
Update clang/lib/Frontend to use a `MemoryBufferRef` from
`getBufferOrFake` instead of `MemoryBuffer*` from `getBuffer`, with the
exception of `FrontendInputFile`, which I'm leaving for later.
Differential Revision: https://reviews.llvm.org/D89409
Jonas Devlieghere [Thu, 15 Oct 2020 03:10:55 +0000 (20:10 -0700)]
[dsymutil] Fix handling of aliases to private external symbols
dsymutil was incorrectly ignoring aliases to private extern symbols in
the MachODebugMapParser. This resulted in spurious warnings about not
being able to find symbols.
rdar://
49652389
Differential revision: https://reviews.llvm.org/D89444
Duncan P. N. Exon Smith [Wed, 14 Oct 2020 14:32:00 +0000 (10:32 -0400)]
clang/Basic: Stop using SourceManager::getBuffer, NFC
Update clang/lib/Basic to stop relying on a `MemoryBuffer*`, using the
`MemoryBufferRef` from `getBufferOrNone` or `getBufferOrFake` instead of
`getBuffer`.
Differential Revision: https://reviews.llvm.org/D89394
Luqman Aden [Thu, 15 Oct 2020 02:39:08 +0000 (19:39 -0700)]
[LLD] Set alignment as part of Characteristics in TLS table.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46473
LLD wasn't previously specifying any specific alignment in the TLS table's Characteristics field so the loader would just assume the default value (16 bytes). This works most of the time except if you have thread locals that want specific higher alignments (e.g. 32 as in the bug) *even* if they specify an alignment on the thread local. This change updates LLD to take the max alignment from tls section.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D88637
Luqman Aden [Thu, 15 Oct 2020 02:26:07 +0000 (19:26 -0700)]
Nit: Use early return to reduce indentation.
Luqman Aden [Wed, 14 Oct 2020 05:53:49 +0000 (22:53 -0700)]
Mask out existing alignment bits.
Luqman Aden [Wed, 7 Oct 2020 02:46:37 +0000 (19:46 -0700)]
Update tests.
Luqman Aden [Thu, 1 Oct 2020 13:44:36 +0000 (06:44 -0700)]
Fix style warnings.
Luqman Aden [Thu, 1 Oct 2020 08:07:43 +0000 (01:07 -0700)]
[LLD] Set alignment as part of Characteristics in TLS table.
Differential Revision: https://reviews.llvm.org/D88637
Tony [Thu, 15 Oct 2020 02:07:56 +0000 (02:07 +0000)]
[AMDGPU] Correct typos in SIMemoryLegalizer.cpp comments
Petr Hosek [Thu, 15 Oct 2020 01:44:09 +0000 (18:44 -0700)]
Revert "[CMake] Avoid accidental C++ standard library dependency in sanitizers"
This reverts commit
287c318690f19fcbe337211278798d97ccf7884e which broke
sanitizer tests that use C++ standard library.
Petr Hosek [Tue, 6 Oct 2020 19:26:55 +0000 (12:26 -0700)]
[CMake] Avoid accidental C++ standard library dependency in sanitizers
While sanitizers don't use C++ standard library, we could still end
up accidentally including or linking it just by the virtue of using
the C++ compiler. Pass -nostdinc++ and -nostdlib++ to avoid these
accidental dependencies.
Differential Revision: https://reviews.llvm.org/D88922
Richard Smith [Tue, 13 Oct 2020 17:03:02 +0000 (10:03 -0700)]
PR47805: Use a single object for a function parameter in the caller and
callee in constant evaluation.
We previously made a deep copy of function parameters of class type when
passing them, resulting in the destructor for the parameter applying to
the original argument value, ignoring any modifications made in the
function body. This also meant that the 'this' pointer of the function
parameter could be observed changing between the caller and the callee.
This change completely reimplements how we model function parameters
during constant evaluation. We now model them roughly as if they were
variables living in the caller, albeit with an artificially reduced
scope that covers only the duration of the function call, instead of
modeling them as temporaries in the caller that we partially "reparent"
into the callee at the point of the call. This brings some minor
diagnostic improvements, as well as significantly reduced stack usage
during constant evaluation.
Kazushi (Jam) Marukawa [Sat, 10 Oct 2020 06:15:14 +0000 (15:15 +0900)]
[VE] Add vector load/store instructions
Add vector registers and vector load/store instructions. Add
regression tests for vector load/store instructions too.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D89183
Dave Lee [Thu, 15 Oct 2020 00:19:22 +0000 (17:19 -0700)]
Revert "[ASTImporter] Fix crash caused by unset AttributeSpellingListIndex"
This broke the GreenDragon build, due to the following error while running
TestImportBuiltinFileID:
```
Ignored/unknown shouldn't get here
UNREACHABLE executed at tools/clang/include/clang/Sema/AttrSpellingListIndex.inc:13!
```
See http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/24213/
This reverts commit
73c6beb2f7053fe8b5150072c2b5cd930de38a22.
This reverts https://reviews.llvm.org/D89318
Kazushi (Jam) Marukawa [Wed, 14 Oct 2020 14:54:29 +0000 (23:54 +0900)]
[VE] Change to expand SHL_PARTS/SRA_PARTS/SRL_PARTS
VE doesn't have SHL_PARTS/SRA_PARTS/SRL_PARTS instructions, so need
to expand them. Add regression tests too.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D89396
Amara Emerson [Wed, 14 Oct 2020 19:32:33 +0000 (12:32 -0700)]
[AArch64][GlobalISel] Don't use explicit zero registers for compare results.
These cause problems for later optimizations, just using an unused vreg like
SelectionDAG generates better code in the end, and obviates the need for some
GISel specific flag optimizations.
Differential Revision: https://reviews.llvm.org/D89419
Reid Kleckner [Thu, 27 Feb 2020 22:55:13 +0000 (14:55 -0800)]
[ADT] Use alignas + sizeof for inline storage, NFC
AlignedCharArrayUnion is really only needed to handle the "union" case
when we need memory of suitable size and alignment for multiple types.
SmallVector only needs storage for one type, so use that directly.
Leonard Chan [Wed, 14 Oct 2020 22:48:29 +0000 (15:48 -0700)]
[clang][NFC] Change diagnostic to start with lowercase letter
Ben Hamilton [Wed, 14 Oct 2020 20:26:14 +0000 (14:26 -0600)]
[Format/ObjC] Add NS_SWIFT_NAME() and CF_SWIFT_NAME() to WhitespaceSensitiveMacros
The argument passed to the preprocessor macros `NS_SWIFT_NAME(x)` and
`CF_SWIFT_NAME(x)` is stringified before passing to
`__attribute__((swift_name("x")))`.
ClangFormat didn't know about this stringification, so its custom parser
tried to parse the argument(s) passed to the macro as if they were
normal function arguments.
That means ClangFormat currently incorrectly inserts whitespace
between `NS_SWIFT_NAME` arguments with colons and dots, so:
```
extern UIWindow *MainWindow(void) NS_SWIFT_NAME(getter:MyHelper.mainWindow());
```
becomes:
```
extern UIWindow *MainWindow(void) NS_SWIFT_NAME(getter : MyHelper.mainWindow());
```
which clang treats as a parser error:
```
error: 'swift_name' attribute has invalid identifier for context name [-Werror,-Wswift-name-attribute]
```
Thankfully, D82620 recently added the ability to treat specific macros
as "whitespace sensitive", meaning their arguments are implicitly
treated as strings (so whitespace is not added anywhere inside).
This diff adds `NS_SWIFT_NAME` and `CF_SWIFT_NAME` to
`WhitespaceSensitiveMacros` so their arguments are implicitly treated
as whitespace-sensitive.
Test Plan:
New tests added. Ran tests with:
% ninja FormatTests && ./tools/clang/unittests/Format/FormatTests
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D89425
Adrian Prantl [Wed, 14 Oct 2020 21:20:39 +0000 (14:20 -0700)]
Register TargetCXXABI.def as a textual header
MaheshRavishankar [Wed, 14 Oct 2020 20:34:53 +0000 (13:34 -0700)]
[mlir][Linalg] Rethink fusion of linalg ops with reshape ops.
The current fusion on tensors fuses reshape ops with generic ops by
linearizing the indexing maps of the fused tensor in the generic
op. This has some limitations
- It only works for static shapes
- The resulting indexing map has a linearization that would be
potentially prevent fusion later on (for ex. tile + fuse).
Instead, try to fuse the reshape consumer (producer) with generic op
producer (consumer) by expanding the dimensionality of the generic op
when the reshape is expanding (folding). This approach conflicts with
the linearization approach. The expansion method is used instead of
the linearization method.
Further refactoring that changes the fusion on tensors to be a
collection of patterns.
Differential Revision: https://reviews.llvm.org/D89002
Benjamin Kramer [Wed, 14 Oct 2020 20:03:19 +0000 (22:03 +0200)]
Make header self-contained. NFC.
Duncan P. N. Exon Smith [Tue, 13 Oct 2020 22:09:47 +0000 (18:09 -0400)]
clang/Basic: Replace ContentCache::getBuffer with Optional semantics
Remove `ContentCache::getBuffer`, which always returned a
dereferenceable `MemoryBuffer*` and had a `bool*Invalid` out parameter,
and replace it with:
- `ContentCache::getBufferOrNone`, which returns
`Optional<MemoryBufferRef>`. This is the new API that consumers should
use. Later it could be renamed to `getBuffer`, but intentionally using
a different name to root out any unexpected callers.
- `ContentCache::getBufferPointer`, which returns `MemoryBuffer*` with
"optional" semantics. This is `private` to avoid growing callers and
`SourceManager` has temporarily been made a `friend` to access it.
Later paches will update the transitive callers to not need a raw
pointer, and eventually this will be deleted.
No functionality change intended here.
Differential Revision: https://reviews.llvm.org/D89348
Snehasish Kumar [Fri, 9 Oct 2020 00:36:13 +0000 (17:36 -0700)]
[llvm] Update default cutoff threshold for machine function splitter.
Based on internal testing at Google we found that setting the profile
summary cutoff threshold to 999950 yields the best results in terms of
itlb and icache metrics (as observed on Intel CPUs).
*default* = Split out code if no profile count available for block
*size-%* = The fraction of bytes split out of .text and .text.hot
*itlb* = Misses per kilo instructions (MPKI) for itlb
*icache* = Misses per kilo instructions (MPKI) for L1 icache
Search1
| cutoff | size-% | itlb | icache |
|---------|---------|-----------|---------|
| default | 42.5861 | 0.0822151 | 2.46363 |
| 999999 | 44.9350 | 0.0767194 | 2.44416 |
| 999950 | 50.0660 | 0.075744 | 2.4091 |
| 999500 | 56.9158 | 0.082564 | 2.4188 |
| 995000 | 63.8625 | 0.0814927 | 2.42832 |
| 990000 | 71.7314 | 0.106906 | 2.57785 |
Search2
| cutoff | size-% | itlb | icache |
|---------|--------|----------|---------|
| default | 2.8845 | 0.626712 | 4.73245 |
| 999999 | 3.3291 | 0.602309 | 4.70045 |
| 999950 | 3.8577 | 0.587842 | 4.71632 |
| 999500 | 4.4170 | 0.63577 | 4.68351 |
| 995000 | 5.1020 | 0.657969 | 4.82272 |
| 990000 | 5.7153 | 0.719122 | 5.39496 |
Differential Revision: https://reviews.llvm.org/D89085
Sean Silva [Mon, 12 Oct 2020 21:47:31 +0000 (14:47 -0700)]
[mlir] Fix some style comments from D89268
That change was a pure move, so split out the stylistic changes into
this patch.
Differential Revision: https://reviews.llvm.org/D89272
Sean Silva [Mon, 12 Oct 2020 21:32:38 +0000 (14:32 -0700)]
[mlir][bufferize] Rename BufferAssignment* to Bufferize*
Part of the refactor discussed in:
https://llvm.discourse.group/t/what-is-the-strategy-for-tensor-memref-conversion-bufferization/1938/17
Differential Revision: https://reviews.llvm.org/D89271
Sean Silva [Mon, 12 Oct 2020 21:03:09 +0000 (14:03 -0700)]
[mlir] Refactor code out of BufferPlacement.cpp
Now BufferPlacement.cpp doesn't depend on Bufferize.h.
Part of the refactor discussed in:
https://llvm.discourse.group/t/what-is-the-strategy-for-tensor-memref-conversion-bufferization/1938/17
Differential Revision: https://reviews.llvm.org/D89268
Sean Silva [Mon, 12 Oct 2020 19:23:45 +0000 (12:23 -0700)]
[mlir] Rename ShapeTypeConversion to ShapeBufferize
Once we have tensor_to_memref ops suitable for type materializations,
this pass can be split into a generic type conversion pattern.
Part of the refactor discussed in:
https://llvm.discourse.group/t/what-is-the-strategy-for-tensor-memref-conversion-bufferization/1938/17
Differential Revision: https://reviews.llvm.org/D89258
Sean Silva [Mon, 12 Oct 2020 19:38:05 +0000 (12:38 -0700)]
[mlir] Linalg refactor for using "bufferize" terminology.
Part of the refactor discussed in:
https://llvm.discourse.group/t/what-is-the-strategy-for-tensor-memref-conversion-bufferization/1938/17
Differential Revision: https://reviews.llvm.org/D89261
Leonard Chan [Wed, 12 Aug 2020 01:03:07 +0000 (18:03 -0700)]
[clang] Add -fc++-abi= flag for specifying which C++ ABI to use
This implements the flag proposed in RFC http://lists.llvm.org/pipermail/cfe-dev/2020-August/066437.html.
The goal is to add a way to override the default target C++ ABI through
a compiler flag. This makes it easier to test and transition between different
C++ ABIs through compile flags rather than build flags.
In this patch:
- Store `-fc++-abi=` in a LangOpt. This isn't stored in a
CodeGenOpt because there are instances outside of codegen where Clang
needs to know what the ABI is (particularly through
ASTContext::createCXXABI), and we should be able to override the
target default if the flag is provided at that point.
- Expose the existing ABIs in TargetCXXABI as values that can be passed
through this flag.
- Create a .def file for these ABIs to make it easier to check flag
values.
- Add an error for diagnosing bad ABI flag values.
Differential Revision: https://reviews.llvm.org/D85802
Snehasish Kumar [Wed, 7 Oct 2020 18:42:02 +0000 (11:42 -0700)]
[llvm] Set the default for -bbsections-cold-text-prefix to .text.split.
After using this for a while, we find that it is generally useful to
have it set to .text.split. by default, removing the need for an
additional -mllvm option.
Differential Revision: https://reviews.llvm.org/D88997
Guozhi Wei [Wed, 14 Oct 2020 18:46:11 +0000 (11:46 -0700)]
[MBP] Add whole chain to BlockFilterSet instead of individual BB
Currently we add individual BB to BlockFilterSet if its frequency satisfies
LoopFreq / Freq <= LoopToColdBlockRatio
LoopFreq is edge frequency from outside to loop header.
LoopToColdBlockRatio is a command line parameter.
It doesn't make sense since we always layout whole chain, not individual BBs.
It may also cause a tricky problem. Sometimes it is possible that the LoopFreq
of an inner loop is smaller than LoopFreq of outer loop. So a BB can be in
BlockFilterSet of inner loop, but not in BlockFilterSet of outer loop,
like .cold in the test case. So it is added to the chain of inner loop. When
work on the outer loop, .cold is not added to BlockFilterSet, so the edge to
successor .problem is not counted in UnscheduledPredecessors of .problem chain.
But other blocks in the inner loop are added BlockFilterSet, so the whole inner
loop chain can be layout, and markChainSuccessors is called to decrease
UnscheduledPredecessors of following chains. markChainSuccessors calls
markBlockSuccessors for every BB, even it is not in BlockFilterSet, like .cold,
so .problem chain's UnscheduledPredecessors is decreased, but this edge was not
counted on in fillWorkLists, so .problem chain's UnscheduledPredecessors
becomes 0 when it still has an unscheduled predecessor .pred! And it causes
problems in following various successor BB selection algorithms.
Differential Revision: https://reviews.llvm.org/D89088
Pavel Labath [Wed, 14 Oct 2020 18:41:57 +0000 (20:41 +0200)]
[lldb] More memory allocation test fixes
XFAIL nodefaultlib.cpp on darwin - the test does not pass there
XFAIL TestGdbRemoteMemoryAllocation on windows - memory is allocated
with incorrect permissions
Andrzej Warzynski [Wed, 14 Oct 2020 16:40:29 +0000 (17:40 +0100)]
[flang] Fix CMake bug in the definition of flang-new
Recent patch that improved Flang's compatibility with respect to how LLVM
dynamic libraries should be linked (and specified in CMake recipes),
introduced a bug in the definition of `flang-new`:
* https://reviews.llvm.org/D87893
More specifically, `add_flang_tool` does not support the
`LINK_COMPONENTS` CMake argument. Instead, one should set
`LLVM_LINK_COMPONENTS` before calling `add_flang_tool`.
This patch reverts the change for `flang-new` from
https://reviews.llvm.org/D87893, and instead:
* sets `LLVM_LINK_COMPONENTS`
* calls `clang_target_link_libraries` to add Clang dependencies
Differential Revision: https://reviews.llvm.org/D89403
Justin Lebar [Wed, 14 Oct 2020 16:30:05 +0000 (09:30 -0700)]
Preserve param alignment in NVPTXLowerArgs pass.
NVPTXLowerArgs works as follows.
* Create a regular alloca with alignment identical to arg.
* Copy arg from param space (and ASC'ing it from generic AS first) to
the alloca (it's still in generic AS).
* Replace loads of arg with loads of alloca.
The bug here is that we did not preserve the arg's alignment when
loading from the alloca.
The impact of this bug is that sometimes param loads would be lowered as
a series of u8 loads, because we're incorrectly assuming everything has
alignment 1.
Differential Revision: https://reviews.llvm.org/D89404
rdzhabarov [Wed, 14 Oct 2020 17:51:16 +0000 (10:51 -0700)]
[DDR] Introduce implicit equality check for the source pattern operands with the same name.
This CL allows user to specify the same name for the operands in the source pattern which implicitly enforces equality on operands with the same name.
E.g., Pat<(OpA $a, $b, $a) ... > would create a matching rule for checking equality for the first and the last operands. Equality of the operands is enforced at any depth, e.g., OpA ($a, $b, OpB($a, $c, OpC ($a))).
Example usage: Pat<(Reshape $arg0, (Shape $arg0)), (replaceWithValue $arg0)>
Note, this feature only covers operands but not attributes.
Current use cases are based on the operand equality and explicitly add the constraint into the pattern. Attribute equality will be worked out on the different CL.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D89254
Michał Górny [Sat, 10 Oct 2020 08:05:02 +0000 (10:05 +0200)]
[lldb] [Process/FreeBSDRemote] Support YMM reg via PT_*XSTATE
Add a framework for reading/writing extended register sets via
PT_GETXSTATE/PT_GETXSTATE_INFO/PT_SETXSTATE, and use it to support
YMM0..YMM15. The code is prepared to handle arbitrary XSAVE extensions,
including correct offset handling.
This fixes Shell/Register/*ymm* tests.
Differential Revision: https://reviews.llvm.org/D89193
Krzysztof Parzyszek [Tue, 13 Oct 2020 20:47:56 +0000 (15:47 -0500)]
[Hexagon] Generate better splat code on v62+
Jacques Pienaar [Wed, 14 Oct 2020 17:28:51 +0000 (10:28 -0700)]
[mlir] More changes to avoid args now inserted.NFC
Migrates a bit more from the old/to be deprecated form.
Christopher Di Bella [Wed, 14 Oct 2020 17:13:32 +0000 (10:13 -0700)]
[Driver]: fix compiler-rt path when printing libgcc for baremetal
clang --target arm-none-eabi --print-libgcc-file-name --rtlib=compiler-rt
used to print `/path/to/lib/clang/version/lib/libclang_rt.builtins-arm.a`
but should print `/path/to/lib/clang/version/lib/baremetal/libclang_rt.builtins-arm.a`.
Similarly, --target armv7m-none-eabi should print libclang_rt.builtins-armv7m.a
This matches the compiler-rt file name used at link time in the
baremetal driver.
Reviewed By: manojgupta
Differential Revision: https://reviews.llvm.org/D89327
Craig Topper [Wed, 14 Oct 2020 17:17:37 +0000 (10:17 -0700)]
[X86] Add test case to demonstrate a Log2_32_Ceil that can just be Log2_32 in SimplifySetCC ctpop combine.
This combine can look through (trunc (ctpop X)). When doing this
it tries to make sure the trunc doesn't lose any information
from the ctpop. It does this by checking that the truncated type
has more bits that Log2_32_Ceil of the ctpop type. The Ceil is
unnecessary and pessimizes non-power of 2 types.
For example, ctpop of i256 requires 9 bits to represent the max
value of 256. But ctpop of i255 only requires 8 bits to represent
the max result of 255. Log2_32_Ceil of 256 and 255 both return 8
while Log2_32 returns 8 for 256 and 7 for 255.
Simon Pilgrim [Wed, 14 Oct 2020 17:14:23 +0000 (18:14 +0100)]
Revert rG25a97c3a43d7 - "[InstCombine] visitCallInst - retain undefs in vector funnel shift amounts"
This reverts commit
25a97c3a43d7bc469ec67dd4e901a507b9b11116.
We have other constant folds that fold undef funnel shift amounts to 0 - so we need to be consistent.
If we end up with regressions where we lose a splat shift amount pattern we'll have to investigate other canonicalizations, but matchFunnelShift currently protects us from that.
Konstantin Zhuravlyov [Wed, 14 Oct 2020 17:03:37 +0000 (13:03 -0400)]
AMDGPU: Update AMDHSA code object version handling
Differential Revision: https://reviews.llvm.org/D89076
Matt Arsenault [Mon, 5 Oct 2020 17:44:32 +0000 (13:44 -0400)]
InstCombine: Fix losing load properties in copy-constant-to-alloca
Preserve the alignment and metadata. Atomic loads are skipped for
this, but pass along the properties for consistency.
Matt Arsenault [Mon, 5 Oct 2020 17:50:17 +0000 (13:50 -0400)]
InstCombine: Fix infinite loop in copy-constant-to-alloca transform
This was broken by
16295d521e294b27106e51fac29957c1aac8ff89, when
instructions started being handled and not just constant
expressions. This was re-inserting an equivalent bitcast to the
original memcpy operand, which made a non-functional IR change on
every iteration.
This also fixes a secondary problem where it was inserting
addrspacecasts which may not have been legal (i.e. it changed the
source address space). Start visiting all pointer users and fail out
if we can't process them. Also start handling the relevant memory
intrinsic users. These cases can be dealt with by running
InferAddressSpaces separately.
Louis Dionne [Wed, 14 Oct 2020 16:40:59 +0000 (12:40 -0400)]
[libc++] Mark two tests as unsupported in C++03
This was dropped when I split the tests into individual source files
to make sure they would actually run (in
2908eb20ba).
Florian Hahn [Tue, 13 Oct 2020 17:47:37 +0000 (18:47 +0100)]
Recommit "[VPlan] Use VPValue def for VPMemoryInstructionRecipe."
This reverts the revert commit
710aceb645e7dba4de7053eef2c616311b9163d4
and includes a fix for a memsan failure.
Original message:
This patch turns VPMemoryInstructionRecipe into a VPValue and uses it
during VPlan construction and codegeneration instead of the plain IR
reference where possible.
Simon Pilgrim [Wed, 14 Oct 2020 16:37:07 +0000 (17:37 +0100)]
[CodeGen] Move x86 specific ms intrinsic tests into x86 target subfolder. NFCI.
Mark Schimmel [Wed, 14 Oct 2020 15:29:17 +0000 (10:29 -0500)]
Polly - specify address space when creating a pointer to a vector type
Polly incorrectly dropped the address space specified for a load instruction when it vectorized the code.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D88907
Kadir Cetinkaya [Wed, 14 Oct 2020 16:03:57 +0000 (18:03 +0200)]
[clangd] clang-format TweakTests, NFC
Irina Dobrescu [Tue, 15 Sep 2020 10:51:02 +0000 (11:51 +0100)]
Add Allocate Clause to MLIR Parallel Operation Definition
Differential Revision: https://reviews.llvm.org/D87684
Louis Dionne [Wed, 14 Oct 2020 15:59:30 +0000 (11:59 -0400)]
[libc++] Use ADDITIONAL_COMPILE_FLAGS instead of #define for _LIBCPP_DEBUG
Louis Dionne [Wed, 14 Oct 2020 14:54:59 +0000 (10:54 -0400)]
[libc++] Split off debug tests that were missed by
ce1365f8f7e into test/libcxx
Also, some tests had multiple death tests in them, so split them into
separate tests instead. The second death test would obviously never
get run, because the first one would kill the program before.
jasonliu [Wed, 14 Oct 2020 15:55:55 +0000 (15:55 +0000)]
[AIX] Turn -fdata-sections on by default in Clang
Summary:
This patch does the following:
1. Make InitTargetOptionsFromCodeGenFlags() accepts Triple as a
parameter, because some options' default value is triple dependant.
2. DataSections is turned on by default on AIX for llc.
3. Test cases change accordingly because of the default behaviour change.
4. Clang Driver passes in -fdata-sections by default on AIX.
Reviewed By: MaskRay, DiggerLin
Differential Revision: https://reviews.llvm.org/D88737
Simon Pilgrim [Wed, 14 Oct 2020 15:42:08 +0000 (16:42 +0100)]
[InstCombine] narrowRotate - canonicalize to OR(SHL,LSHR). NFCI.
Match the canonicalization code that was added to matchFunnelShift at rG02295e6d1a15
Mircea Trofin [Tue, 13 Oct 2020 16:29:15 +0000 (09:29 -0700)]
[NFC][MC] Use MCRegister in Machine{Sink|Pipeliner}.cpp
Differential Revision: https://reviews.llvm.org/D89328
Konstantin Zhuravlyov [Wed, 14 Oct 2020 15:38:58 +0000 (11:38 -0400)]
Remove Combine.td.rej file
Michael Liao [Wed, 14 Oct 2020 15:26:52 +0000 (11:26 -0400)]
Fix an apparent typo. `assert()` must not contain side-effects. NFC.
Kevin Petit [Wed, 14 Oct 2020 14:14:26 +0000 (15:14 +0100)]
[mlir][vulkan-runner] Fix buffer usage flags
The buffers are used as source or destination of transfer commands
so always add VK_BUFFER_USAGE_TRANSFER_{DST,SRC}_BIT to their usage
flags.
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
Guillaume Chatelet [Wed, 14 Oct 2020 15:26:17 +0000 (15:26 +0000)]
Fix conjuntion of -Werror,-Wsuggest-override with google/benchmark
Simon Pilgrim [Wed, 14 Oct 2020 14:36:50 +0000 (15:36 +0100)]
[InstCombine] Add m_SpecificIntAllowUndef pattern matcher
m_SpecificInt doesn't accept undef elements in a vector splat value - tweak specific_intval to optionally allow undefs and add the m_SpecificIntAllowUndef variants.
Allows us to remove the m_APIntAllowUndef + comparison hack inside matchFunnelShift
Calixte Denizet [Wed, 3 Jun 2020 07:44:36 +0000 (09:44 +0200)]
[profile] Remove useless msync when dumping gcda files
Summary:
According the mmap man page (https://man7.org/linux/man-pages/man2/mmap.2.html) is only required to precisely control updates, so we can safely remove it.
Since gcda files are dumped just before to call exec** functions, dump need to be fast.
On my computer, Firefox built with --coverage needs ~1min40 to display something and in removing msync it needs ~8s.
Reviewers: void
Subscribers: #sanitizers, marco-c, sylvestre.ledru
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D81060
Pavel Labath [Wed, 14 Oct 2020 14:46:10 +0000 (16:46 +0200)]
[lldb] Fix TestGdbRemoteMemoryAllocation on windows
It appears that memory allocation actually works on windows (but it was
not fully wired up before
2c4226f8).
Pavel Labath [Wed, 14 Oct 2020 14:41:13 +0000 (16:41 +0200)]
[lldb] Remove bogus ProcessMonitor forward-decls
This class is not used in those files.
Cameron McInally [Wed, 14 Oct 2020 14:11:58 +0000 (09:11 -0500)]
[SVE] Lower fixed length VECREDUCE_FADD operation
Differential Revision: https://reviews.llvm.org/D89263
Jean Perier [Wed, 14 Oct 2020 14:35:51 +0000 (16:35 +0200)]
[flang] Rework host runtime folding and enable REAL(2) folding with it.
- Rework the host runtime table so that it is constexpr to avoid
having to construct it and to store/propagate it.
- Make the interface simpler (remove many templates and a file)
- Enable 16bits float folding using 32bits float host runtime
- Move StaticMultimapView into its own header to use it for host
folding
Reviewed By: klausler, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D88981
Louis Dionne [Wed, 14 Oct 2020 14:12:09 +0000 (10:12 -0400)]
[libc++] Remove signal-based checkpoints in libc++ tests
While this adds some convenience to the test suite, it prevents the tests
using these checkpoints from being used on systems where signals are not
available, such as some embedded systems. It will also prevent these tests
from being constexpr-friendly once e.g. std::map is made constexpr, due
to the use of statics.
Instead, one can always use a debugger to figure out exactly where a
test is failing when that isn't clear from the log output without
checkpoints.
Michael Liao [Wed, 14 Oct 2020 14:11:19 +0000 (10:11 -0400)]
Fix `-Wparentheses` warnings. NFC.
Eric Schweitz [Wed, 14 Oct 2020 00:06:39 +0000 (17:06 -0700)]
[mlir] expand the legal floating-point types in the LLVM IR dialect type check
This patch adds a couple missing LLVM IR dialect floating point types to
the legality check.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D89350
Nicolas Vasilache [Wed, 14 Oct 2020 13:50:29 +0000 (13:50 +0000)]
[mlir][Linalg] Add missing dependency
Simon Pilgrim [Wed, 14 Oct 2020 13:38:08 +0000 (14:38 +0100)]
[InstCombine] visitCallInst - retain undefs in vector funnel shift amounts
By always performing a modulo on the shift amount constants this was causing undef amounts being replaced with zero, meaning we were losing funnel shift by splat (with undef) patterns.
Tweaked the shift amount bounds check to support (passthrough) undefs, and use Constant::mergeUndefsWith to preserve the undefs after folding.
Jonas Paulsson [Wed, 14 Oct 2020 12:39:35 +0000 (14:39 +0200)]
[SystemZ] Bugfix in SystemZVectorConstantInfo
In order to correctly load an all-ones FP NaN value into a floating point
register with a VGBM, the analyzed 32/64 FP bits must first be shifted left
(into element 0 of the vector register).
SystemZVectorConstantInfo has so far relied on element replication which has
bypassed the need to do this shift, but now it is clear that this must be
done in order to handle NaNs.
Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D89389
Jeremy Morse [Wed, 14 Oct 2020 13:16:42 +0000 (14:16 +0100)]
[DebugInstrRef] Create DBG_INSTR_REFs in SelectionDAG
When given the -experimental-debug-variable-locations option (via -Xclang
or to llc), have SelectionDAG generate DBG_INSTR_REF instructions instead
of DBG_VALUE. For now, this only happens in a limited circumstance: when
the value referred to is not a PHI and is defined in the current block.
Other situations introduce interesting problems, addresed in later patches.
Practically, this patch hooks into InstrEmitter and if it can find a
defining instruction for a value, gives it an instruction number, and
points the DBG_INSTR_REF at that <instr, operand> pair.
Differential Revision: https://reviews.llvm.org/D85747
Haojian Wu [Wed, 14 Oct 2020 13:13:13 +0000 (15:13 +0200)]
Fix a broken build for gcc <= 7.1
we need add a "this->" inside the lambda body to workaround it. Rewrite
it to normal for-range loop.
Roman Lebedev [Wed, 14 Oct 2020 11:56:58 +0000 (14:56 +0300)]
Revert "Reland "[SCEV] Model ptrtoint(SCEVUnknown) cast not as unknown, but as zext/trunc/self of SCEVUnknown"" and it's follow-ups
While we haven't encountered an earth-shattering problem with this yet,
by now it is pretty evident that trying to model the ptr->int cast
implicitly leads to having to update every single place that assumed
no such cast could be needed. That is of course the wrong approach.
Let's back this out, and re-attempt with some another approach,
possibly one originally suggested by Eli Friedman in
https://bugs.llvm.org/show_bug.cgi?id=46786#c20
which should hopefully spare us this pain and more.
This reverts commits
1fb610429308a7c29c5065f5cc35dcc3fd69c8b1,
7324616660fc0995fa8c166e3c392361222d5dbc,
aaafe350bb65dfc24c2cdad4839059ac81899fbe,
e92a8e0c743f83552fac37ecf21e625ba3a4b11e.
I've kept&improved the tests though.
Pavel Labath [Fri, 9 Oct 2020 11:59:50 +0000 (13:59 +0200)]
[lldb-server][linux] Add ability to allocate memory
This patch adds support for the _M and _m gdb-remote packets, which
(de)allocate memory in the inferior. This works by "injecting" a
m(un)map syscall into the inferior. This consists of:
- finding an executable page of memory
- writing the syscall opcode to it
- setting up registers according to the os syscall convention
- single stepping over the syscall
The advantage of this approach over calling the mmap function is that
this works even in case the mmap function is buggy or unavailable. The
disadvantage is it is more platform-dependent, which is why this patch
only works on X86 (_32 and _64) right now. Adding support for other
linux architectures should be easy and consist of defining the
appropriate syscall constants. Adding support for other OSes depends on
the its ability to do a similar trick.
Differential Revision: https://reviews.llvm.org/D89124
Pavel Labath [Wed, 7 Oct 2020 15:35:13 +0000 (17:35 +0200)]
[lldb] Modernize PseudoTerminal::OpenFirstAvailablePrimary
replace char*+length combo with llvm::Error
Serge Guelton [Mon, 5 Oct 2020 19:35:38 +0000 (15:35 -0400)]
[flang] Make flang build compatible with LLVM dylib
Harmonize usage of LLVM components througout Flang.
Explicit LLVM Libs where used across several CMakeFIles, which led to
incompatibilities with LLVM shlibs.
Fortunately, the LLVM component system can be relied on to harmoniously handle
both cases.
Differential Revision: https://reviews.llvm.org/D87893
Kadir Cetinkaya [Tue, 13 Oct 2020 11:05:36 +0000 (13:05 +0200)]
[clangd] Disable extract variable for RHS of assignments
Differential Revision: https://reviews.llvm.org/D89307
Gabor Marton [Tue, 13 Oct 2020 13:49:43 +0000 (15:49 +0200)]
[ASTImporter] Fix crash caused by unset AttributeSpellingListIndex
During the import of attributes we forgot to set the spelling list
index. This caused a segfault when we wanted to traverse the AST
(e.g. by the dump() method).
Differential Revision: https://reviews.llvm.org/D89318
Gabor Marton [Tue, 13 Oct 2020 13:57:37 +0000 (15:57 +0200)]
[ASTImporter] Fix crash caused by unimported type of FromatAttr
During the import of FormatAttrs we forgot to import the type (e.g
`__scanf__`) of the attribute. This caused a segfault when we wanted to
traverse the AST (e.g. by the dump() method).
Differential Revision: https://reviews.llvm.org/D89319
Haojian Wu [Mon, 12 Oct 2020 11:22:13 +0000 (13:22 +0200)]
[clangd] Refine recoveryAST flags in clangd
so that we could start experiment for C.
Previously, these flags in clangd were only meaningful for C++. We need
to flip them for C, this patch repurpose these flags.
- if true, just set it.
- if false, just respect the value in clang.
this would allow us to keep flags on for C++, and optionally flip them on for C.
Differential Revision: https://reviews.llvm.org/D89233
Carl Ritson [Wed, 14 Oct 2020 10:56:38 +0000 (19:56 +0900)]
[AMDGPU] Base getSubRegFromChannel on TableGen data
Generate (at runtime) the table used to drive getSubRegFromChannel,
base on AMDGPUSubRegIdxRanges from TableGen data.
The is a step closer to it being staticly generated by TableGen and
allows getSubRegFromChannel handle all bitwidths in the mean time.
Reviewed By: rampitec, arsenm, foad
Differential Revision: https://reviews.llvm.org/D89217
Juneyoung Lee [Mon, 12 Oct 2020 07:23:18 +0000 (16:23 +0900)]
[ValueTracking] Use assume's noundef operand bundle
This patch updates `isGuaranteedNotToBeUndefOrPoison` to use `llvm.assume`'s `noundef` operand bundle.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D89219
Tim Northover [Wed, 14 Oct 2020 10:38:01 +0000 (11:38 +0100)]
Analysis: only query size of sized objects.
Recently we started looking into sret parameters, though the issue could crop
up elsewhere. If the pointee type is opaque, we should not try to compute its
size because that leads to an assertion failure.
Nicolas Vasilache [Wed, 14 Oct 2020 09:02:47 +0000 (09:02 +0000)]
[mlir][Linalg] Make a Linalg CodegenStrategy available.
This revision adds a programmable codegen strategy from linalg based on staged rewrite patterns. Testing is exercised on a simple linalg.matmul op.
Differential Revision: https://reviews.llvm.org/D89374
Simon Pilgrim [Wed, 14 Oct 2020 10:58:21 +0000 (11:58 +0100)]
[InstCombine] Add undef funnel shift amount test coverage
sameeran joshi [Wed, 14 Oct 2020 09:52:28 +0000 (15:22 +0530)]
[Flang][OpenMP] Fix issue in only a single nowait clause can appear on a sections directive.
The OpenMP 5.0 standard restricts nowait clause to appear only once on sections
directive.
See OpenMP 5.0
- 2.8.1
- point 3 in restrictions.
Added a test with fix.
Reviewed By: DavidTruby
Differential Revision: https://reviews.llvm.org/D88556
Jeremy Morse [Wed, 14 Oct 2020 10:36:50 +0000 (11:36 +0100)]
Add x86 REQUIRES to tests from
2c5f3d54c5ee / D85746
Max Kazantsev [Wed, 14 Oct 2020 10:02:53 +0000 (17:02 +0700)]
[Test] Auto-update for some tests
Rainer Orth [Wed, 14 Oct 2020 10:02:27 +0000 (12:02 +0200)]
Reland "[Support][unittests] Enforce alignment in ConvertUTFTest"
This relands commit
53b3873cf428fd78f1d92504cc20adf11181ead7. The failure
of `ConvertUTFTest.UTF16WrappersForConvertUTF16ToUTF8String` detected the
first time is fixed.
Differential Revision: https://reviews.llvm.org/D88824
Vinay Madhusudan [Wed, 14 Oct 2020 09:50:35 +0000 (15:20 +0530)]
[AArch64] Add more addv tests
Differential Revision: https://reviews.llvm.org/D89365