platform/upstream/llvm.git
3 years ago[lldb/test] Deflake TestGdbRemote_vContThreads even more
Pavel Labath [Tue, 30 Mar 2021 14:50:04 +0000 (16:50 +0200)]
[lldb/test] Deflake TestGdbRemote_vContThreads even more

This patch fixes an issue, where if the thread has a signal blocked when
we try to inject it into the process (via vCont), then instead of
executing straight away, the injected signal will trigger another stop
when the thread unblocks the signal.

As (linux) threads start their life with SIGUSR1 (among others)
disabled, and only enable it during initialization, injecting the signal
during this window did not behave as expected. The fix is to change the
test to ensure the signal gets injected with the signal unblocked.

The simplest way to do this was to write a dedicated inferior for this
test. I also created a new header to factor out the function retrieving
the (os-specific) thread id.

3 years ago[OPENMP]Fix test checks for 32bit targets, NFC.
Alexey Bataev [Tue, 30 Mar 2021 14:45:12 +0000 (07:45 -0700)]
[OPENMP]Fix test checks for 32bit targets, NFC.

3 years ago[test, LoopVectorize] Fix use of var defined in CHECK-NOT
Thomas Preud'homme [Sun, 28 Mar 2021 00:03:37 +0000 (00:03 +0000)]
[test, LoopVectorize] Fix use of var defined in CHECK-NOT

LLVM test Transforms/LoopVectorize/X86/x86-pr39099.ll tries to check for
the absence of a sequence of instructions with several CHECK-NOT with
one of those directives using a variable defined in another. However
CHECK-NOT are checked independently so that is using a variable defined
in a pattern that should not occur in the input.

This commit only checks for the absence of a widened load which rules
out the presence of the whole sequence and does not involve an undefined
variable.

Reviewed By: fhahn

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

3 years agoAdded static verification for Linalg Ops.
Inho Seo [Tue, 30 Mar 2021 14:07:12 +0000 (07:07 -0700)]
Added static verification for Linalg Ops.

This verification is to check if the indices for static shaped operands
on linalgOps access out of bound memory or not. For dynamic shaped
operands, we would be able to check it on runtime stage.

Found several invalid Linalg ops testcases, and fixed them.

Reviewed By: hanchung

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

3 years ago[test, HardwareLoops] Fix use of var defined in CHECK-NOT
Thomas Preud'homme [Sun, 28 Mar 2021 00:03:37 +0000 (00:03 +0000)]
[test, HardwareLoops] Fix use of var defined in CHECK-NOT

LLVM test Transforms/HardwareLoops/ARM/structure.ll tries to check for
the absence of a sequence of instructions with several CHECK-NOT with
one of those directives using a variable defined in another. However
CHECK-NOT are checked independently so that is using a variable defined
in a pattern that should not occur in the input.

This commit only checks for the absence of llvm.loop.decrement.i32 which
rules out the presence of the whole sequence and does not involve an
undefined variable.

Reviewed By: dmgreen

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

3 years ago[lldb] Remove linux/mips debugging support
Pavel Labath [Mon, 29 Mar 2021 12:33:58 +0000 (14:33 +0200)]
[lldb] Remove linux/mips debugging support

As discussed on lldb-dev
<https://lists.llvm.org/pipermail/lldb-dev/2021-March/016777.html> the
mips code is unmaintained and untested. It also carries a lot of
technical debt which is not limited to mips-specific code.

Generic mips support remains (and is going to be used by the upcoming
freebsd code). Resurrecting mips support should be a matter of re-adding
the relevant register context files (while avoiding reintroducing the
debt).

3 years ago[AMDGPU] Remove outdated TODOs. NFC
Sebastian Neubauer [Tue, 30 Mar 2021 07:50:13 +0000 (09:50 +0200)]
[AMDGPU] Remove outdated TODOs. NFC

spillSGPRToVGPR is already respected in these places since D95768.

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

3 years ago[lldb] [server] Support for multiprocess extension
Michał Górny [Tue, 30 Mar 2021 11:25:06 +0000 (13:25 +0200)]
[lldb] [server] Support for multiprocess extension

Add a minimal support for the multiprocess extension in lldb-server.
The server indicates support for it via qSupported, and accepts
thread-ids containing a PID.  However, it still does not support
debugging more than one inferior, so any other PID value results
in an error.

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

3 years ago[analyzer] Fix crash when reasoning about C11 atomics (PR49422)
Valeriy Savchenko [Wed, 24 Mar 2021 15:58:22 +0000 (18:58 +0300)]
[analyzer] Fix crash when reasoning about C11 atomics (PR49422)

rdar://75020762

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

3 years ago[libc++] Add a CI job to test the Runtimes build
Louis Dionne [Tue, 16 Mar 2021 18:57:42 +0000 (11:57 -0700)]
[libc++] Add a CI job to test the Runtimes build

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

3 years ago[analyzer] Support allocClassWithName in OSObjectCStyleCast checker
Valeriy Savchenko [Mon, 29 Mar 2021 12:38:22 +0000 (15:38 +0300)]
[analyzer] Support allocClassWithName in OSObjectCStyleCast checker

