Commit Graph

391406 Commits

Author SHA1 Message Date
Stephen Tozer fa1de88f81 [DebugInfo] Prevent non-determinism when updating DIArgList users of a value
This patch fixes an issue where builds of programs with multiple dbg.values
with DIArgList locations could have non-deterministic output. This issue
was caused by ReplaceableMetadataImpl::getAllArgListUsers, which
returned DIArgList pointers in a random order; the output of this
function would later be used to insert dbg.values, causing the order of
insertion to be non-deterministic. This patch changes getAllArgListUsers
to return pointers in a fixed order.

Differential Revision: https://reviews.llvm.org/D104105
2021-06-17 15:09:27 +01:00
Alexander Belyaev 7cddf56d60 [mlir] Remove linalg.indexed_generic forward decl. 2021-06-17 16:04:06 +02:00
David Spickett eaf60a4411 [lldb] Remove redundant calls to set eReturnStatusFailed
This is part 2, covering the commands source.

Some uses remain where it's tricky to see what the
logic is or they are not used with AppendError.

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D104448
2021-06-17 14:39:35 +01:00
Sjoerd Meijer 3f596842e3 [FuncSpec] Precommit test: don't specialise funcs with NoDuplicate instrs. NFC. 2021-06-17 14:13:25 +01:00
Benjamin Kramer c878d03d60 [mlir] Split things dependent on LLVM_DEBUG into a .cpp file
LLVM_DEBUG in headers is awkward, better avoid it. DEBUG_TYPE in a
header results in a lot of macro redefinition warnings.
2021-06-17 15:06:40 +02:00
Simon Pilgrim cdb4fcf9a1 [X86] combineSelect - refactor MIN/MAX detection code to make it easier to add additional select(setcc,x,y) folds. NFCI.
I need to add some additional handling to address some of the regressions from D101074
2021-06-17 13:50:59 +01:00
Alexander Belyaev 5b3cb31edb [mlir][linalg] Purge linalg.indexed_generic.
Differential Revision: https://reviews.llvm.org/D104449
2021-06-17 14:45:37 +02:00
Florian Hahn aa6e8e9572
[X86] Check using default in test added in 0bd5bbb31e.
Make sure llvm-mc is invariant with respect to debug locations in the
test (checks update to use the -x86-pad-for-align default value)
2021-06-17 13:19:43 +01:00
Guillaume Chatelet 8d64ed8544 [libc] Generate one benchmark per implementation
We now generate as many benchmarks as there are implementations.

Differential Revision: https://reviews.llvm.org/D102156
2021-06-17 12:14:10 +00:00
Florian Hahn 0bd5bbb31e
[X86] Add test showing binary differences with -x86-pad-for-align.
This patch adds a test case showing how a single extra .loc can cause
binary differences when using -x86-pad-for-align=true.

The issue has been discussed in D94542, PR42138, PR48742.
2021-06-17 12:27:17 +01:00
Alex Zinenko 6b6338195c [mlir] define a customized DEBUG_TYPE in InterfaceSupport.h 2021-06-17 13:24:32 +02:00
David Spickett 7a580f3c28 [lldb] Remove redundant calls to set eReturnStatusFailed
Since https://reviews.llvm.org/D103701 AppendError<...>
sets this for you.

This change includes all of the non-command uses.

Some uses remain where it's either tricky to reason about
the logic, or they aren't paired with AppendError calls.

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D104379
2021-06-17 12:21:54 +01:00
David Spickett 983ed1b58e [lldb] Set return object failed status even if error string is empty
The idea is now that AppendError<...> will set eReturnStatusFailed
for you so you don't have to call SetStatus again.

Previously if the error message was empty, the status wouldn't
be set.

I don't think there are any sitautions where the message is in
fact empty but it potentially could be depending on where
we get the string from.

So let's set the status up front then return early if the message is empty.

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D104380
2021-06-17 12:20:52 +01:00
Alex Zinenko d7e8912134 [mlir] Enable delayed registration of attribute/operation/type interfaces
This functionality is similar to delayed registration of dialect interfaces. It
allows external interface models to be registered before the dialect containing
the attribute/operation/type interface is loaded, or even before the context is
created.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D104397
2021-06-17 13:19:24 +02:00
Florian Mayer ccc0f777f6 [hwasan] Improve report for addresses within regions.
Before: ADDR is located -320 bytes to the right of 1072-byte region
After: ADDR is located 752 bytes inside 1072-byte region

