platform/upstream/llvm.git
2 years ago[llvm] Use StringRef::contains (NFC)
Kazu Hirata [Sat, 23 Oct 2021 15:45:27 +0000 (08:45 -0700)]
[llvm] Use StringRef::contains (NFC)

2 years ago[Orc][examples] Re-enable test for LLJITWithRemoteDebugging
Stefan Gränitz [Sat, 23 Oct 2021 13:54:38 +0000 (15:54 +0200)]
[Orc][examples] Re-enable test for LLJITWithRemoteDebugging

The test was removed temporarily in a539a847c9428e36722dcb43a1c953c9d66b7f0b to aid switching the RPC API in use in the LLJITWithRemoteDebugging example.

Reviewed By: lhames

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

2 years ago[ConstantFolding] Remove ConstantFoldLoadThroughGEPIndices() API (NFC)
Nikita Popov [Sat, 23 Oct 2021 14:58:09 +0000 (16:58 +0200)]
[ConstantFolding] Remove ConstantFoldLoadThroughGEPIndices() API (NFC)

The last user of this API went away in
4f5e9a2bb28e1cf4a12c9330f52e664542400ec7.

2 years agoRevert "[mlir][Linalg] NFC - Reorganize options nesting."
Nicolas Vasilache [Sat, 23 Oct 2021 13:46:22 +0000 (13:46 +0000)]
Revert "[mlir][Linalg] NFC - Reorganize options nesting."

This reverts commit 4703a07e6cc170666abb62d91307978ab4992d9c.

Didnt' mean to push this yet, sorry about the noise.

2 years ago[SCEV] Remove computeLoadConstantCompareExitLimit() (NFCI)
Nikita Popov [Fri, 22 Oct 2021 19:35:08 +0000 (21:35 +0200)]
[SCEV] Remove computeLoadConstantCompareExitLimit() (NFCI)

The functionality of this method is already covered by
computeExitCountExhaustively() in a more general fashion. It was
added at a time when exhaustive exit count calculation did not
support constant folding loads yet. I double checked that dropping
this code causes no binary changes in test-suite.

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

2 years ago[mlir][Linalg] NFC - Reorganize options nesting.
Nicolas Vasilache [Sat, 23 Oct 2021 13:01:40 +0000 (13:01 +0000)]
[mlir][Linalg] NFC - Reorganize options nesting.

This removes duplication and makes nesting more clear.
It also reduces the amount of changes necessary for exposing future options.

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

2 years ago[mlir] Add polynomial approximation for vectorized math::Rsqrt
Emilio Cota [Sat, 23 Oct 2021 11:48:24 +0000 (04:48 -0700)]
[mlir] Add polynomial approximation for vectorized math::Rsqrt

This patch adds a polynomial approximation that matches the
approximation in Eigen.

Note that the approximation only applies to vectorized inputs;
the scalar rsqrt is left unmodified.