`allocClassWithName` allocates an object with the given type.
The type is actually provided as a string argument (type's name).
This creates a possibility for not particularly useful warnings
from the analyzer.

In order to combat with those, this patch checks for casts of the
`allocClassWithName` results to types mentioned directly as its
argument.  All other uses of this method should be reasoned about
as before.

rdar://72165694

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

3 years ago[Analyzer] Track RValue expressions
Gabor Marton [Thu, 25 Mar 2021 14:40:26 +0000 (15:40 +0100)]
[Analyzer] Track RValue expressions

It makes sense to track rvalue expressions in the case of special
concrete integer values. The most notable special value is zero (later
we may find other values). By tracking the origin of 0, we can provide a
better explanation for users e.g. in case of division by 0 warnings.
When the divisor is a product of a multiplication then now we can show
which operand (or both) was (were) zero and why.

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

3 years ago[OPENMP]Fix PR48740: OpenMP declare reduction in C does not require an initializer
Alexey Bataev [Mon, 29 Mar 2021 20:45:05 +0000 (13:45 -0700)]
[OPENMP]Fix PR48740: OpenMP declare reduction in C does not require an initializer

If no initializer-clause is specified, the private variables will be
initialized following the rules for initialization of objects with static
storage duration.

Need to adjust the implementation to the current version of the
standard.

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

3 years agoclang-format: [JS] do not collapse - - to --.
Martin Probst [Mon, 29 Mar 2021 11:12:01 +0000 (13:12 +0200)]
clang-format: [JS] do not collapse - - to --.

In JavaScript, `- -1;` is legal syntax, the language allows unary minus.
However the two tokens must not collapse together: `--1` is prefix
decrement, i.e. different syntax.

Before:

    - -1; ==> --1;

After:

    - -1; ==> - -1;

This change makes no attempt to format this "nicely", given by all
likelihood this represents a programming mistake by the user, or odd
generated code.

The check is not guarded by language: this appears to be a problem in
Java as well, and will also be beneficial when formatting syntactically
incorrect C++ (e.g. during editing).

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

3 years ago[gn build] Port c51e91e04681
LLVM GN Syncbot [Tue, 30 Mar 2021 12:15:19 +0000 (12:15 +0000)]
[gn build] Port c51e91e04681

3 years agoRevert "[Passes] Add relative lookup table converter pass"
Krasimir Georgiev [Tue, 30 Mar 2021 12:13:37 +0000 (14:13 +0200)]
Revert "[Passes] Add relative lookup table converter pass"

This reverts commit 5178ffc7cf92527557ae16e86d0fa90d538c2a19.

Compiling `llvm-profdata` with a compiler build from this produces a
crashing binary.

3 years agoMove test to X86 directory
Oliver Stannard [Tue, 30 Mar 2021 11:57:04 +0000 (12:57 +0100)]
Move test to X86 directory

This test uses the X86 backend, so shouldn't be run if that isn't built.

3 years ago[lldb] [Process/gdb-remote] Fix TID reading to use U64
Michał Górny [Tue, 30 Mar 2021 11:30:12 +0000 (13:30 +0200)]
[lldb] [Process/gdb-remote] Fix TID reading to use U64

Fix multiple instances of reading thread-id to use U64 type instead
of U32.  This is consistent with lldb::tid_t being a 64-bit type.

3 years ago[clang] [PR49736] [C++2b] Correctly reject lambdas with requires clause and no parame...
Marek Kurdej [Tue, 30 Mar 2021 11:50:07 +0000 (13:50 +0200)]
[clang] [PR49736] [C++2b] Correctly reject lambdas with requires clause and no parameter list

This fixes http://llvm.org/PR49736 caused by implementing http://wg21.link/P1102 (https://reviews.llvm.org/rG0620e6f4b76a9725dbd82454d58c5a68a7e47074), by correctly allowing requires-clause only:
1) directly after template-parameter-list
2) after lambda-specifiers iff parameter-declaration-clause is present (2nd kind of lambda-declarator)

Reviewed By: aaron.ballman

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

3 years ago[x86] enhance matching of pmaddwd
Sanjay Patel [Tue, 30 Mar 2021 11:09:33 +0000 (07:09 -0400)]
[x86] enhance matching of pmaddwd

This was crashing with the example from:
https://llvm.org/PR49716
...and that was avoided with a283d7258360 ,
but as we can see from the SSE vs. AVX test code diff,
we can try harder to match the pattern.

This matcher code was adapted from another pmadd pattern
match in D49636, but it needs different ops to deal with
size mismatches.

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

3 years agoFix path in test added in e0577b3130a646b0ee090c04a40400483031c7a9 to work with both...
Douglas Yung [Tue, 30 Mar 2021 11:17:29 +0000 (04:17 -0700)]
Fix path in test added in e0577b3130a646b0ee090c04a40400483031c7a9 to work with both Linux/Windows paths.

Patch by Ying Yi!

3 years ago[LoopUnswitch] Simplify branch condition if it is select with constant operands
Juneyoung Lee [Tue, 30 Mar 2021 11:03:50 +0000 (20:03 +0900)]
[LoopUnswitch] Simplify branch condition if it is select with constant operands

This fixes the miscompilation reported in https://reviews.llvm.org/rG5bb38e84d3d0#986154 .

`select _, true, false` matches both m_LogicalAnd and m_LogicalOr, making later
transformations confused.
Simplify the branch condition to not have the form.

3 years agoNFC: Migrate PartialInlining to work on InstructionCost
Sander de Smalen [Thu, 25 Feb 2021 13:00:46 +0000 (13:00 +0000)]
NFC: Migrate PartialInlining to work on InstructionCost

This patch migrates cost values and arithmetic to work on InstructionCost.
When the interfaces to TargetTransformInfo are changed, any InstructionCost
state will propagate naturally.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: paulwalker-arm

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

3 years ago[gn build] (semi-manually) port 51fa9e0fd984
Nico Weber [Tue, 30 Mar 2021 10:59:37 +0000 (06:59 -0400)]
[gn build] (semi-manually) port 51fa9e0fd984

3 years agoFix cleanup error in TestVSCode_disconnect.test_launch
Muhammad Omair Javaid [Tue, 30 Mar 2021 09:33:25 +0000 (14:33 +0500)]
Fix cleanup error in TestVSCode_disconnect.test_launch

TestVSCode_disconnect.test_launch fails with clean up error because
disconnect gets called twice once from the test case and once from
the tear down hook.

This patch disables disconnect after its been called from test_launch

Reviewed By: clayborg

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

3 years ago[lli] Leaving two EH frame tests with MCJIT only after PowerPC failure
Stefan Gränitz [Tue, 30 Mar 2021 10:26:52 +0000 (12:26 +0200)]
[lli] Leaving two EH frame tests with MCJIT only after PowerPC failure

Will investigate these in isolation once the rest of D98931 successfully landed.

3 years ago[ARM] Handle Splats in MVE lane interleaving
David Green [Tue, 30 Mar 2021 10:19:16 +0000 (11:19 +0100)]
[ARM] Handle Splats in MVE lane interleaving

As another addition to MVE lane interleaving, this handles Splat shuffle
vectors, as the shuffle of a splat is a splat.

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

3 years ago[RegAlloc] Add a test with use in statepoint expected to be on stack.
Serguei Katkov [Tue, 30 Mar 2021 06:21:03 +0000 (13:21 +0700)]
[RegAlloc] Add a test with use in statepoint expected to be on stack.