Reviewed By: eugenis, walli99

Differential Revision: https://reviews.llvm.org/D104412
2021-06-17 12:01:30 +01:00
Florian Mayer 18070723ef [hwasan] Do not use short granule tags as poison tags.
Short granule tags as poison cause a UaF to read the referenced
memory to retrieve the tag, and means we do not detect the UaF
if the last granule's tag is still around.

This only increases the change of not catching a UaF from
0.39 % (1 / 256) to 0.42 % (1 / (256 - 17)).

Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D104304
2021-06-17 11:59:37 +01:00
hyeongyukim 69b0ed9a0a [InstCombine] Fix miscompile on GEP+load to icmp fold (PR45210)
As noted in PR45210: https://bugs.llvm.org/show_bug.cgi?id=45210
...the bug is triggered as Eli say when sext(idx) * ElementSize overflows.

```
   // assume that GV is an array of 4-byte elements
   GEP = gep GV, 0, Idx // this is accessing Idx * 4
   L = load GEP
   ICI = icmp eq L, value
 =>
   ICI = icmp eq Idx, NewIdx
```

The foldCmpLoadFromIndexedGlobal function simplifies GEP+load operation to icmp.
And there is a problem because Idx * ElementSize can overflow.

Let's assume that the wanted value is at offset 0.
Then, there are actually four possible values for Idx to match offset 0: 0x00..00, 0x40..00, 0x80..00, 0xC0..00.
We should return true for all these values, but currently, the new icmp only returns true for 0x00..00.

This problem can be solved by masking off (trailing zeros of ElementSize) bits from Idx.

```
   ...
 =>
   Idx' = and Idx, 0x3F..FF
   ICI = icmp eq Idx', NewIdx
```

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D99481
2021-06-17 19:46:17 +09:00
Jean Perier 1a4af2e45e [flang] preserve symbol in DescriptorInquiry
Do not use ultimate symbols in DescriptorInquiry. Using the ultimate
symbol may lead to issues later for at least two reasons:

- The original symbols may have volatile/asynchronous attributes that
  the ultimate may not have. Later phases working on the DescriptorInquiry
  would then not apply potential care required by these attributes.
- HostAssociatedDetails symbols are used by OpenMP for symbols with
  special OpenMP attributes inside OpenMP region (e.g variables with
  private attribute), so it is very important to preserve this
  aspect in the DescriptorInquiry, that would otherwise apply on the
  symbol outside of the region.

Differential Revision: https://reviews.llvm.org/D104385
2021-06-17 12:42:08 +02:00
Florian Mayer b18f30fb2d [NFC] test commit, fix namespace ending comment. 2021-06-17 11:18:36 +01:00
Igor Kudrin 5355b8c631 [ELF] Restore arm-branch.s test
After D77330, the comments are inconsistent with the disassembled code.
As the value of `far` has been changed, a thunk to reach it is now
generated, and target addresses of branch instructions are different
from what was initially expected.

The patch fixes that and makes the test closer to what it was originally.

Differential Revision: https://reviews.llvm.org/D104286
2021-06-17 17:08:13 +07:00
Martin Storsjö ceee35e3e4 [LLD] [COFF] Remove a stray duplicate comment. NFC.
The following class isn't part of the export table; there's a
second correctly placed comment about the things that actually
belong to the export table.
2021-06-17 13:02:35 +03:00
Martin Storsjö ca56b33daf [llvm-dlltool] Imply the target arch from a tool triple prefix
Also use the default LLVM target as default for dlltool. This
matches how GNU dlltool behaves; it is compiled with one default
target, which is used if no option is provided.

Extend the anonymous namespace in the implementation file instead
of using static functions.

Based on a patch by Mateusz Mikuła.

The effect of the default LLVM target, if neither the -m option
nor a tool triple prefix is provided, isn't tested, as we can't
make assumptions about what it is set to.

(We could make the default be forced to one of the four supported
architectures if the default triple is another arch, and then just
test that llvm-dlltool without an -m option is able to produce an
import library, without checking the actual architecture though.)

Differential Revision: https://reviews.llvm.org/D104212
2021-06-17 13:02:35 +03:00
Martin Storsjö 675d52bc46 [llvm-dlltool] [test] Add a testcase for all machine option types. NFC.
The existing tests only test that some options (but not e.g. arm)
are accepted, but it doesn't test their functional effect of
affecting the generated object files.