The approximation is protected with a flag since it emits an AVX2
intrinsic (generated via the X86Vector). This is the only reasonably
clean way that I could find to generate the exact approximation that
I wanted (i.e. an identical one to Eigen's).

I considered two alternatives:

1. Introduce a Rsqrt intrinsic in LLVM, which doesn't exist yet.
   I believe this is because there is no definition of Rsqrt that
   all backends could agree on, since hardware instructions that
   implement it have widely varying degrees of precision.
   This is something that the standard could mandate, but Rsqrt is
   not part of IEEE754, so I don't think this option is feasible.

2. Emit fdiv(1.0, sqrt) with fast math flags to allow reciprocal
   transformations. Although portable, this doesn't allow us
   to generate exactly the code we want; it is the LLVM backend,
   and not MLIR, who controls what code is generated based on the
   target CPU.

Reviewed By: ezhulenev

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

2 years ago[www] Fix Ninja build instructions on Windows
Frederik Seiffert [Sat, 23 Oct 2021 10:37:36 +0000 (16:07 +0530)]
[www] Fix Ninja build instructions on Windows

The `clang` target used in the line below is only generated with `LLVM_ENABLE_PROJECTS=clang`.

Without this change, running `ninja clang` will fail with:
```
ninja: error: unknown target 'clang', did you mean 'clean'?
```

Reviewed By: xgupta

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

2 years ago[lldb] [Host/SerialPort] Fix build with GCC 7
Martin Storsjö [Sat, 23 Oct 2021 09:52:55 +0000 (12:52 +0300)]
[lldb] [Host/SerialPort] Fix build with GCC 7

2 years ago[lldb] [Host/FreeBSD] Remove unused variable (NFC)
Michał Górny [Sat, 23 Oct 2021 09:38:11 +0000 (11:38 +0200)]
[lldb] [Host/FreeBSD] Remove unused variable (NFC)

2 years ago[clang-tidy] Tidy up spelling, grammar, and inconsistencies in documentation (NFC)
Salman Javed [Sat, 23 Oct 2021 07:07:36 +0000 (00:07 -0700)]
[clang-tidy] Tidy up spelling, grammar, and inconsistencies in documentation (NFC)

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

2 years ago[NFC] Correct arc draft option
Shivam Gupta [Sat, 23 Oct 2021 06:51:31 +0000 (12:21 +0530)]
[NFC] Correct arc draft option

2 years ago[X86] Don't add implicit REP prefix to VIA PadLock xstore
Jessica Clarke [Sat, 23 Oct 2021 00:56:05 +0000 (01:56 +0100)]
[X86] Don't add implicit REP prefix to VIA PadLock xstore

Commit 8fa3e8fa1492 added an implicit REP prefix to all VIA PadLock
instructions, but GNU as doesn't add one to xstore, only all the others.
This resulted in a kernel panic regression in FreeBSD upon updating to
LLVM 11 (https://bugs.freebsd.org/259218) which includes the commit in
question. This partially reverts that commit.

Reviewed By: craig.topper

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

2 years ago[NFC][X86] Add MC tests for all untested VIA PadLock instructions
Jessica Clarke [Sat, 23 Oct 2021 00:55:56 +0000 (01:55 +0100)]
[NFC][X86] Add MC tests for all untested VIA PadLock instructions

We currently only test the encoding of xstore but none of the other
instructions, which should all have their implicit REP prefix be
verified as working.

Reviewed By: craig.topper

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

2 years ago[flang] Fix buildbot (new warnings on old code)
peter klausler [Fri, 22 Oct 2021 23:39:16 +0000 (16:39 -0700)]
[flang] Fix buildbot (new warnings on old code)

The clang-aarch64-full-2stage buildbot is complaining about a
warning with three instances in f18 code (none modified recently).
The warning is for using the | bitwise OR operator on bool operands.

In one instance, the bitwise operator was being used instead of the
logical || operator in order to avoid short-circuting.  The fix
requires using some temporary variables.  In the other two instances,
the bitwise operator seemed more idiomatic in context, but can be
replaced without harm with the logical operator.

Pushing without review as confidence is high and nobody wants
a buildbot to stay sad for long.

2 years ago[tools, utils] Use StringRef::contains (NFC)
Kazu Hirata [Sat, 23 Oct 2021 00:22:13 +0000 (17:22 -0700)]
[tools, utils] Use StringRef::contains (NFC)

2 years ago[gn build] Port e18ea6f2946a
LLVM GN Syncbot [Fri, 22 Oct 2021 23:26:01 +0000 (23:26 +0000)]
[gn build] Port e18ea6f2946a

2 years agoSupport: Skip buffering buffer_unique_ostream's owned stream
Duncan P. N. Exon Smith [Thu, 23 Sep 2021 03:31:43 +0000 (23:31 -0400)]
Support: Skip buffering buffer_unique_ostream's owned stream

Change buffer_unique_ostream's constructor to call
raw_ostream::SetUnbuffered() on its owned stream. Otherwise,
buffer_unique_ostream's destructor could cause the owned stream to
temporarily allocate a buffer only to be immediately flushed.

Also add some tests for buffer_ostream and buffer_unique_ostream. Use
the same naming scheme as other raw_ostream-related tests (e.g.,
`raw_ostreamTest` for the fixture, `raw_ostream_test.cpp` for the
filename).

(I considered changing buffer_ostream in the same way (calling
SetUnbuffered on the referenced stream), but that seemed like overreach
since the client may have more things to write.)

(I considered merging buffer_ostream and buffer_unique_ostream into a
single class (with a `raw_ostream&` and a `std::unique_ptr` that is only
sometimes used), but that makes the class bigger and the small amount of
code deduplication seems uncompelling.)

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

2 years ago[flang] Support legacy usage of 'A' edit descriptors for integer & real
peter klausler [Thu, 21 Oct 2021 20:33:07 +0000 (13:33 -0700)]
[flang] Support legacy usage of 'A' edit descriptors for integer & real

The 'A' edit descriptor once served as a form of raw I/O of bytes
to/from variables that weren't of type CHARACTER (which itself
didn't exist until F'77).  This usage was especially common for
output of numeric variables that had been initialized with Hollerith.

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

2 years ago[flang] Fix NAMELIST input bug with multiple subscript triplets
peter klausler [Thu, 21 Oct 2021 21:13:21 +0000 (14:13 -0700)]
[flang] Fix NAMELIST input bug with multiple subscript triplets

NAMELIST input can contain array subscripts with triplet notation.
The calculation of the default effective stride for the constructed
array descriptor was simply incorrect after the first dimension.

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

2 years ago[flang] Fix DOT_PRODUCT for logical
peter klausler [Thu, 21 Oct 2021 19:47:46 +0000 (12:47 -0700)]
[flang] Fix DOT_PRODUCT for logical

A build-time check in a template class instantiation was applying
a test that's meaningful only for numeric types.

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

2 years ago[flang] Extension: allow tabs in output format strings
peter klausler [Thu, 21 Oct 2021 21:47:55 +0000 (14:47 -0700)]
[flang] Extension: allow tabs in output format strings

A CHARACTER variable used as an output format may contain
unquoted tab characters, which are treated as if they had
been quoted.  This is an extension supported by all other
Fortran compilers to which I have access.

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

2 years ago[flang] Fix crash on empty formatted external READs
peter klausler [Fri, 22 Oct 2021 19:22:42 +0000 (12:22 -0700)]
[flang] Fix crash on empty formatted external READs

ExternalFileUnit::BeginReadingRecord() must be called at least once
during an external formatted READ statement before FinishReadingRecord().
In the case of a formatted external READ with no data items, the call
to finish processing of the format (which might have lingering control
items that need doing) was taking place before the call to BeginReadingRecord
from ExternalIoStatementState::EndIoStatement.  Add a call to
BeginReadingRecord on this path.

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

2 years ago[libomptarget] Run GPU offloading tests on both new and old runtime
Jon Chesterfield [Fri, 22 Oct 2021 22:28:42 +0000 (23:28 +0100)]
[libomptarget] Run GPU offloading tests on both new and old runtime

Implemented by patching python config instead of modifying all
the tests so that -generic and XFAIL work as usual. Expectation is for
this to be reverted once the old runtime is deleted.

Reviewed By: Meinersbur

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

2 years ago[BasicAA] Model implicit trunc of GEP indices
Nikita Popov [Wed, 29 Sep 2021 20:18:54 +0000 (22:18 +0200)]
[BasicAA] Model implicit trunc of GEP indices

GEP indices larger than the GEP index size are implicitly truncated
to the index size. BasicAA currently doesn't model this, resulting
in incorrect alias analysis results.

Fix this by explicitly modelling truncation in CastedValue in the
same way we do zext and sext. Additionally we need to disable a
number of optimizations for truncated values, in particular
"non-zero" and "non-equal" may no longer hold after truncation.
I believe the constant offset heuristic is also not necessarily
correct for truncated values, but wasn't able to come up with a
test for that one.

A possible followup here would be to use the new mechanism to
model explicit trunc as well (which should be much more common,
as it is the canonical form). This is straightforward, but omitted
here to separate the correctness fix from the analysis improvement.

(Side note: While I say "index size" above, BasicAA currently uses
the pointer size instead. Something for another day...)

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

2 years ago[flang] Speed common runtime cases of DOT_PRODUCT & MATMUL
Peter Klausler [Tue, 19 Oct 2021 18:30:45 +0000 (11:30 -0700)]
[flang] Speed common runtime cases of DOT_PRODUCT & MATMUL

Look for contiguous numeric argument arrays at runtime and
use specialized code for them.

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

2 years ago[flang] Fix generic resolution case
peter klausler [Tue, 19 Oct 2021 18:34:57 +0000 (11:34 -0700)]
[flang] Fix generic resolution case

Don't try to convert INTEGER argument expressions to the kind of
the dummy argument when performing generic resolution; specific
procedures may be distinguished only by their kinds.

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

2 years ago[flang] Support NAMELIST input of short arrays
peter klausler [Wed, 20 Oct 2021 20:56:47 +0000 (13:56 -0700)]
[flang] Support NAMELIST input of short arrays

NAMELIST array input does not need to fully define an array.
If another input item begins after at least one element,
it ends input into the array and the remaining items are
not modified.

The tricky part of supporting this feature is that it's not
always easy to determine whether the next non-blank thing in
the input is a value or the next item's name, esp. in the case
of logical data where T and F can be names.  E.g.,

  &group logicalArray = t f f t
      = 1 /

should read three elements into "logicalArray" and then read
an integer or real variable named "t".

So the I/O runtime has to do some look-ahead to determine whether
the next thing in the input is a name followed by '=', '(', or '%'.
Since the '=' may be on a later record, possibly with intervening
NAMELIST comments, the runtime has to support a general form of
saving and restoring its current position.  The infrastructure
in the I/O runtime already has to support repositioning for
list-directed repetition, even on non-positionable input sources
like terminals and sockets; this patch adds an internal RAII API
to make it easier to save a position and then do arbitrary
look-ahead.

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

2 years ago[lld-macho] Implement -oso_prefix
Vy Nguyen [Fri, 22 Oct 2021 02:38:12 +0000 (22:38 -0400)]
[lld-macho] Implement -oso_prefix

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

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

2 years ago[mlir][Linalg] Retire CodegenStrategy::transform
Nicolas Vasilache [Fri, 22 Oct 2021 12:04:32 +0000 (12:04 +0000)]
[mlir][Linalg] Retire CodegenStrategy::transform

Instead each pass should constructed a nested OpPassManager and runPipeline on that.

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

2 years agoFix locals naming in DNBArchMachARM64::GetGPRState for 32-bit builds
Jason Molenda [Fri, 22 Oct 2021 20:23:06 +0000 (13:23 -0700)]
Fix locals naming in DNBArchMachARM64::GetGPRState for 32-bit builds

The local variables names used for logging when built on armv7k
weren't unique, resulting in build error.

rdar://84274006

2 years agoAMDGPU: Use attributor to propagate amdgpu-flat-work-group-size
Matt Arsenault [Thu, 9 Sep 2021 23:57:12 +0000 (19:57 -0400)]
AMDGPU: Use attributor to propagate amdgpu-flat-work-group-size

This can merge the acceptable ranges based on the call graph, rather
than the simple application of the attribute. Remove the handling from
the old pass.

2 years agoAMDGPU: Don't consider whether amdgpu-flat-work-group-size was set
Matt Arsenault [Sat, 11 Sep 2021 02:18:54 +0000 (22:18 -0400)]
AMDGPU: Don't consider whether amdgpu-flat-work-group-size was set

It should be semantically identical if it was set to the same value as
the default. Also improve the documentation.

2 years ago[X86] Fix bad formatting. NFC
Craig Topper [Fri, 22 Oct 2021 19:48:17 +0000 (12:48 -0700)]
[X86] Fix bad formatting. NFC

2 years ago[libc++][NFC] Remove duplicate Python imports
Louis Dionne [Fri, 22 Oct 2021 20:15:45 +0000 (16:15 -0400)]
[libc++][NFC] Remove duplicate Python imports

2 years agoSupport: Use Expected<T>::moveInto() in a few places
Duncan P. N. Exon Smith [Thu, 21 Oct 2021 22:57:15 +0000 (15:57 -0700)]
Support: Use Expected<T>::moveInto() in a few places

These are some usage examples for `Expected<T>::moveInto()`.

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

2 years ago[flang] Extension to distinguish specific procedures
peter klausler [Mon, 18 Oct 2021 17:44:39 +0000 (10:44 -0700)]
[flang] Extension to distinguish specific procedures

Allocatable dummy arguments can be used to distinguish
two specific procedures in a generic interface when
it is the case that exactly one of them is polymorphic
or exactly one of them is unlimited polymorphic.  The
standard requires that an actual argument corresponding
to an (unlimited) polymorphic allocatable dummy argument
must also be an (unlimited) polymorphic allocatable, so an
actual argument that's acceptable to one procedure must
necessarily be a bad match for the other.

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

2 years agoAMDGPU: Regenerate MIR test checks
Matt Arsenault [Fri, 22 Oct 2021 17:47:33 +0000 (13:47 -0400)]
AMDGPU: Regenerate MIR test checks

Recently this started using -NEXT checks, so regenerate these to avoid
extra test churn in a future change.

2 years agoAMDGPU: Fix hardcoded registers in tests
Matt Arsenault [Mon, 16 Aug 2021 14:19:52 +0000 (10:19 -0400)]
AMDGPU: Fix hardcoded registers in tests

2 years ago[mlir][Linalg] NFC - Drop Optional in favor of FailureOr
Nicolas Vasilache [Fri, 22 Oct 2021 19:11:32 +0000 (19:11 +0000)]
[mlir][Linalg] NFC - Drop Optional in favor of FailureOr

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

2 years ago[AMDGPU] Run SIShrinkInstructions before post-RA scheduling
Jay Foad [Fri, 22 Oct 2021 10:19:29 +0000 (11:19 +0100)]
[AMDGPU] Run SIShrinkInstructions before post-RA scheduling

Run post-RA SIShrinkInstructions just before post-RA scheduling, instead
of afterwards. After the fixes in D112305 and D112317 this seems to make
no difference, but it paves the way for scheduler tweaks that are
sensitive to the e32 vs e64 encoding of VALU instructions.

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

2 years ago[lldb/Formatters] Remove space from vector type string summaries (NFCI)
Med Ismail Bennani [Fri, 22 Oct 2021 19:18:11 +0000 (19:18 +0000)]
[lldb/Formatters] Remove space from vector type string summaries (NFCI)

This patch changes the string summaries for vector types by removing the
space between the type and the bracket, conforming to 277623f4d5a6.

This should also fix TestCompactVectors failure.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[AMDGPU] Fix latency for implicit vcc_lo operands on GFX10 wave32
Jay Foad [Fri, 22 Oct 2021 13:39:39 +0000 (14:39 +0100)]
[AMDGPU] Fix latency for implicit vcc_lo operands on GFX10 wave32

As described in the comment, the way we change vcc to vcc_lo in these
operands confuses addPhysRegDataDeps into treating them as implicit
pseudo operands. Fix this by setting the correct latency from the
SchedModel after addPhysRegDataDeps wrongly set it to 0.

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

2 years ago[ScheduleDAGInstrs] Call adjustSchedDependency in more cases
Jay Foad [Fri, 22 Oct 2021 11:21:57 +0000 (12:21 +0100)]
[ScheduleDAGInstrs] Call adjustSchedDependency in more cases

This removes a condition and the corresponding FIXME comment, because
the Hexagon assertion it refers to has apparently been fixed, probably
by D76134.

NFCI. This just gives targets the opportunity to adjust latencies that
were set to 0 by the generic code because they involve "implicit pseudo"
operands.

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

2 years ago[InstCombine] Precommit new and-xor-or.ll tests. NFC.
Stanislav Mekhanoshin [Fri, 22 Oct 2021 18:59:15 +0000 (11:59 -0700)]
[InstCombine] Precommit new and-xor-or.ll tests. NFC.

2 years agoSupport: Add Expected<T>::moveInto() to avoid extra names
Duncan P. N. Exon Smith [Wed, 20 Oct 2021 19:03:31 +0000 (12:03 -0700)]
Support: Add Expected<T>::moveInto() to avoid extra names

Expected<T>::moveInto() takes as an out parameter any `OtherT&` that's
assignable from `T&&`. It moves any stored value before returning
takeError().

Since moveInto() consumes both the Error and the value, it's only
anticipated that we'd use call it on temporaries/rvalues, with naming
the Expected first likely to be an anti-pattern of sorts (either you
want to deal with both at the same time, or you don't). As such,
starting it out as `&&`-qualified... but it'd probably be fine to drop
that if there's a good use case for lvalues that appears.

There are two common patterns that moveInto() cleans up:
```
  // If the variable is new:
  Expected<std::unique_ptr<int>> ExpectedP = makePointer();
  if (!ExpectedP)
    return ExpectedP.takeError();
  std::unique_ptr<int> P = std::move(*ExpectedP);

  // If the target variable already exists:
  if (Expected<T> ExpectedP = makePointer())
    P = std::move(*ExpectedP);
  else
    return ExpectedP.takeError();
```
moveInto() takes less typing and avoids needing to name (or leak into
the scope) an extra variable.
```
  // If the variable is new:
  std::unique_ptr<int> P;
  if (Error E = makePointer().moveInto(P))
    return E;

  // If the target variable already exists:
  if (Error E = makePointer().moveInto(P))
    return E;
```

It also seems useful for unit tests, to log errors (but continue) when
there's an unexpected failure. E.g.:
```
  // Crash on error, or undefined in non-asserts builds.
  std::unique_ptr<MemoryBuffer> MB = cantFail(makeMemoryBuffer());

  // Avoid crashing on error without moveInto() :(.
  Expected<std::unique_ptr<MemoryBuffer>>
      ExpectedMB = makeMemoryBuffer();
  ASSERT_THAT_ERROR(ExpectedMB.takeError(), Succeeded());
  std::unique_ptr<MemoryBuffer> MB = std::move(ExpectedMB);

  // Avoid crashing on error with moveInto() :).
  std::unique_ptr<MemoryBuffer> MB;
  ASSERT_THAT_ERROR(makeMemoryBuffer().moveInto(MB), Succeeded());
```

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

2 years ago[ConstantFolding] Drop misleading comment (NFC)
Nikita Popov [Fri, 22 Oct 2021 17:15:22 +0000 (19:15 +0200)]
[ConstantFolding] Drop misleading comment (NFC)

As pointed out by Philip, this part of the comment is misleading,
as it describes undef rather than poison behavior. Just mentioning
poison should be sufficient.

2 years ago[Dexter] Add DexFinishTest command to conditionally early-exit a test program
Stephen Tozer [Mon, 18 Oct 2021 11:36:25 +0000 (12:36 +0100)]
[Dexter] Add DexFinishTest command to conditionally early-exit a test program

This patch adds a command, DexFinishTest, that allows a Dexter test to
be conditionally finished at a given breakpoint. This command has the
same set of arguments as DexLimitSteps, except that it does not allow a
line range (from_line, to_line), only a single line (on_line).

Reviewed By: Orlando

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

2 years ago[libunwind] Fix path to libunwind for per-target-runtime-dir builds
Louis Dionne [Fri, 22 Oct 2021 16:03:00 +0000 (12:03 -0400)]
[libunwind] Fix path to libunwind for per-target-runtime-dir builds

We recently introduced a from-scratch config to run the libunwind tests.
However, that config was always looking for libunwind in <install>/lib,
and never in <install>/<target>/lib, which is necessary for tests to
work when the per-target-runtime-dir configuration is enabled.

This commit fixes that. I believe this is what caused the CI failures we
saw after 5a8ad80b6fa5 and caused it to be reverted.

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

2 years ago[flang] Enforce rest of semantic constraint C919
peter klausler [Tue, 19 Oct 2021 20:49:21 +0000 (13:49 -0700)]
[flang] Enforce rest of semantic constraint C919

A reference to an allocatable or pointer component must be applied
to a scalar base object.  (This is the second part of constraint C919;
the first part is already checked.)

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

2 years ago[DebugInfo][Instr] Track subregisters across stack spills/restores
Jeremy Morse [Fri, 22 Oct 2021 18:10:05 +0000 (19:10 +0100)]
[DebugInfo][Instr] Track subregisters across stack spills/restores

Sometimes we generate code that writes to a subregister, then spills /
restores a super-register to the stack, for example:

    $eax = MOV32ri 0
    MOV64mr $rsp, 1, $noreg, 16, $noreg, $rax
    $rcx = MOV64rm $rsp, 1, $noreg, 8, $noreg

This patch takes a different approach: it adds another index to
MLocTracker that identifies a size/offset within a stack slot. A location
on the stack is then a pari of {FrameIndex, SlotNum}. Spilling and
restoring now involves pairing up the src/dest register numbers, and the
dest/src stack position to be transferred to/from. Location coverage
improves as a result, compile-time performance decreases, alas.

One limitation is that if a PHI occurs inside a stack slot:

    DBG_PHI %stack.0, 1

We don't know how large the resulting value is, and so might have
difficulty picking which value to use. DBG_PHI might need to be augmented
in the future with such a size.

Unit tests added ensure that spills and restores correctly transfer to
positions in the Location => Value map, and that different register classes
written to the stack will correctly clobber all other positions in the
stack slot.

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

2 years ago[flang] Emit unformatted headers & footers even with RECL=
peter klausler [Tue, 19 Oct 2021 21:46:23 +0000 (14:46 -0700)]
[flang] Emit unformatted headers & footers even with RECL=

The runtime library was emitting unformatted record headers and
footers when an external unit had no fixed RECL=.  This is wrong
for sequential files, which should have headers & footers even
with RECL.  Change to omit headers & footers from unformatted
I/O only for direct access files.

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

2 years ago[LegalizeTypes] Only expand CTLZ/CTTZ/CTPOP during type promotion if the new type...
Craig Topper [Fri, 22 Oct 2021 17:38:53 +0000 (10:38 -0700)]
[LegalizeTypes] Only expand CTLZ/CTTZ/CTPOP during type promotion if the new type is legal.

We might be promoting a large non-power of 2 type and the new type
may need to be split. Once we split it we may have a ctlz/cttz/ctpop
instruction for the split type.

I'm also concerned that we may create large shifts with shift amounts
that are too small.

2 years ago[flang] Fix bogus folding error for ISHFT(x, negative)
peter klausler [Wed, 20 Oct 2021 17:37:09 +0000 (10:37 -0700)]
[flang] Fix bogus folding error for ISHFT(x, negative)

Negative shift counts are of course valid for ISHFT when
shifting to the right.  This patch decouples the folding of
ISHFT from that of SHIFTA/L/R and adds tests.

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

2 years ago[InstCombine] Various tests for truncating saturates and related patterns.
David Green [Fri, 22 Oct 2021 17:36:08 +0000 (18:36 +0100)]
[InstCombine] Various tests for truncating saturates and related patterns.

2 years ago[DAG] narrowExtractedVectorLoad - EXTRACT_SUBVECTOR indices are always constant
Simon Pilgrim [Fri, 22 Oct 2021 17:19:02 +0000 (18:19 +0100)]
[DAG] narrowExtractedVectorLoad - EXTRACT_SUBVECTOR indices are always constant

EXTRACT_SUBVECTOR indices are always constant, we don't need to check for ConstantSDNode, we should just use getConstantOperandVal which will assert for the constant.

2 years ago[indvars] Use fact loop must exit to canonicalize to unsigned conditions
Philip Reames [Fri, 22 Oct 2021 17:24:27 +0000 (10:24 -0700)]
[indvars] Use fact loop must exit to canonicalize to unsigned conditions

The logic in this patch is that if we find a comparison which would be unsigned except for when the loop is infinite, and we can prove that an infinite loop must be ill defined, we can still make the predicate unsigned.

The eventual goal (combined with a follow on patch) is to use the fact the loop exits to remove the zext (see tests) entirely.

A couple of points worth noting:
* We loose the ability to prove the loop unreachable by committing to the must exit interpretation. If instead, we later proved that rhs was definitely outside the range required for finiteness, we could have killed the loop entirely. (We don't currently implement this transform, but could in theory, do so.)
* simplifyAndExtend has a very limited list of users it walks. In particular, in the examples is stops at the zext and never visits the icmp. (Because we can't fold the zext to an addrec yet in SCEV.) Being willing to visit when we haven't simplified regresses multiple tests (seemingly because of less optimal results when computing trip counts).  D112170 explores fixing that, but - at least so far - appears to be too expensive compile time wise.

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

2 years ago[DebugInfo][InstrRef] Add unit tests for transfer-function building
Jeremy Morse [Fri, 22 Oct 2021 17:26:35 +0000 (18:26 +0100)]
[DebugInfo][InstrRef] Add unit tests for transfer-function building

This patch adds some unit tests for the machine-location transfer-function
building parts of InstrRefBasedLDV: i.e., test that if we feed some MIR
into the transfer-function building code, does it create the correct
transfer function.

There are a number of minor defects that get corrected in the process:
 * The unit test was selecting the x86 (i.e. 32 bit) backend rather than
   x86_64's 64 bit backend,
 * COPY instructions weren't actually having their subregister values
   correctly represented in the transfer function. Subregisters were being
   defined by the COPY, rather than taking the value in the source register.
 * SP aliases were at risk of being clobbered, if an SP subregister was
   clobbered.

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

2 years ago[TargetLowering] Simplify the interface of expandABS. NFC
Craig Topper [Fri, 22 Oct 2021 17:19:57 +0000 (10:19 -0700)]
[TargetLowering] Simplify the interface of expandABS. NFC

Instead of returning a bool to indicate success and a separate
SDValue, return the SDValue and have the callers check if it is
null.

Reviewed By: RKSimon

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

2 years ago[lldb] Pass the target triple when determining the DWARF version
Jonas Devlieghere [Fri, 22 Oct 2021 17:09:17 +0000 (10:09 -0700)]
[lldb] Pass the target triple when determining the DWARF version

When targeting iOS, the default dwarf version is 2 and not 4. Currently,
the test suite does not pick up on that because it invokes the test
compiler without a target triple. This patch fixes that and now
correctly skips tests that have a dwarf version specified in a skipIf
decorator.

rdar://84530477

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

2 years ago[llvm]Inclusive language: replace master with main
Quinn Pham [Fri, 22 Oct 2021 16:49:14 +0000 (11:49 -0500)]
[llvm]Inclusive language: replace master with main

[NFC] This patch fixes a url in a testcase due to the renaming of the branch.

2 years ago[libc++] Fix tests after aee49255074f
Louis Dionne [Fri, 22 Oct 2021 16:49:58 +0000 (12:49 -0400)]
[libc++] Fix tests after aee49255074f

2 years ago[Loads] Use more powerful constant folding API
Nikita Popov [Thu, 21 Oct 2021 18:46:06 +0000 (20:46 +0200)]
[Loads] Use more powerful constant folding API

This follows up on D111023 by exporting the generic "load value
from constant at given offset as given type" and using it in the
store to load forwarding code. We now need to make sure that the
load size is smaller than the store size, previously this was
implicitly ensured by ConstantFoldLoadThroughBitcast().

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

2 years ago[Attributor] Generalize GEP construction
Nikita Popov [Thu, 21 Oct 2021 19:42:14 +0000 (21:42 +0200)]
[Attributor] Generalize GEP construction

Make use of the getGEPIndicesForOffset() helper for creating GEPs.
This handles arrays as well, uses correct GEP index types and
reduces code duplication.

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

2 years ago[LegalizeTypes][RISCV][PowerPC] Expand CTLZ/CTTZ/CTPOP instead of promoting if they...
Craig Topper [Fri, 22 Oct 2021 16:05:39 +0000 (09:05 -0700)]
[LegalizeTypes][RISCV][PowerPC] Expand CTLZ/CTTZ/CTPOP instead of promoting if they'll be expanded later.

Expanding these requires multiple constants. If we promote during type
legalization when they'll end up getting expanded in LegalizeDAG, we'll
use larger constants. These constants may be harder to materialize.
For example, 64-bit constants on 64-bit RISCV are very expensive.

This is similar to what has already been done to BSWAP and BITREVERSE.

Reviewed By: RKSimon

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

2 years ago[AIX] Enable rtl for plugins test
Steven Wan [Fri, 22 Oct 2021 16:07:57 +0000 (12:07 -0400)]
[AIX] Enable rtl for plugins test

On AIX, the plugins are linked with `-WL,-G`, which produces shared objects enabled for use with the run-time linker. This patch sets the run-time
linker at the main executable link step to allow symbols from the plugins shared objects to be properly bound.

Reviewed By: daltenty

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

2 years ago[RISCV] Merge vector tests for rv32 and rv64 into a single test file
Craig Topper [Thu, 21 Oct 2021 17:22:02 +0000 (10:22 -0700)]
[RISCV] Merge vector tests for rv32 and rv64 into a single test file

These tests have nearly identical content the only difference is
that the rv64 test has a signext attribute on some parameters.
That attribute should be harmless on rv32.

Merge them into a single test file with 2 RUN lines.

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

2 years ago[OpenMP][OMPT][GOMP] task frame support in KMP_API_NAME_GOMP_PARALLEL_SECTIONS
Vladimir Inđić [Thu, 21 Oct 2021 22:09:11 +0000 (17:09 -0500)]
[OpenMP][OMPT][GOMP] task frame support in KMP_API_NAME_GOMP_PARALLEL_SECTIONS

KMP_API_NAME_GOMP_PARALLEL_SECTIONS function was missing the task frame support.
This patch introduced a fix responsible to set properly the exit_frame of
the innermost implicit task that corresponds to the parallel section construct,
as well as the enter_frame of the task that encloses the mentioned implicit task.

This patch also introduced a simple test case sections_serialized.c that contains
serialized parallel section construct and validates whether the mentioned
task frames are set correctly.

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

2 years ago[Target, Transforms] Use StringRef::contains (NFC)
Kazu Hirata [Fri, 22 Oct 2021 15:52:33 +0000 (08:52 -0700)]
[Target, Transforms] Use StringRef::contains (NFC)

2 years ago[SystemZ] Give the EXRL_Pseudo a size value of 6 bytes.
Jonas Paulsson [Fri, 22 Oct 2021 15:05:20 +0000 (17:05 +0200)]
[SystemZ] Give the EXRL_Pseudo a size value of 6 bytes.

This pseudo is expanded very late (AsmPrinter) and therefore has to have a
correct size value, or the branch relaxation pass may make a wrong decision.

Review: Ulrich Weigand

2 years ago[libc++][nfc] Remove double spaces.
Mark de Wever [Thu, 21 Oct 2021 16:29:14 +0000 (18:29 +0200)]
[libc++][nfc] Remove double spaces.

Based on the comment of @Quuxplusone in D111961. It seems no tests are
affected, but give it a run on the CI to be sure.

Reviewed By: #libc, ldionne

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

2 years ago[libc++][doc] Fixes FeatureTestMacroTable.html.
Mark de Wever [Thu, 21 Oct 2021 18:06:30 +0000 (20:06 +0200)]
[libc++][doc] Fixes FeatureTestMacroTable.html.

`utils/generate_feature_test_macro_components.py` uses the wrong
indentation. `:name: feature-status-table :widths: auto` is rendered as
text instead of being used by Sphinx to render the table properly.

This fixes the identation in the souce and updates the generated output.

Reviewed By: #libc, ldionne

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

2 years ago[InstCombine][NFC] Precommit new tests
Piotr Sobczak [Fri, 22 Oct 2021 14:23:24 +0000 (16:23 +0200)]
[InstCombine][NFC] Precommit new tests

2 years ago[libc++][test][NFC] Add tests for std::vector comparisons
Konstantin Boyarinov [Fri, 22 Oct 2021 14:36:28 +0000 (17:36 +0300)]
[libc++][test][NFC] Add tests for std::vector comparisons

Add missing tests for std::vector operator==, !=, <, <=, >, >=

Reviewed By: ldionne, rarutyun, Quuxplusone, Mordante, #libc

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

2 years ago[Flang][docs] Remove an out-dated section on the new driver
Andrzej Warzynski [Fri, 22 Oct 2021 14:41:16 +0000 (14:41 +0000)]
[Flang][docs] Remove an out-dated section on the new driver

This section of the documentation should've been deleted in:
https://reviews.llvm.org/D105811

I am submitting this without a review as it's an obvious omission.

2 years ago[AArch64][SVE] Add new ld<n> intrinsics that return a struct of vscale types
Bradley Smith [Mon, 18 Oct 2021 16:20:24 +0000 (16:20 +0000)]
[AArch64][SVE] Add new ld<n> intrinsics that return a struct of vscale types

This will allow us to reuse existing interleaved load logic in
lowerInterleavedLoad that exists for neon types, but for SVE fixed
types.

The goal eventually will be to replace the existing ld<n> intriniscs
with these, once a migration path has been sorted out.

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

2 years ago[clang/llvm] Inclusive language: replace segregate with separate
Zarko Todorovski [Fri, 22 Oct 2021 13:45:30 +0000 (09:45 -0400)]
[clang/llvm] Inclusive language: replace segregate with separate

2 years ago[X86] `X86TTIImpl::getInterleavedMemoryOpCost()`: scale interleaving cost by the...
Roman Lebedev [Fri, 22 Oct 2021 13:31:56 +0000 (16:31 +0300)]
[X86] `X86TTIImpl::getInterleavedMemoryOpCost()`: scale interleaving cost by the fraction of live members

By definition, interleaving load of stride N means:
load N*VF elements, and shuffle them into N VF-sized vectors,
with 0'th vector containing elements `[0, VF)*stride + 0`,
and 1'th vector containing elements `[0, VF)*stride + 1`.
Example: https://godbolt.org/z/df561Me5E (i64 stride 4 vf 2 => cost 6)

Now, not fully interleaved load, is when not all of these vectors is demanded.
So at worst, we could just pretend that everything is demanded,
and discard the non-demanded vectors. What this means is that the cost
for not-fully-interleaved group should be not greater than the cost
for the same fully-interleaved group, but perhaps somewhat less.
Examples:
https://godbolt.org/z/a78dK5Geq (i64 stride 4 (indices 012u) vf 2 => cost 4)
https://godbolt.org/z/G91ceo8dM (i64 stride 4 (indices 01uu) vf 2 => cost 2)
https://godbolt.org/z/5joYob9rx (i64 stride 4 (indices 0uuu) vf 2 => cost 1)

Right now, for such not-fully-interleaved loads we just use the costs
for fully-interleaved loads. But at least **in general**,
that is obviously overly pessimistic, because **in general**,
not all the shuffles needed to perform the full interleaving
will end up being live.

So what this does, is naively scales the interleaving cost
by the fraction of the live members. I believe this should still result
in the right ballpark cost estimate, although it may be over/under -estimate.

Reviewed By: RKSimon

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

2 years agoReplace references to Makefile.sphinx
Sylvestre Ledru [Fri, 22 Oct 2021 13:31:38 +0000 (15:31 +0200)]
Replace references to Makefile.sphinx

and fix some typos

Reviewed By: aaron.ballman

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

2 years ago[lldb] Another build fix for 8b8070e23
Pavel Labath [Fri, 22 Oct 2021 13:28:06 +0000 (15:28 +0200)]
[lldb] Another build fix for 8b8070e23

This particular usage was guarded by !__linux__, so it broke everywhere
else. It should probably be replaced by something else.

2 years ago[CodeGen] Add PR50197 AArch64/ARM/X86 test coverage
Simon Pilgrim [Fri, 22 Oct 2021 13:22:33 +0000 (14:22 +0100)]
[CodeGen] Add PR50197 AArch64/ARM/X86 test coverage

Pre-commit for D111530

2 years ago[AMDGPU] Preserve deadness of vcc when shrinking instructions
Jay Foad [Fri, 22 Oct 2021 10:18:11 +0000 (11:18 +0100)]
[AMDGPU] Preserve deadness of vcc when shrinking instructions

This doesn't have any effect on codegen now, but it might do in the
future if we shrink instructions before post-RA scheduling, which is
sensitive to live vs dead defs.

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

2 years ago[mlir][OpenMP]Support for modifiers in workshare loops
Mats Petersson [Tue, 6 Apr 2021 10:20:49 +0000 (11:20 +0100)]
[mlir][OpenMP]Support for modifiers in workshare loops

Pass the modifiers from the Flang parser to FIR/MLIR workshare
loop operation.

Not yet supporting the SIMD modifier, which is a bit more work
than just adding it to the list of modifiers, so will go in a
separate patch.

This adds a new field to the WsLoopOp.

Also add test for dynamic WSLoop, checking that dynamic schedule calls
the init and next functions as expected.

Reviewed By: ftynse

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

2 years ago[DSE] Add test cases with more complex redundant stores.
Florian Hahn [Fri, 22 Oct 2021 12:50:32 +0000 (13:50 +0100)]
[DSE] Add test cases with more complex redundant stores.

This patch adds more complex test cases with redundant stores of an
existing memset, with other stores in between.

It also makes a few of the existing tests more robust.

2 years ago[lldb] [Utility/UriParser] Replace port==-1 with llvm::None
Michał Górny [Fri, 22 Oct 2021 12:00:07 +0000 (14:00 +0200)]
[lldb] [Utility/UriParser] Replace port==-1 with llvm::None

Use llvm::Optional<uint16_t> instead of int for port number
in UriParser::Parse(), and use llvm::None to indicate missing port
instead of a magic value of -1.

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

2 years ago[lldb] Fix build errors from 8b8070e23
Pavel Labath [Fri, 22 Oct 2021 12:28:52 +0000 (14:28 +0200)]
[lldb] Fix build errors from 8b8070e23

I missed windows and openbsd.

2 years ago[NFC] Re-harden test/Transforms/LoopVectorize/X86/pr48340.ll
Roman Lebedev [Fri, 22 Oct 2021 11:56:04 +0000 (14:56 +0300)]
[NFC] Re-harden test/Transforms/LoopVectorize/X86/pr48340.ll

This test is quite fragile WRT improvements to the interleaved load cost
modelling. Let's bump the stride way up so that is no longer a concern.

2 years agoRevert "[NFC][LV] Autogenerate check lines in a test for ease of future update"
Roman Lebedev [Fri, 22 Oct 2021 11:54:36 +0000 (14:54 +0300)]
Revert "[NFC][LV] Autogenerate check lines in a test for ease of future update"

This reverts commit 8ae83a1bafdfd726a657db43653195d35bda1179.

2 years agoAMDGPULibCalls - constify some FuncInfo& arguments. NFCI.
Simon Pilgrim [Fri, 22 Oct 2021 11:10:44 +0000 (12:10 +0100)]
AMDGPULibCalls - constify some FuncInfo& arguments. NFCI.

2 years ago[TTI] `BasicTTIImplBase::getInterleavedMemoryOpCost()`: fix load discounting
Roman Lebedev [Fri, 22 Oct 2021 11:04:38 +0000 (14:04 +0300)]
[TTI] `BasicTTIImplBase::getInterleavedMemoryOpCost()`: fix load discounting

The math here is:
Cost of 1 load = cost of n loads / n
Cost of live loads = num live loads * Cost of 1 load
Cost of live loads = num live loads * (cost of n loads / n)
Cost of live loads = cost of n loads * (num live loads / n)

But, all the variables here are integers,
and integer division rounds down,
but this calculation clearly expects float semantics.

Instead multiply upfront, and then perform round-up-division.

Reviewed By: RKSimon

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

2 years ago[NFC][LV] Autogenerate check lines in a test for ease of future update
Roman Lebedev [Fri, 22 Oct 2021 11:04:03 +0000 (14:04 +0300)]
[NFC][LV] Autogenerate check lines in a test for ease of future update

2 years agoHost::GetOSBuildString
Pavel Labath [Tue, 19 Oct 2021 14:00:31 +0000 (16:00 +0200)]
Host::GetOSBuildString

2 years agoMark baremetal.cpp test as unsupported on Windows.
Kristof Beyls [Fri, 22 Oct 2021 10:36:49 +0000 (11:36 +0100)]
Mark baremetal.cpp test as unsupported on Windows.

A new check was added in 3b93dc68, which seems to not be possible to get
working correctly on windows systems:

The test first "captures" the install directory of the clang toolchain
running the test as follows:
// CHECK-AARCH64-NO-HOST-INC: InstalledDir: [[INSTALLEDDIR:.+]]
Then, in a check line a bit later, it uses this to check if a particular
directory in the toolchain installation directory is included when
targeting aarch64-none-elf:
// CHECK-AARCH64-NO-HOST-INC-SAME: "-internal-isystem" "[[INSTALLEDDIR]]{{[/\\]+}}..{{[/\\]+}}lib{{[/\\]+}}clang-runtimes{{[/\\]+}}aarch64-none-elf{{[/\\]+}}include{{[/\\]+}}c++{{[/\\]+}}v1"

Even though the test aims to take into account forward vs backward slash
differences between Windows and Unix paths, it still fails on Windows.

It seems that on Windows (this is based on the output log from a Windows
bot), the INSTALLEDDIR variable has the following value:

note: with "INSTALLEDDIR" equal to "c:\\\\b\\\\slave\\\\clang-x64-windows-msvc\\\\build\\\\stage1\\\\bin"

However the actual "InstalledDir:" output produced by the clang
toolchain on that Windows bot was:

InstalledDir: c:\b\slave\clang-x64-windows-msvc\build\stage1\bin

It is unclear where the explosion of backslashes happens. Maybe this is
a bug in FileCheck somewhere?
Anyway, marking this test as not supported on Windows to make the bots
green again.

2 years agoAMDGPULibCalls::parseFunctionName - use reference instead of pointer. NFCI.
Simon Pilgrim [Fri, 22 Oct 2021 10:45:12 +0000 (11:45 +0100)]
AMDGPULibCalls::parseFunctionName - use reference instead of pointer. NFCI.

parseFunctionName allowed a default null pointer, despite it being dereferenced immediately to be used as a reference and that all callers were taking the address of an existing reference.

Fixes static analyzer warning about potential dereferenced nulls

2 years ago[llvm] [ADT] Update llvm::Split() per Pavel Labath's suggestions
Michał Górny [Mon, 27 Sep 2021 10:22:31 +0000 (12:22 +0200)]
[llvm] [ADT] Update llvm::Split() per Pavel Labath's suggestions

Optimize the iterator comparison logic to compare Current.data()
pointers.  Use std::tie for assignments from std::pair.  Replace
the custom class with a function returning iterator_range.

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

2 years ago[LLVM-C]Add LLVMAddMetadataToInst, deprecated LLVMSetInstDebugLocation.
Florian Hahn [Fri, 22 Oct 2021 10:00:23 +0000 (11:00 +0100)]
[LLVM-C]Add LLVMAddMetadataToInst, deprecated LLVMSetInstDebugLocation.

IRBuilder has been updated to support preserving metdata in a more
general manner. This patch adds `LLVMAddMetadataToInst` and
deprecates `LLVMSetInstDebugLocation` in favor of the more
general function.

Reviewed By: aprantl

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

2 years ago[mlir][Vector] NFC - Extract rewrites related to insert/extract strided slice in...
Nicolas Vasilache [Fri, 22 Oct 2021 09:39:07 +0000 (09:39 +0000)]
[mlir][Vector] NFC - Extract rewrites related to insert/extract strided slice in a separate file.

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

2 years ago[analyzer][solver] Introduce reasoning for not equal to operator
Manas [Fri, 22 Oct 2021 09:47:27 +0000 (11:47 +0200)]
[analyzer][solver] Introduce reasoning for not equal to operator

Prior to this, the solver was only able to verify whether two symbols
are equal/unequal, only when constants were involved. This patch allows
the solver to work over ranges as well.

Reviewed By: steakhal, martong

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

Patch by: @manas (Manas Gupta)

2 years ago[RISCV] Fix missing cross-block VSETVLI insertion
Fraser Cormack [Thu, 21 Oct 2021 14:32:12 +0000 (15:32 +0100)]
[RISCV] Fix missing cross-block VSETVLI insertion

This patch fixes a codegen bug, the test for which was introduced in
D112223.

When merging VSETVLIInfo across blocks, if the 'exit' VSETVLIInfo
produced by a block is found to be compatible with the VSETVLIInfo
computed as the intersection of the 'exit' VSETVLIInfo produced by the
block's predecessors, that blocks' 'exit' info is discarded and the
intersected value is taken in its place.

However, we have one authority on what constitutes VSETVLIInfo
compatibility and we are using it in two different contexts.

Compatibility is used in one context to elide VSETVLIs between
straight-line vector instructions. But compatibility when evaluated
between two blocks' exit infos ignores any info produced *inside* each
respective block before the exit points. As such it does not guarantee
that a block will not produce a VSETVLI which is incompatible with the
'previous' block.

As such, we must ensure that any merging of VSETVLIInfo is performed
using some notion of "strict" compatibility. I've defined this as a full
vtype match, but this is perhaps too pessimistic. Given that test
coverage in this regard is lacking -- the only change is in the failing
test -- I think this is a good starting point.

Reviewed By: craig.topper

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

2 years agoFix baremetal.cpp test to handle windows paths.
Kristof Beyls [Fri, 22 Oct 2021 09:24:04 +0000 (10:24 +0100)]
Fix baremetal.cpp test to handle windows paths.