The test shows that RA computes the spill weight independent on the
fact that statepoint instruction for var operands is ok to accept
this operand on stack. As a result the corresponding virtual register
evicts the other register which requires register for use.
It causes redundant fill operation.

3 years ago[LoopVectorize] Add support for scalable vectorization of induction variables
David Sherwood [Wed, 10 Mar 2021 17:06:47 +0000 (17:06 +0000)]
[LoopVectorize] Add support for scalable vectorization of induction variables

This patch adds support for the vectorization of induction variables when
using scalable vectors, which required the following changes:

1. Removed assert from InnerLoopVectorizer::getStepVector.
2. Modified InnerLoopVectorizer::createVectorIntOrFpInductionPHI to use
   a runtime determined value for VF and removed an assert.
3. Modified InnerLoopVectorizer::buildScalarSteps to work for scalable
   vectors. I did this by calculating the full vector value for each Part
   of the unroll factor (UF) and caching this in the VP state. This means
   that we are always able to extract an arbitrary element from the vector
   if necessary. In addition to this, I also permitted the caching of the
   individual lane values themselves for the known minimum number of elements
   in the same way we do for fixed width vectors. This is a further
   optimisation that improves the code quality since it avoids unnecessary
   extractelement operations when extracting the first lane.
4. Added an assert to InnerLoopVectorizer::widenPHIInstruction, since while
   testing some code paths I noticed this is currently broken for scalable
   vectors.

Various tests to support different cases have been added here:

  Transforms/LoopVectorize/AArch64/sve-inductions.ll

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

3 years agoRe-apply "[lli] Make -jit-kind=orc the default JIT engine"
Stefan Gränitz [Tue, 30 Mar 2021 09:57:38 +0000 (11:57 +0200)]
Re-apply "[lli] Make -jit-kind=orc the default JIT engine"

MCJIT served well as the default JIT engine in lli for a long time, but the code is getting old and maintenance efforts don't seem to be in sight. In the meantime Orc became mature enough to fill that gap. The newly added greddy mode is very similar to the execution model of MCJIT. It should work as a drop-in replacement for common JIT tasks.

Reviewed By: lhames

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

3 years ago[ASTImporter] Import member specialization/instantiation of enum decls
Gabor Marton [Fri, 26 Mar 2021 16:26:10 +0000 (17:26 +0100)]
[ASTImporter] Import member specialization/instantiation of enum decls

We do the import of the member enum specialization similarly to as we do
with member CXXRecordDecl specialization.

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

3 years agoRevert "[loop-idiom] Hoist loop memcpys to loop preheader"
Krasimir Georgiev [Tue, 30 Mar 2021 09:44:05 +0000 (11:44 +0200)]
Revert "[loop-idiom] Hoist loop memcpys to loop preheader"

This reverts commit 92ddd3c1b6cd8f01f39dfd716cf3e976de126e66.

Causes multistage clang crashes, e.g.:
https://lab.llvm.org/buildbot/#/builders/36/builds/6678

3 years ago[lldb] Change CreateHostNativeRegisterContextLinux argument type
Pavel Labath [Tue, 30 Mar 2021 09:42:19 +0000 (11:42 +0200)]
[lldb] Change CreateHostNativeRegisterContextLinux argument type

to NativeThreadLinux. This avoid casts down the line.

3 years ago[AArch64][SVE] Lower fixed length INSERT_VECTOR_ELT
Joe Ellis [Mon, 29 Mar 2021 10:11:42 +0000 (10:11 +0000)]
[AArch64][SVE] Lower fixed length INSERT_VECTOR_ELT

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

3 years ago[AArch64][SVE] Lower fixed length EXTRACT_VECTOR_ELT
Joe Ellis [Tue, 23 Mar 2021 14:53:19 +0000 (14:53 +0000)]
[AArch64][SVE] Lower fixed length EXTRACT_VECTOR_ELT

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

3 years ago[clangd] Perform merging for stale symbols in MergeIndex
Kadir Cetinkaya [Fri, 12 Mar 2021 18:49:40 +0000 (19:49 +0100)]
[clangd] Perform merging for stale symbols in MergeIndex

Clangd drops symbols from static index whenever the dynamic index is
authoritative for the file. This results in regressions when static and
dynamic index contains different set of information, e.g.
IncludeHeaders.

After this patch, we'll choose to merge symbols from static index with
dynamic one rather than just dropping. This implies correctness problems
when the definition/documentation of the symbol is deleted. But seems
like it is worth having in more cases.

We still drop symbols if dynamic index owns the file and didn't report
the symbol, which means symbol is deleted.

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

3 years ago[lldb] Add a test for Obj-C properties with conflicting names
Raphael Isemann [Tue, 30 Mar 2021 09:08:08 +0000 (11:08 +0200)]
[lldb] Add a test for Obj-C properties with conflicting names

This is apparently allowed in Objective-C so we should test this in LLDB.

Reviewed By: teemperor

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

3 years ago[ObjC][CodeGen] Fix missing debug info in situations where an instance and class...
Raphael Isemann [Tue, 30 Mar 2021 09:07:04 +0000 (11:07 +0200)]
[ObjC][CodeGen] Fix missing debug info in situations where an instance and class property have the same identifier

Since the introduction of class properties in Objective-C it is possible to declare a class and an instance
property with the same identifier in an interface/protocol.

Right now Clang just generates debug information for whatever property comes first in the source file.
The second property is ignored as it's filtered out by the set of already emitted properties (which is just
using the identifier of the property to check for equivalence).  I don't think generating debug info in this case
was never supported as the identifier filter is in place since 7123bca7fb6e1dde51be8329cfb523d2bb9ffadf
(which precedes the introduction of class properties).

This patch expands the filter to take in account identifier + whether the property is class/instance. This
ensures that both properties are emitted in this special situation.

Reviewed By: aprantl

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

3 years ago[docs] remove references to checking out svn repos
Nuno Lopes [Tue, 30 Mar 2021 09:00:31 +0000 (10:00 +0100)]
[docs] remove references to checking out svn repos