Differential Revision: https://reviews.llvm.org/D104215
2021-06-17 13:02:35 +03:00
Martin Storsjö 08be746728 [llvm-dlltool] [test] Remove superfluous --coff-exports option to llvm-readobj. NFC.
The --coff-exports option to llvm-readobj prints the exported symbols
from a DLL/EXE, it doesn't do anything with regards to an import
library.

Differential Revision: https://reviews.llvm.org/D104214
2021-06-17 13:02:34 +03:00
Martin Storsjö 4fe3d5248d [llvm-dlltool] [test] Test both short and long forms of options. NFC.
Differential Revision: https://reviews.llvm.org/D104213
2021-06-17 13:02:34 +03:00
Martin Storsjö d7550e5d10 [libcxx] Fix a case of -Wundef warnings regarding _POSIX_TIMERS
Differential Revision: https://reviews.llvm.org/D104372
2021-06-17 13:02:34 +03:00
Alex Zinenko 23cdf7b6ed [mlir] separable registration of operation interfaces
This is similar to attribute and type interfaces and mostly the same mechanism
(FallbackModel / ExternalModel, ODS generation). There are minor differences in
how the concept-based polymorphism is implemented for operations that are
accounted for by ODS backends, and this essentially adds a test and exposes the
API.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D104294
2021-06-17 12:00:31 +02:00
Sjoerd Meijer dcd23d875a [FuncSpec] Don't specialise functions with attribute NoDuplicate.
Differential Revision: https://reviews.llvm.org/D104378
2021-06-17 10:32:29 +01:00
Fraser Cormack fed1503e85 [RISCV][VP] Lower FP VP ISD nodes to RVV instructions
With the exception of `frem`, this patch supports the current set of VP
floating-point binary intrinsics by lowering them to to RVV instructions. It
does so by using the existing `RISCVISD *_VL` custom nodes as an intermediate
layer. Both scalable and fixed-length vectors are supported by using this
method.

The `frem` node is unsupported due to a lack of available instructions. For
fixed-length vectors we could scalarize but that option is not (currently)
available for scalable-vector types. The support is intentionally left out so
it equivalent for both vector types.

The matching of vector/scalar forms is currently lacking, as scalable vector
types do not lower to the custom `VFMV_V_F_VL` node. We could either make
floating-point scalable vector splats lower to this node, or support the
matching of multiple kinds of splat via a `ComplexPattern`, much like we do for
integer types.

Reviewed By: rogfer01

Differential Revision: https://reviews.llvm.org/D104237
2021-06-17 10:04:00 +01:00
Balázs Kéri 05e95d2dd7 [clang][AST] Set correct DeclContext in ASTImporter lookup table for template params.
Template parameters are created in ASTImporter with the translation unit as DeclContext.
The DeclContext is later updated (by the create function of template classes).
ASTImporterLookupTable was not updated after these changes of the DC. The patch
adds update of the DeclContext in ASTImporterLookupTable.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D103792
2021-06-17 11:20:27 +02:00
David Green fda8b4714e [InterleaveAccess] Copy fast math flags when adjusting binary operators in interleave access pass
The Interleave Access pass will convert shuffle(binop(load, load)) to
binop(shuffle(load), shuffle(load)), in order to create more
interleaving load patterns (VLD2/3/4) that might have been messed up by
instcombine. As shown in D104247 we were missing copying IR flags to the
new instruction though, which should just be kept the same as the
original instruction.

Differential Revision: https://reviews.llvm.org/D104255
2021-06-17 09:53:33 +01:00
Tomasz Miąsko 9b1085604e [Demangle] Support Rust v0 mangling scheme in llvm::demangle
The llvm::demangle is currently used by llvm-objdump and llvm-readobj,
so this effectively adds support for Rust v0 mangling to those
applications.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D104340
2021-06-17 10:37:26 +02:00
Florian Hahn 80a403348b
[VPlan] Support PHIs as LastInst when inserting scalars in ::get().
At the moment, we create insertelement instructions directly after
LastInst when inserting scalar values in a vector in
VPTransformState::get.

This results in invalid IR when LastInst is a phi, followed by another
phi. In that case, the new instructions should be inserted just after
the last PHI node in the block.

At the moment, I don't think the problematic case can be triggered, but
it can happen once predicate regions are merged and multiple
VPredInstPHI recipes are in the same block (D100260).

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D104188
2021-06-17 09:36:44 +01:00
Yilong Guo 873308fd8c [Format] Fix incorrect pointer/reference detection
https://llvm.org/PR50568