3 years agoRevert "[X86] Pass to transform tdpbsud&tdpbusd&tdpbuud intrinsics to scalar operation"
Bing1 Yu [Tue, 30 Mar 2021 08:33:07 +0000 (16:33 +0800)]
Revert "[X86] Pass to transform tdpbsud&tdpbusd&tdpbuud intrinsics to scalar operation"

This reverts commit 275df61f043ccf86a9c17957379bff9434da1489.

3 years ago[InstructionCost] Don't conflate Invalid costs with Unknown costs.
Sander de Smalen [Tue, 30 Mar 2021 07:54:59 +0000 (08:54 +0100)]
[InstructionCost] Don't conflate Invalid costs with Unknown costs.

We previously made a change to getUserCost to return a Invalid cost
when one of the TTI costs returned '-1' (meaning 'unknown' or
'infinitely expensive'). It makes no sense to say that:

  shufflevector <2 x i8> %x, <2 x i8> %y, <4 x i32> <i32 0, i32 1, i32 2, i32 3>

has an invalid cost. Perhaps the cost is not known, but the IR is valid
and can be code-generated. Invalid should only be used for IR that
cannot possibly be code-generated and where a cost is nonsensical.

With more passes now asserting that the cost must be valid, it is possible
that those assertions will fail for perfectly valid IR. An incomplete
cost-model probably shouldn't be a reason for the compiler to break.

It's better to consider these costs as 'very expensive' and ignore them
for other reasons. At some point, we should consider replacing -1 with
some other mechanism.

Reviewed By: paulwalker-arm, dmgreen

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

3 years ago[X86] Pass to transform tdpbsud&tdpbusd&tdpbuud intrinsics to scalar operation
Bing1 Yu [Wed, 24 Mar 2021 08:53:12 +0000 (16:53 +0800)]
[X86] Pass to transform tdpbsud&tdpbusd&tdpbuud intrinsics to scalar operation

Reviewed By: pengfei

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

3 years agoRevert "[lldb/DWARF] Simplify DIE extraction code slightly"
Pavel Labath [Tue, 30 Mar 2021 07:57:32 +0000 (09:57 +0200)]
Revert "[lldb/DWARF] Simplify DIE extraction code slightly"

This reverts commit 1b96e133cf5215cb9ebfe7f14630f479c1611f22 due to
failures on windows.

3 years ago[AMDGPU] Update AMDGPU PAL usage documentation
Tim Renouf [Tue, 30 Mar 2021 07:33:07 +0000 (08:33 +0100)]
[AMDGPU] Update AMDGPU PAL usage documentation

Change-Id: I65f3edcfe5063551cad5aab0da1374c3a6ccd3a2

3 years ago[lli] Add option -lljit-platform=Inactive to disable platform support explicitly
Stefan Gränitz [Tue, 30 Mar 2021 07:24:46 +0000 (09:24 +0200)]
[lli] Add option -lljit-platform=Inactive to disable platform support explicitly

This option tells LLJIT to disable platform support explicitly: JITDylibs aren't scanned for special init/deinit symbols and no runtime API interposes are injected.
It's useful in two cases: for platforms that don't have such requirements and platforms for which we have no explicit support yet and that don't work well with the generic IR platform.

Reviewed By: lhames

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

3 years ago[NFC][scudo] Produce debug info
Vitaly Buka [Tue, 30 Mar 2021 07:21:20 +0000 (00:21 -0700)]
[NFC][scudo] Produce debug info

3 years ago[llvm-profdata] Make sure to consume Error on the error path of setIsIRLevelProfile
Markus Böck [Tue, 30 Mar 2021 06:52:28 +0000 (08:52 +0200)]
[llvm-profdata] Make sure to consume Error on the error path of setIsIRLevelProfile

Encountered a crash while running a debug build, where this code path would be taken due to a mismatch in profile coverage data versions. Without consuming the error, an assert would be triggered inside the destructor of Error.

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

3 years ago[lldb] Remove ScriptInterpreterLuaTest.Plugin unittest
Pavel Labath [Sat, 27 Mar 2021 20:21:30 +0000 (21:21 +0100)]
[lldb] Remove ScriptInterpreterLuaTest.Plugin unittest

This test is not useful as the functions it's testing are just returning
a constant. It also fails in unoptimized builds as it's comparing
character strings by address.

3 years ago[lldb] Add a dwarf unit test for null unit dies
Pavel Labath [Tue, 30 Mar 2021 06:46:36 +0000 (08:46 +0200)]
[lldb] Add a dwarf unit test for null unit dies

This is the test I mentioned in the previous commit (1b96e133), but
forgot to add.

3 years ago[lldb/DWARF] Simplify DIE extraction code slightly
Pavel Labath [Sat, 27 Mar 2021 20:00:59 +0000 (21:00 +0100)]
[lldb/DWARF] Simplify DIE extraction code slightly

Remove the "depth" variable, as the same information can be obtained
through die_index_stack.size().

Also add a test case for a one tricky case I noticed -- a unit
containing only a null unit die.

3 years ago[loop-idiom] Hoist loop memcpys to loop preheader
Han Zhu [Tue, 9 Feb 2021 01:24:25 +0000 (17:24 -0800)]
[loop-idiom] Hoist loop memcpys to loop preheader

For a simple loop like:
```
struct S {
  int x;
  int y;
  char b;
};

unsigned foo(S* __restrict__ a, S* b, int n) {
  for (int i = 0; i < n; i++)
    a[i] = b[i];

  return sizeof(a[0]);
}
```
We could eliminate the loop and convert it to a large memcpy of 12*n bytes. Currently this is not handled. Output of `opt -loop-idiom -S < memcpy_before.ll`
```
%struct.S = type { i32, i32, i8 }

define dso_local i32 @_Z3fooP1SS0_i(%struct.S* noalias nocapture %a, %struct.S* nocapture readonly %b, i32 %n) local_unnamed_addr {
entry:
  %cmp7 = icmp sgt i32 %n, 0
  br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup

for.body.preheader:                               ; preds = %entry
  br label %for.body

for.cond.cleanup.loopexit:                        ; preds = %for.body
  br label %for.cond.cleanup

for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry
  ret i32 12

for.body:                                         ; preds = %for.body, %for.body.preheader
  %i.08 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
  %idxprom = zext i32 %i.08 to i64
  %arrayidx = getelementptr inbounds %struct.S, %struct.S* %b, i64 %idxprom
  %arrayidx2 = getelementptr inbounds %struct.S, %struct.S* %a, i64 %idxprom
  %0 = bitcast %struct.S* %arrayidx2 to i8*
  %1 = bitcast %struct.S* %arrayidx to i8*
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* nonnull align 4 dereferenceable(12) %0, i8* nonnull align 4 dereferenceable(12) %1, i64 12, i1 false)
  %inc = add nuw nsw i32 %i.08, 1
  %cmp = icmp slt i32 %inc, %n
  br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit
}

; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0

attributes #0 = { argmemonly nofree nosync nounwind willreturn }

```
The loop idiom pass currently only handles load and store instructions. Since struct S is too big to fit in a register, the loop body contains a memcpy intrinsic.

With this change, re-run `opt -loop-idiom -S < memcpy_before.ll`. The loop memcpy is promoted to loop preheader. For this trivial case, the loop is dead and will be removed by another pass.
```
%struct.S = type { i32, i32, i8 }

define dso_local i32 @_Z3fooP1SS0_i(%struct.S* noalias nocapture %a, %struct.S* nocapture readonly %b, i32 %n) local_unnamed_addr {
entry:
  %a1 = bitcast %struct.S* %a to i8*
  %b2 = bitcast %struct.S* %b to i8*
  %cmp7 = icmp sgt i32 %n, 0
  br i1 %cmp7, label %for.body.preheader, label %for.cond.cleanup

for.body.preheader:                               ; preds = %entry
  %0 = zext i32 %n to i64
  %1 = mul nuw nsw i64 %0, 12
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 %a1, i8* align 4 %b2, i64 %1, i1 false)
  br label %for.body

for.cond.cleanup.loopexit:                        ; preds = %for.body
  br label %for.cond.cleanup

for.cond.cleanup:                                 ; preds = %for.cond.cleanup.loopexit, %entry
  ret i32 12

for.body:                                         ; preds = %for.body, %for.body.preheader
  %i.08 = phi i32 [ %inc, %for.body ], [ 0, %for.body.preheader ]
  %idxprom = zext i32 %i.08 to i64
  %arrayidx = getelementptr inbounds %struct.S, %struct.S* %b, i64 %idxprom
  %arrayidx2 = getelementptr inbounds %struct.S, %struct.S* %a, i64 %idxprom
  %2 = bitcast %struct.S* %arrayidx2 to i8*
  %3 = bitcast %struct.S* %arrayidx to i8*
  %inc = add nuw nsw i32 %i.08, 1
  %cmp = icmp slt i32 %inc, %n
  br i1 %cmp, label %for.body, label %for.cond.cleanup.loopexit
}

; Function Attrs: argmemonly nofree nosync nounwind willreturn
declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0

attributes #0 = { argmemonly nofree nosync nounwind willreturn }
```

Reviewed By: zino

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

3 years agoRevert "[loop-idiom] Hoist loop memcpys to loop preheader"
Han Zhu [Tue, 30 Mar 2021 06:35:10 +0000 (23:35 -0700)]
Revert "[loop-idiom] Hoist loop memcpys to loop preheader"

This reverts commit deb5095833a834e0ef5f784138da53e66febff05.

Bad commit message.

3 years ago[DebugInfo][unittest] Fix heap-use-after-free after D76115
Fangrui Song [Tue, 30 Mar 2021 06:31:14 +0000 (23:31 -0700)]
[DebugInfo][unittest] Fix heap-use-after-free after D76115

3 years ago[loop-idiom] Hoist loop memcpys to loop preheader
Han Zhu [Tue, 9 Feb 2021 01:24:25 +0000 (17:24 -0800)]
[loop-idiom] Hoist loop memcpys to loop preheader

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Blame Revision:

Differential Revision: https://phabricator.intern.facebook.com/D26380397

3 years ago[OpenMP][NFC] Move the `noinline` to the parallel entry point
Johannes Doerfert [Mon, 29 Mar 2021 01:13:38 +0000 (20:13 -0500)]
[OpenMP][NFC] Move the `noinline` to the parallel entry point

The `noinline` for non-SPMD parallel functions is probably not necessary
but as long as we use it we should put it on the outermost parallel
function, which is the wrapper, not the actual outlined function.

Resolves PR49752

Reviewed By: JonChesterfield

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

3 years ago[Test] Add a test demonstrating a missing opportunity to PRE a load
Max Kazantsev [Tue, 30 Mar 2021 05:27:33 +0000 (12:27 +0700)]
[Test] Add a test demonstrating a missing opportunity to PRE a load

3 years ago[sanitizer] Improve accuracy of GetTls on x86/s390
Fangrui Song [Tue, 30 Mar 2021 05:14:29 +0000 (22:14 -0700)]
[sanitizer] Improve accuracy of GetTls on x86/s390

The previous code may underestimate the static TLS surplus part, which may cause
false positives to LeakSanitizer if a dynamically loaded module uses the surplus
and there is an allocation only referenced by a thread's TLS.

3 years ago[NFC][scudo] Sort sources in CMake file
Vitaly Buka [Tue, 30 Mar 2021 02:41:47 +0000 (19:41 -0700)]
[NFC][scudo] Sort sources in CMake file

3 years ago[NFC][scudo] Add memtag.h into CMake file
Vitaly Buka [Tue, 30 Mar 2021 02:39:35 +0000 (19:39 -0700)]
[NFC][scudo] Add memtag.h into CMake file

3 years ago[DebugInfo] Upgrade DISubragne::count to accept DIExpression also
Alok Kumar Sharma [Thu, 25 Mar 2021 11:04:57 +0000 (16:34 +0530)]
[DebugInfo] Upgrade DISubragne::count to accept DIExpression also

This is needed for Fortran assumed shape arrays whose dimensions are
defined as,
  - 'count' is taken from array descriptor passed as parameter by
    caller, access from descriptor is defined by type DIExpression.
  - 'lowerBound' is defined by callee.
The current alternate way represents using upperBound in place of
count, where upperBound is calculated in callee in a temp variable
using lowerBound and count