When an overloaded operator is called, its argument must be an
expression.

Before:
    void f() { a.operator()(a *a); }

After:
    void f() { a.operator()(a * a); }

Reviewed By: HazardyKnusperkeks, curdeius, MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D103678
2021-06-17 09:34:06 +01:00
Kirstóf Umann 9cca5c1391 [analyzer] Make checker silencing work for non-pathsensitive bug reports
D66572 separated BugReport and BugReporter into basic and path sensitive
versions. As a result, checker silencing, which worked deep in the path
sensitive report generation facilities became specific to it. DeadStoresChecker,
for instance, despite being in the static analyzer, emits non-pathsensitive
reports, and was impossible to silence.

This patch moves the corresponding code before the call to the virtual function
generateDiagnosticForConsumerMap (which is overriden by the specific kinds of
bug reporters). Although we see bug reporting as relatively lightweight compared
to the analysis, this will get rid of several steps we used to throw away.

Quoting from D65379:

At a very high level, this consists of 3 steps:

For all BugReports in the same BugReportEquivClass, collect all their error
nodes in a set. With that set, create a new, trimmed ExplodedGraph whose leafs
are all error nodes.
Until a valid report is found, construct a bug path, which is yet another
ExplodedGraph, that is linear from a given error node to the root of the graph.
Run all visitors on the constructed bug path. If in this process the report got
invalidated, start over from step 2.
Checker silencing used to kick in after all of these. Now it does before any of
them :^)

Differential Revision: https://reviews.llvm.org/D102914

Change-Id: Ice42939304516f2bebd05a1ea19878b89c96a25d
2021-06-17 10:27:34 +02:00
Alex Zinenko a4f81b2054 [mlir] ODS: emit interface traits outside of the interface class
ODS currently emits the interface trait class as a nested class inside the
interface class. As an unintended consequence, the default implementations of
interface methods have implicit access to static fields of the interface class,
e.g. those declared in `extraClassDeclaration`, including private methods (!),
or in the parent class. This may break the use of default implementations for
external models, which are not defined in the interface class, and generally
complexifies the abstraction.

Emit intraface traits outside of the interface class itself to avoid accidental
implicit visibility. Public static fields can still be accessed via explicit
qualification with a class name, e.g., `MyOpInterface::staticMethod()` instead
of `staticMethod`.

Update the documentation to clarify the role of `extraClassDeclaration` in
interfaces.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D104384
2021-06-17 10:25:35 +02:00
Raphael Isemann 25fa67868b [lldb] Skip variant/optional libc++ tests for Clang 5/6
Clang 5 and Clang 6 can no longer parse newer versions of libc++. As we can't
specify the specific libc++ version in the decorator, let's only allow Clang
versions that can parse all currently available libc++ versions.
2021-06-17 09:52:09 +02:00
Bjorn Pettersson 4c7f820b2b Update @llvm.powi to handle different int sizes for the exponent
This can be seen as a follow up to commit 0ee439b705,
that changed the second argument of __powidf2, __powisf2 and
__powitf2 in compiler-rt from si_int to int. That was to align with
how those runtimes are defined in libgcc.
One thing that seem to have been missing in that patch was to make
sure that the rest of LLVM also handle that the argument now depends
on the size of int (not using the si_int machine mode for 32-bit).
When using __builtin_powi for a target with 16-bit int clang crashed.
And when emitting libcalls to those rtlib functions, typically when
lowering @llvm.powi), the backend would always prepare the exponent
argument as an i32 which caused miscompiles when the rtlib was
compiled with 16-bit int.

The solution used here is to use an overloaded type for the second
argument in @llvm.powi. This way clang can use the "correct" type
when lowering __builtin_powi, and then later when emitting the libcall
it is assumed that the type used in @llvm.powi matches the rtlib
function.

One thing that needed some extra attention was that when vectorizing
calls several passes did not support that several arguments could
be overloaded in the intrinsics. This patch allows overload of a
scalar operand by adding hasVectorInstrinsicOverloadedScalarOpd, with
an entry for powi.

Differential Revision: https://reviews.llvm.org/D99439
2021-06-17 09:38:28 +02:00
Kadir Cetinkaya 204014ec75
[clangd] Fix feature modules to drop diagnostics
Ignored diagnostics were only checked after level adjusters and assumed
it would stay the same for the rest. But it can also be modified by
FeatureModules.