Representation with count (DIExpression) is not only clearer as
compared to upperBound (DIVariable) but it has another advantage that
variable count is accessed by being parameter has better chance of
survival at higher optimization level than upperBound being local
variable.

Reviewed By: aprantl

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

3 years ago[Propeller] Do not generate the BB address map for empty functions.
Rahman Lavaee [Fri, 26 Mar 2021 01:44:00 +0000 (18:44 -0700)]
[Propeller] Do not generate the BB address map for empty functions.

Empty functions (functions with no real code) are irrelevant for propeller optimizations and their addresses sometimes conflict with other functions which obfuscates the analysis.
This simple change skips the BB address map emission for such functions.

Reviewed By: tmsriram

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

3 years agoRevert "Add missing dependency to fix building the jit tests"
Stella Stamenova [Tue, 30 Mar 2021 03:06:31 +0000 (20:06 -0700)]
Revert "Add missing dependency to fix building the jit tests"

This breaks the windows bots because the dependency does not exist on Windows.
Per the cmake file:

if(CMAKE_HOST_UNIX)
  add_subdirectory(LLJITWithRemoteDebugging)
endif()

This reverts commit bd56e91fdbc65053dd08cca1f2c9e15087c062eb.

3 years ago[NFC][SVE] Remove redundant pattern
Jun Ma [Mon, 29 Mar 2021 06:24:47 +0000 (14:24 +0800)]
[NFC][SVE] Remove redundant pattern

3 years ago[AArch64][SVE] Codegen dup_lane for dup(vector_extract)
Jun Ma [Mon, 29 Mar 2021 06:19:13 +0000 (14:19 +0800)]
[AArch64][SVE] Codegen dup_lane for dup(vector_extract)

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

3 years ago[AArch64][SVEIntrinsicOpts] Optimize tbl+dup into dup+extractelement
Jun Ma [Fri, 26 Mar 2021 07:55:46 +0000 (15:55 +0800)]
[AArch64][SVEIntrinsicOpts] Optimize tbl+dup into dup+extractelement

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

3 years agoRevert "[COFF] Only consider associated EH sections during ICF"
Amy Huang [Tue, 30 Mar 2021 02:10:09 +0000 (19:10 -0700)]
Revert "[COFF] Only consider associated EH sections during ICF"

This change causes an asan error for ODR violation.

This reverts commit 7ce9a3e9a91bb0c71cd3560079ff4c31d5dade1b.

3 years ago[libc++] Re-enable macOS back-deployment testing
Louis Dionne [Thu, 25 Mar 2021 18:14:20 +0000 (14:14 -0400)]
[libc++] Re-enable macOS back-deployment testing

Download older roots from Dropbox instead of Green Dragon, which is too
unreliable. Also XFAIL tests that were broken for back-deployment
configurations by D98097.

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

3 years ago[RISCV] Add inline asm constraint 'vr' and 'vm' in Clang for RISC-V 'V'.
Hsiangkai Wang [Mon, 29 Mar 2021 10:27:27 +0000 (18:27 +0800)]
[RISCV] Add inline asm constraint 'vr' and 'vm' in Clang for RISC-V 'V'.

Add asm constraint 'vr' for vector registers.
Add asm constraint 'vm' for vector mask registers.

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

3 years ago[RISCV] Move scheduling resources for B into a separate file (NFC)
Evandro Menezes [Tue, 30 Mar 2021 01:02:05 +0000 (20:02 -0500)]
[RISCV] Move scheduling resources for B into a separate file (NFC)

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

3 years agoAdd debug support for set types
Adrian Prantl [Mon, 29 Mar 2021 22:02:25 +0000 (15:02 -0700)]
Add debug support for set types

This commit adds debugging support for set types defined in languages
such as Pascal and Modula-2.

Patch by Peter McKinna!

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

3 years ago[llvm][utils] Fix handling of llvm::None
Dave Lee [Mon, 29 Mar 2021 22:59:05 +0000 (15:59 -0700)]
[llvm][utils] Fix handling of llvm::None

3 years agoAdd missing dependency to fix building the jit tests
David Blaikie [Mon, 29 Mar 2021 23:11:38 +0000 (16:11 -0700)]
Add missing dependency to fix building the jit tests

3 years ago[WebAssembly] Fix i8x16.popcnt opcode
Thomas Lively [Tue, 30 Mar 2021 00:23:15 +0000 (17:23 -0700)]
[WebAssembly] Fix i8x16.popcnt opcode

When I updated the SIMD opcodes in f5764a8654e3, I accidentally missed updating
i8x16.popcnt. This patch fixes the omission.

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

3 years ago[dsymutil] s/dwarfdump/llvm-dwarfdump/ in test
Jonas Devlieghere [Tue, 30 Mar 2021 00:14:35 +0000 (17:14 -0700)]
[dsymutil] s/dwarfdump/llvm-dwarfdump/ in test

3 years ago[IPO][SampleContextTracker] Use SmallVector to track context profiles to prevent...
Huihui Zhang [Mon, 29 Mar 2021 23:37:01 +0000 (16:37 -0700)]
[IPO][SampleContextTracker] Use SmallVector to track context profiles to prevent non-determinism.

Use SmallVector instead of SmallSet to track the context profiles mapped. Doing this
can help avoid non-determinism caused by iterating over unordered containers.

This bug was found with reverse iteration turning on,
--extra-llvm-cmake-variables="-DLLVM_REVERSE_ITERATION=ON".
Failing LLVM test profile-context-tracker-debug.ll .

Reviewed By: MaskRay, wenlei

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

3 years ago[AArch64][GlobalISel] NFC: Replace IR regbankselect test with MIR test
Jessica Paquette [Mon, 29 Mar 2021 23:29:10 +0000 (16:29 -0700)]
[AArch64][GlobalISel] NFC: Replace IR regbankselect test with MIR test

regbank-ceil.ll -> regbank-ceil.mir

The IR test was intended to only check register banks. This makes it brittle,
especially as we improve load/store combines in GlobalISel.

Rewriting this as a MIR test also makes it more consistent with the rest of
the testcases in GlobalISel.

3 years ago[dsymutil] Relocate DW_TAG_label
Jonas Devlieghere [Mon, 29 Mar 2021 19:35:17 +0000 (12:35 -0700)]
[dsymutil] Relocate DW_TAG_label

dsymutil is not relocating the DW_AT_low_pc for a DW_TAG_label. This
patch fixes that and adds a test.

Differential revision: https://reviews.llvm.org/D99534

3 years ago[lldb] Prints error using WithColor::error in lldb-platform
Jonas Devlieghere [Mon, 29 Mar 2021 22:29:28 +0000 (15:29 -0700)]
[lldb] Prints error using WithColor::error in lldb-platform

3 years agoFix .debug_aranges parsing issues.
Greg Clayton [Fri, 26 Mar 2021 07:48:49 +0000 (00:48 -0700)]
Fix .debug_aranges parsing issues.

When LLVM error handling was introduced to the parsing of the .debug_aranges it would cause major issues if any DWARFDebugArangeSet::extract() calls returned any errors. The code in DWARFDebugInfo::GetCompileUnitAranges() would end up calling DWARFDebugAranges::extract() which would return an error if _any_ DWARFDebugArangeSet had any errors, but it default constructed a DWARFDebugAranges object into DWARFDebugInfo::m_cu_aranges_up and populated it partially, and returned an error prior to finishing much needed functionality in the DWARFDebugInfo::GetCompileUnitAranges() function. Subsequent callers to this function would see that the DWARFDebugInfo::m_cu_aranges_up was actually valid and return this partially populated DWARFDebugAranges reference _and_ it would not be sorted or minimized.

This above bugs would cause an incomplete .debug_aranges parsing, it would skip manually parsing any compile units for ranges, and would not sort the DWARFDebugAranges in m_cu_aranges_up.

This bug would also cause breakpoints set by file and line to fail to set correctly if a symbol context for an address could not be resolved properly, which the incomplete and unsorted DWARFDebugAranges object that DWARFDebugInfo::GetCompileUnitAranges() returned would cause symbol context lookups resolved by address (breakpoint address) to fail to find any DWARF debug info for a given address.

This patch fixes all of the issues that I found:
- DWARFDebugInfo::GetCompileUnitAranges() no longer returns a "llvm::Expected<DWARFDebugAranges &>", but just returns a "const DWARFDebugAranges &". Why? Because this code contained a fallback that would parse all of the valid DWARFDebugArangeSet objects, and would check which compile units had valid .debug_aranges set entries, and manually build an address ranges table using DWARFUnit::BuildAddressRangeTable(). If we return an error because any DWARFDebugArangeSet has any errors, then we don't do any of this code. Now we parse all DWARFDebugArangeSet objects that have no errors, if any calls to DWARFDebugArangeSet::extract() return errors, we skip that DWARFDebugArangeSet so that we can use the fallback call to DWARFUnit::BuildAddressRangeTable(). Since DWARFDebugInfo::GetCompileUnitAranges() needs to parse what it can from the .debug_aranges and build address ranges tables for any compile units that don't have any .debug_aranges sets, everything now works as expected.
- Fix an issue where a DWARFDebugArangeSet contains multiple terminator entries. The LLVM parser and llvm-dwarfdump properly warn about this because it happens with linux compilers and linkers and was the original cause of the bug I am fixing here. We now correctly warn about this issue if "log enable dwarf info" is enabled, but we continue to parse the DWARFDebugArangeSet correctly so we don't lose data that is contained in the .debug_aranges section.
- DWARFDebugAranges::extract() no longer returns a llvm::Error because we need to be able to parse all of the valid DWARFDebugArangeSet objects. It also will correctly skip a DWARFDebugArangeSet object that has errors in the middle of the stream by setting the start offsets of each DWARFDebugArangeSet to be calculated by the previous DWARFDebugArangeSet::extract() calculated offset that uses the header which contains the length of the DWARFDebugArangeSet. This means if do we run into real errors while parsing individual DWARFDebugArangeSet objects, we can continue to parse the rest of the validly encoded DWARFDebugArangeSet objects in the .debug_aranges section. This will allow LLDB to parse DWARF that contains a possibly newer .debug_aranges set format than LLDB currently supports because we will error out for the parsing of the DWARFDebugArangeSet, but be able to skip to the next DWARFDebugArangeSet object using the "DWARFDebugArangeSet.m_header.length" field to calculate the next starting offset.

Tests were added to cover all new functionality.

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

3 years ago[gn build] Port 5178ffc7cf92
LLVM GN Syncbot [Mon, 29 Mar 2021 22:12:00 +0000 (22:12 +0000)]
[gn build] Port 5178ffc7cf92

3 years ago[Passes] Add relative lookup table converter pass
Gulfem Savrun Yeniceri [Tue, 29 Dec 2020 21:32:13 +0000 (21:32 +0000)]
[Passes] Add relative lookup table converter pass

Lookup tables generate non PIC-friendly code, which requires dynamic relocation as described in:
https://bugs.llvm.org/show_bug.cgi?id=45244

This patch adds a new pass that converts lookup tables to relative lookup tables to make them PIC-friendly.

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

3 years ago[AArch64] Remove custom zext/sext legalization code.
Florian Hahn [Mon, 29 Mar 2021 19:19:45 +0000 (20:19 +0100)]
[AArch64] Remove custom zext/sext legalization code.

Currently performExtendCombine assumes that the src-element bitwidth * 2
is a valid MVT. But this is not the case for i1 and it causes a crash on
the v64i1 test cases added in this patch.

It turns out that this code appears to not be needed; the same patterns are
handled by other code and we end up with the same results, even without the
custom lowering. I also added additional test cases in a50037aaa6d5df.

Let's just remove the unneeded code.

Reviewed By: dmgreen

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

3 years ago[lldb] Print stack trace when lldb-vscode crashes
Jonas Devlieghere [Mon, 29 Mar 2021 21:19:03 +0000 (14:19 -0700)]
[lldb] Print stack trace when lldb-vscode crashes

Print LLVM's pretty stack trace when lldb-vscode crashes. Also removes
the unnecessary call to PrintStackTraceOnErrorSignal in lldb-server as
it's already part of InitLLVM.

Differential revision: https://reviews.llvm.org/D99535

3 years ago[X86][FastISel] Fix with.overflow eflags clobber (PR49587)
Nikita Popov [Sun, 14 Mar 2021 15:47:41 +0000 (16:47 +0100)]
[X86][FastISel] Fix with.overflow eflags clobber (PR49587)