Differential Revision: https://reviews.llvm.org/D103387
2021-06-17 09:29:29 +02:00
Kadir Cetinkaya b662651586
[clangd] Use command line adjusters for inserting compile flags
This fixes issues with `--` in the compile flags.

Fixes https://github.com/clangd/clangd/issues/632.

Differential Revision: https://reviews.llvm.org/D99523
2021-06-17 09:24:53 +02:00
Kristof Beyls 6f0e74cd58 Avoid unnecessary AArch64 DSB in __clear_cache in some situations.
The dsb after instruction cache invalidation only needs to be executed
if any instruction cache invalidation did happen.
Without this change, if the CTR_EL0.DIC bit indicates that instruction
cache invalidation is not needed, __clear_cache would execute two dsb
instructions in a row; with the second one being unnecessary.

Differential Revision: https://reviews.llvm.org/D104371
2021-06-17 07:45:06 +01:00
MaheshRavishankar 3ed3e438a7 [mlir] Move `memref.dim` canonicalization using `InferShapedTypeOpInterface` to a separate pass.
Based on dicussion in
[this](https://llvm.discourse.group/t/remove-canonicalizer-for-memref-dim-via-shapedtypeopinterface/3641)
thread the pattern to resolve the `memref.dim` of a value that is a
result of an operation that implements the
`InferShapedTypeOpInterface` is moved to a separate pass instead of
running it as a canonicalization pass. This allows shape resolution to
happen when explicitly required, instead of automatically through a
canonicalization.

Differential Revision: https://reviews.llvm.org/D104321
2021-06-16 22:13:11 -07:00
Lang Hames 838490de7e [ORC] Switch from uint8_t to char buffers for TargetProcessControl::runWrapper.
This matches WrapperFunctionResult's char buffer, cutting down on the number of
pointer casts needed.
2021-06-17 13:27:09 +10:00
Mehdi Amini 6a071e535f Improve error reporting on pass registration collision (NFC)
Differential Revision: https://reviews.llvm.org/D104430
2021-06-17 02:42:43 +00:00
Xuanda Yang 01cb9c5fc5 [lld][MachO] Sort symbols in parallel in -map
source: https://bugs.llvm.org/show_bug.cgi?id=50689

When writing a map file, sort symbols in parallel using parallelSort.
Use address name to break ties if two symbols have the same address.

Reviewed By: thakis, int3

Differential Revision: https://reviews.llvm.org/D104346
2021-06-17 10:19:59 +08:00
Haruki Imai 5a55205bb3 [mlir] Fixed dynamic operand storage on big-endian machines.
Many tests fails by D101969 (https://reviews.llvm.org/D101969)
on big-endian machines. This patch changes bit order of
TrailingOperandStorage in big-endian machines. This patch
works on System Z (Triple = "s390x-ibm-linux", CPU = "z14").

Signed-off-by: Haruki Imai <imaihal@jp.ibm.com>

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D104225
2021-06-16 18:38:08 -07:00
Kevin Athey 07481b3796 Remove obsolete call to AsyncSignalSafeLazyInitiFakeStack.
Code was originally added for Myriad D46626 which was removed
with D104279.

related to: https://github.com/google/sanitizers/issues/1394

Reviewed By: vitalybuka, morehouse

Differential Revision: https://reviews.llvm.org/D104419
2021-06-16 18:26:33 -07:00
River Riddle 854ef875b9 [mlir-vscode] Add a link to mlir.llvm.org at the top of the vscode extension doc 2021-06-16 18:22:02 -07:00
River Riddle d3c895a870 [mlir-lsp-server] Add an explicit blurb on where to send code contributions.
When the vscode extension is published, it may be unclear how to contribute improvements to the extension. This revision makes it clear that contributions should follow the traditional LLVM guidelines.
2021-06-16 18:22:01 -07:00
Adrian Prantl 42e2a90684 Relax language comparison when matching up C++ forward decls with definitions
when dealing with -gmodules debug info.

This fixes the bot failures on Darwin.

A recent clang change (presumably https://reviews.llvm.org/D104291)
introduced a bug where .pcm files would identify themselves as
DW_LANG_C_plus_plus, but the .o that references them would identify as
DW_LANG_C_plus_plus_14. While that bug needs to be fixed, too, it
shows that the current strict comparison also isn't meaningful.

rdar://79423225
2021-06-16 18:21:43 -07:00