If the successor block has a phi node, then additional moves may
be inserted into predecessors, which may clobber eflags. Don't try
to fold the with.overflow result into the branch in that case.

This is done by explicitly checking for any phis in successor
blocks, not sure if there's some more principled way to address
this. Other fused compare and branch patterns avoid the issue by
emitting the comparison when handling the branch, so that no
instructions may be inserted in between. In this case, the
with.overflow call is emitted separately (and I don't think this
is avoidable, as it will generally have at least two users).

Fixes https://bugs.llvm.org/show_bug.cgi?id=49587.

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

3 years ago[NFC] clang-formatting zos-alignment.c
Fanbo Meng [Mon, 29 Mar 2021 20:47:57 +0000 (16:47 -0400)]
[NFC] clang-formatting zos-alignment.c

Reviewed By: abhina.sreeskantharajan

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

3 years ago[lsan] realloc: don't deallocate if requested size is too large
Fangrui Song [Mon, 29 Mar 2021 20:35:10 +0000 (13:35 -0700)]
[lsan] realloc: don't deallocate if requested size is too large

This is the behavior required by the standards.

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

3 years agoRevert "[CMake] Use write_basic_package_version_file for LLVM"
Petr Hosek [Mon, 29 Mar 2021 20:07:39 +0000 (13:07 -0700)]
Revert "[CMake] Use write_basic_package_version_file for LLVM"

This reverts commit 3001d080c813da20b329303bf8f45451480e5905 which
seems to have introduced a race condition that's failing the build
in some cases.

3 years agoFix broken build for commit 9b0517035faee275ce1feabb03d0c7606ea7f819
MaheshRavishankar [Mon, 29 Mar 2021 19:33:26 +0000 (12:33 -0700)]
Fix broken build for commit 9b0517035faee275ce1feabb03d0c7606ea7f819

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

3 years agofix comment typo to cycle bots
Nico Weber [Mon, 29 Mar 2021 19:47:13 +0000 (15:47 -0400)]
fix comment typo to cycle bots

3 years ago[AMDGPU] Fix "Sequence" spelling. NFC.
Stanislav Mekhanoshin [Mon, 29 Mar 2021 18:37:07 +0000 (11:37 -0700)]
[AMDGPU] Fix "Sequence" spelling. NFC.

3 years ago[llvm-reduce] Remove dso_local when possible
Samuel [Mon, 29 Mar 2021 04:18:45 +0000 (21:18 -0700)]
[llvm-reduce] Remove dso_local when possible

Add a new delta pass to llvm-reduce that removes dso_local when possible

Reviewed By: aeubanks

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

3 years ago[libcxx] Use integer division
Petr Hosek [Mon, 29 Mar 2021 17:49:55 +0000 (10:49 -0700)]
[libcxx] Use integer division

In Python 3, math.floor returns int when both arguments are ints.
In Python 2, math.floor returns float. This leads to a failure
because the result of math.floor is used as an array index. While
Python 2 is on its way out, it's still used in some places so use
an integer division instead.

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

3 years agoRevert "[AMDGPU] Mark additional VOP3 as commutable"
Joe Nash [Mon, 29 Mar 2021 18:43:19 +0000 (14:43 -0400)]
Revert "[AMDGPU] Mark additional VOP3 as commutable"

This reverts commit d35d8da7d6ac6c08578ec0569b072292631691e0.

3 years agofix comment typo to cycle bots
Nico Weber [Mon, 29 Mar 2021 18:40:43 +0000 (14:40 -0400)]
fix comment typo to cycle bots

3 years ago[lsan][test] Add malloc(0) and realloc(p, 0) tests
Fangrui Song [Mon, 29 Mar 2021 18:41:07 +0000 (11:41 -0700)]
[lsan][test] Add malloc(0) and realloc(p, 0) tests

3 years ago[mlir] Enhance InferShapedTypeOpInterface and move LinalgOps to use them.
MaheshRavishankar [Mon, 29 Mar 2021 17:57:23 +0000 (10:57 -0700)]
[mlir] Enhance InferShapedTypeOpInterface and move LinalgOps to use them.

A new `InterfaceMethod` is added to `InferShapedTypeOpInterface` that
allows an operation to return the `Value`s for each dim of its
results. It is intended for the case where the `Value` returned for
each dim is computed using the operands and operation attributes. This
interface method is for cases where the result dim of an operation can
be computed independently, and it avoids the need to aggregate all
dims of a result into a single shape value. This also implies that
this is not suitable for cases where the result type is unranked (for
which the existing interface methods is to be used).

Also added is a canonicalization pattern that uses this interface and
resolves the shapes of the output in terms of the shapes of the
inputs. Moving Linalg ops to use this interface, so that many
canonicalization patterns implemented for individual linalg ops to
achieve the same result can be removed in favor of the added
canonicalization pattern.

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

3 years agofix comment typo to cycle bots
Nico Weber [Mon, 29 Mar 2021 18:35:57 +0000 (14:35 -0400)]
fix comment typo to cycle bots

3 years agoNFC: Update MLIR python bindings docs to install deps via requirements.txt.
Stella Laurenzo [Mon, 29 Mar 2021 18:30:50 +0000 (18:30 +0000)]
NFC: Update MLIR python bindings docs to install deps via requirements.txt.

* Also adds some verbiage about upgrading `pip` itself, since this is a
  common source of issues.

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

3 years ago[AMDGPU] Mark additional VOP3 as commutable
Joe Nash [Tue, 23 Mar 2021 15:33:38 +0000 (11:33 -0400)]
[AMDGPU] Mark additional VOP3 as commutable

Note, only src0 and src1 will be commuted if the isCommutable flag
is set. This patch does not change that, it just makes it possible
to commute src0 and src1 of more instructions.

Reviewed By: foad, rampitec

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

Change-Id: I61e20490962d95ea429beb355c55f55c024dafdc

3 years ago[lld-macho] Implement -segprot
Jez Ng [Mon, 29 Mar 2021 18:08:12 +0000 (14:08 -0400)]
[lld-macho] Implement -segprot

Addresses llvm.org/PR49405.

Reviewed By: #lld-macho, oontvoo

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