platform/upstream/llvm.git
3 years agoUse `--allow-unused-prefixes=false` by default for FileCheck in MLIR testsuite
Mehdi Amini [Fri, 30 Oct 2020 21:25:49 +0000 (21:25 +0000)]
Use `--allow-unused-prefixes=false` by default for FileCheck in MLIR testsuite

This option catches unexpected mismatch when a prefix is given to
FileCheck on the command line but never matches a single line in the
test.

See http://lists.llvm.org/pipermail/llvm-dev/2020-October/146162.html
for more info.

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

3 years agoRevert "[SLP] Consider alternatives for cost of select instructions."
Florian Hahn [Fri, 30 Oct 2020 21:20:28 +0000 (21:20 +0000)]
Revert "[SLP] Consider alternatives for cost of select instructions."

This reverts commit 19225704890632cd2552f41ada41600a20db1371.

This appears to cause a crash in the following example

 a, b, c;
 l() {
   int e = a, f = l, g, h, i, j;
   float *d = c, *k = b;
   for (;;)
     for (; g < f; g++) {
       k[h] = d[i];
       k[h - 1] = d[j];
       h += e << 1;
       i += e;
     }
 }

 clang -cc1 -triple i386-unknown-linux-gnu -emit-obj -target-cpu pentium-m -O1 -vectorize-loops -vectorize-slp reduced.c

 llvm::Type *llvm::Type::getWithNewBitWidth(unsigned int) const: Assertion `isIntOrIntVectorTy() && "Original type expected to be a vector of integers or a scalar integer."' failed.

3 years agoRevert "[TTI] Add VecPred argument to getCmpSelInstrCost."
Florian Hahn [Fri, 30 Oct 2020 21:19:52 +0000 (21:19 +0000)]
Revert "[TTI] Add VecPred argument to getCmpSelInstrCost."

This reverts commit 73f01e3df58dca9d1596440b866b52929e3878de.

This appears to break
http://lab.llvm.org:8011/#/builders/85/builds/383.

3 years agohwasan: Support for outlined checks in the Linux kernel.
Peter Collingbourne [Tue, 27 Oct 2020 23:26:29 +0000 (16:26 -0700)]
hwasan: Support for outlined checks in the Linux kernel.

Add support for match-all tags and GOT-free runtime calls, which
are both required for the kernel to be able to support outlined
checks. This requires extending the access info to let the backend
know when to enable these features. To make the code easier to maintain
introduce an enum with the bit field positions for the access info.

Allow outlined checks to be enabled with -mllvm
-hwasan-inline-all-checks=0. Kernels that contain runtime support for
outlined checks may pass this flag. Kernels lacking runtime support
will continue to link because they do not pass the flag. Old versions
of LLVM will ignore the flag and continue to use inline checks.

With a separate kernel patch [1] I measured the code size of defconfig
+ tag-based KASAN, as well as boot time (i.e. time to init launch)
on a DragonBoard 845c with an Android arm64 GKI kernel. The results
are below:

         code size    boot time
before    92824064      6.18s
after     38822400      6.65s

[1] https://linux-review.googlesource.com/id/I1a30036c70ab3c3ee78d75ed9b87ef7cdc3fdb76

Depends on D90425

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

3 years ago[FileCheck] Address unused prefixes in tests
Mircea Trofin [Fri, 30 Oct 2020 20:52:03 +0000 (13:52 -0700)]
[FileCheck] Address unused prefixes in tests

Added -allow-unused-prefixes as necessary.

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

3 years ago[mlir] Add BufferResultsToOutParams pass.
Sean Silva [Fri, 23 Oct 2020 17:30:59 +0000 (10:30 -0700)]
[mlir] Add BufferResultsToOutParams pass.

This pass allows removing getResultConversionKind from
BufferizeTypeConverter. This pass replaces the AppendToArgumentsList
functionality. As far as I could tell, the only use of this functionlity
is to perform the transformation that is implemented in this pass.

Future patches will remove the getResultConversionKind machinery from
BufferizeTypeConverter, but sending this patch for individual review for
clarity.

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

3 years ago[Legalize] Add legalizations for VECREDUCE_SEQ_FADD
Cameron McInally [Fri, 30 Oct 2020 20:32:22 +0000 (15:32 -0500)]
[Legalize] Add legalizations for VECREDUCE_SEQ_FADD

Add Legalization support for VECREDUCE_SEQ_FADD, so that we don't need to depend on ExpandReductionsPass.

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

3 years ago[MLIR][SPIRV] Start module combiner.
ergawy [Fri, 30 Oct 2020 18:36:19 +0000 (14:36 -0400)]
[MLIR][SPIRV] Start module combiner.

This commit adds a new library that merges/combines a number of spv
modules into a combined one. The library has a single entry point:
combine(...).

To combine a number of MLIR spv modules, we move all the module-level ops
from all the input modules into one big combined module. To that end, the
combination process can proceed in 2 phases:

  (1) resolving conflicts between pairs of ops from different modules
  (2) deduplicate equivalent ops/sub-ops in the merged module. (TODO)

This patch implements only the first phase.

Reviewed By: antiagainst

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

3 years ago[mlir] Move some linalg patterns around.
Sean Silva [Tue, 27 Oct 2020 16:59:33 +0000 (09:59 -0700)]
[mlir] Move some linalg patterns around.

The bufferization patterns are moved to the .cpp file, which is
preferred in the codebase when it makes sense.

The LinalgToStandard patterns are kept a header because they are
expected to be used individually. However, they are moved to
LinalgToStandard.h which is the file corresponding to where they are
defined.

This also removes TensorCastOpConverter, which is handled by
populateStdBufferizePatterns now. Eventually, the constant op lowering
will be handled as well, but it there are currently holdups on moving
it (see https://reviews.llvm.org/D89916).

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

3 years agoRevert "[MLIR][SPIRV] Start module combiner."
Geoffrey Martin-Noble [Fri, 30 Oct 2020 20:32:02 +0000 (13:32 -0700)]
Revert "[MLIR][SPIRV] Start module combiner."

This reverts commit 27324f28552d0c66e8b28efd9c15820e5f246619.

Shared libs build is broken linking lib/libMLIRSPIRVModuleCombiner.so:

```
ModuleCombiner.cpp:
  undefined reference to `mlir::spirv::ModuleOp::addressing_model()
```

https://buildkite.com/mlir/mlir-core/builds/8988#e3d966b9-ea43-492e-a192-b28e71e9a15b

3 years ago[clang][NFC] Remove unused FileCheck prefix
Keith Smiley [Thu, 29 Oct 2020 21:10:53 +0000 (14:10 -0700)]
[clang][NFC] Remove unused FileCheck prefix

This is to enable --allow-unused-duplicates=false. This prefix appears
to be outdated and intentionally unused.

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

3 years agoRemove `noexcept` from ac49500cd0484e1b2dcf37fa4c0dade6f113c2c9 to fix bots
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 20:29:16 +0000 (16:29 -0400)]
Remove `noexcept` from ac49500cd0484e1b2dcf37fa4c0dade6f113c2c9 to fix bots

I'm having trouble with bots today. Remove more cargo-cult from the
generic version of `OptionalStorage` that is failing on some (fewer)
bots (but not locally).

I expect this will fix:

```
FAILED: tools/clang/unittests/Basic/CMakeFiles/BasicTests.dir/FileEntryTest.cpp.o
/usr/bin/c++  -DGTEST_HAS_RTTI=0 -DGTEST_HAS_TR1_TUPLE=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/clang/unittests/Basic -I/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/Basic -I/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/include -Itools/clang/include -Iinclude -I/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include -I/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/utils/unittest/googletest/include -I/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/utils/unittest/googlemock/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -fno-strict-aliasing -O3     -Wno-variadic-macros -fno-exceptions -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++14 -MD -MT tools/clang/unittests/Basic/CMakeFiles/BasicTests.dir/FileEntryTest.cpp.o -MF tools/clang/unittests/Basic/CMakeFiles/BasicTests.dir/FileEntryTest.cpp.o.d -o tools/clang/unittests/Basic/CMakeFiles/BasicTests.dir/FileEntryTest.cpp.o -c /home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/Basic/FileEntryTest.cpp
/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/Basic/FileEntryTest.cpp: In member function ‘virtual void {anonymous}::FileEntryTest_OptionalFileEntryRefDegradesToFileEntryPtr_Test::TestBody()’:
/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/Basic/FileEntryTest.cpp:48:46: error: use of deleted function ‘constexpr clang::OptionalFileEntryRefDegradesToFileEntryPtr::OptionalFileEntryRefDegradesToFileEntryPtr()’
   OptionalFileEntryRefDegradesToFileEntryPtr M0;
                                              ^~
In file included from /home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/Basic/FileEntryTest.cpp:9:
/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/include/clang/Basic/FileEntry.h:250:3: note: ‘constexpr clang::OptionalFileEntryRefDegradesToFileEntryPtr::OptionalFileEntryRefDegradesToFileEntryPtr() noexcept’ is implicitly deleted because its exception-specification does not match the implicit exception-specification ‘’
   OptionalFileEntryRefDegradesToFileEntryPtr() noexcept = default;
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/Basic/FileEntryTest.cpp: In member function ‘virtual void {anonymous}::FileEntryTest_equals_Test::TestBody()’:
/home/buildbots/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/clang/unittests/Basic/FileEntryTest.cpp:82:46: error: use of deleted function ‘constexpr clang::OptionalFileEntryRefDegradesToFileEntryPtr::OptionalFileEntryRefDegradesToFileEntryPtr()’
   OptionalFileEntryRefDegradesToFileEntryPtr M0;
                                              ^~
```

3 years agohwasan: Move fixed shadow behind opaque no-op cast as well.
Peter Collingbourne [Tue, 27 Oct 2020 23:26:07 +0000 (16:26 -0700)]
hwasan: Move fixed shadow behind opaque no-op cast as well.

This is a workaround for poor heuristics in the backend where we can
end up materializing the constant multiple times. This is particularly
bad when using outlined checks because we materialize it for every call
(because the backend considers it trivial to materialize).

As a result the field containing the shadow base value will always
be set so simplify the code taking that into account.

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

3 years ago[TableGen] Remove spurious GISEL prefix from test.
Paul C. Anagnostopoulos [Fri, 30 Oct 2020 17:31:29 +0000 (13:31 -0400)]
[TableGen] Remove spurious GISEL prefix from test.

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

3 years agoAArch64: Use SBFX instead of UBFX to extract address granule in outlined HWASan checks.
Peter Collingbourne [Tue, 27 Oct 2020 21:56:21 +0000 (14:56 -0700)]
AArch64: Use SBFX instead of UBFX to extract address granule in outlined HWASan checks.

In a kernel (or in general in environments where bit 55 of the address
is set) the shadow base needs to point to the end of the shadow region,
not the beginning. Bit 55 needs to be sign extended into bits 52-63
of the shadow base offset, otherwise we end up loading from an invalid
address. We can do this by using SBFX instead of UBFX.

Using SBFX should have no effect in the userspace case where bit 55
of the address is clear so we do so unconditionally. I don't think
we need a ABI version bump for this (but one will come anyway when
we switch to x20 for the shadow base register).

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

3 years agoAArch64: Switch to x20 as the shadow base register for outlined HWASan checks.
Peter Collingbourne [Tue, 27 Oct 2020 19:10:08 +0000 (12:10 -0700)]
AArch64: Switch to x20 as the shadow base register for outlined HWASan checks.

From a code size perspective it turns out to be better to use a
callee-saved register to pass the shadow base. For non-leaf functions
it avoids the need to reload the shadow base into x9 after each
function call, at the cost of an additional stack slot to save the
caller's x20. But with x9 there is also a stack size cost, either
as a result of copying x9 to a callee-saved register across calls or
by spilling it to stack, so for the non-leaf functions the change to
stack usage is largely neutral.

It is also code size (and stack size) neutral for many leaf functions.
Although they now need to save/restore x20 this can typically be
combined via LDP/STP into the x30 save/restore. In the case where
the function needs callee-saved registers or stack spills we end up
needing, on average, 8 more bytes of stack and 1 more instruction
but given the improvements to other functions this seems like the
right tradeoff.

Unfortunately we cannot change the register for the v1 (non short
granules) check because the runtime assumes that the shadow base
register is stored in x9, so the v1 check still uses x9.

Aside from that there is no change to the ABI because the choice
of shadow base register is a contract between the caller and the
outlined check function, both of which are compiler generated. We do
need to rename the v2 check functions though because the functions
are deduplicated based on their names, not on their contents, and we
need to make sure that when object files from old and new compilers
are linked together we don't end up with a function that uses x9
calling an outlined check that uses x20 or vice versa.

With this change code size of /system/lib64/*.so in an Android build
with HWASan goes from 200066976 bytes to 194085912 bytes, or a 3%
decrease.

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

3 years ago[PhaseOrdering] Add test for PR39282 (NFC)
Nikita Popov [Fri, 30 Oct 2020 19:26:42 +0000 (20:26 +0100)]
[PhaseOrdering] Add test for PR39282 (NFC)

While the actually incorrect transform happens in LoopUnroll, it
is based on noalias metadata inserted by the inliner, and
ultimately manifests in GVN. Add a phase ordering test that checks
this even if our representation of noalias metadata changes in
the future.

3 years ago[FileCheck] Report missing prefixes when more than one is provided.
Mircea Trofin [Thu, 29 Oct 2020 00:44:13 +0000 (17:44 -0700)]
[FileCheck] Report missing prefixes when more than one is provided.

If more than a prefix is provided - e.g. --check-prefixes=CHECK,FOO - we
don't report if (say) FOO is never used. This may lead to a gap in our
test coverage.

This patch introduces a new option, --allow-unused-prefixes. It
currently is set to true, keeping today's behavior. After we explicitly
set it in tests where this behavior was actually intentional, we will
switch it to false by default.

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

3 years ago[gn build] Port ac49500cd04
LLVM GN Syncbot [Fri, 30 Oct 2020 19:18:17 +0000 (19:18 +0000)]
[gn build] Port ac49500cd04

3 years ago[lldb] Report old modules from ModuleList::ReplaceEquivalent
Joseph Tremoulet [Fri, 30 Oct 2020 19:13:26 +0000 (15:13 -0400)]
[lldb] Report old modules from ModuleList::ReplaceEquivalent

This allows the Target to update its module list when loading a shared
module replaces an equivalent one.

A testcase is added which hits this codepath -- without the fix, the
target reports libbreakpad.so twice in its module list.

Reviewed By: jingham

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

3 years ago[lldb] GetSharedModule: Collect old modules in SmallVector
Joseph Tremoulet [Fri, 30 Oct 2020 19:12:10 +0000 (15:12 -0400)]
[lldb] GetSharedModule: Collect old modules in SmallVector

The various GetSharedModule methods have an optional out parameter for
the old module when a file has changed or been replaced, which the
Target uses to keep its module list current/correct.  We've been using
a single ModuleSP to track "the" old module, and this change switches
to using a SmallVector of ModuleSP, which has a couple benefits:
 - There are multiple codepaths which may discover an old module, and
   this centralizes the code for how to handle multiples in one place,
   in the Target code.  With the single ModuleSP, each place that may
   discover an old module is responsible for how it handles multiples,
   and the current code is inconsistent (some code paths drop the first
   old module, others drop the second).
 - The API will be more natural for identifying old modules in routines
   that work on sets, like ModuleList::ReplaceEquivalent (which I plan
   on updating to report old module(s) in a subsequent change to fix a
   bug).

I'm not convinced we can ever actually run into the case that multiple
old modules are found in the same GetOrCreateModule call, but I think
this change makes sense regardless, in light of the above.

When an old module is reported, Target::GetOrCreateModule calls
m_images.ReplaceModule, which doesn't allow multiple "old" modules; the
new code calls ReplaceModule for the first "old" module, and for any
subsequent old modules it logs the event and calls m_images.Remove.

Reviewed By: jingham

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

3 years ago[CFG] Replace hardcoded max BBs explored as CL option. NFC.
Anna Thomas [Fri, 30 Oct 2020 16:48:18 +0000 (12:48 -0400)]
[CFG] Replace hardcoded max BBs explored as CL option. NFC.

This option was hardcoded to 32. Changing this as a CL option since we
have seen some cases downstream where increasing this limit allows us to
disprove reachability.

Reviewed-By: jdoerfert
Differential Revision: https://reviews.llvm.org/D90487

3 years agoReapply "FileManager: Improve the FileEntryRef API and customize its OptionalStorage"
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 18:08:19 +0000 (14:08 -0400)]
Reapply "FileManager: Improve the FileEntryRef API and customize its OptionalStorage"

This reverts commit 940d0a310dca31ae97080b068cef92eadfee6367,
effectively reapplying 84e8257937ec6a332aa0b688f4dce57016516ffd, after
working around the compile errors on the bots that I wasn't seeing
locally. I removed the `constexpr` from `OptionalStorage<FileEntryRef>`
that I had cargo-culted from the generic version, since `FileEntryRef`
isn't relevant in `constexpr` contexts anyway.

The original commit message follows:

Make a few changes to the `FileEntryRef` API in preparation for
propagating it enough to remove `FileEntry::getName()`.

- Allow `FileEntryRef` to degrade implicitly to `const FileEntry*`. This
  allows functions currently returning `const FileEntry *` to be updated
  to return `FileEntryRef` without requiring all callers to be updated
  in the same patch. This helps avoid both (a) massive patches where
  many fields and locals are updated simultaneously and (b) noisy
  incremental patches where the first patch adds `getFileEntry()` at
  call sites and the second patch removes it. (Once `FileEntryRef` is
  everywhere, we should remove this API.)
- Change `operator==` to compare the underlying `FileEntry*`, ignoring
  any difference in the spelling of the filename. There were 0 users of
  the existing function because it's not useful.  In case comparing the
  exact named reference becomes important, add/test `isSameRef`.
- Add `==` comparisons between `FileEntryRef` and `const FileEntry *`
  (compares the `FileEntry*`).
- Customize `OptionalStorage<FileEntryRef>` to be pointer-sized. Add
  a private constructor that initializes with `nullptr` and specialize
  `OptionalStorage` to use it. This unblocks updating fields in
  size-sensitive data structures that currently use `const FileEntry *`.
- Add `OptionalFileEntryRefDegradesToFileEntryPtr`, a wrapper around
  `Optional<FileEntryRef>` that degrades to `const FileEntry*`. This
  facilitates future incremental patches, like the same operator on
  `FileEntryRef`. (Once `FileEntryRef` is everywhere, we should remove
  this class.)
- Remove the unncessary `const` from the by-value return of
  `FileEntryRef::getName`.
- Delete the unused function `FileEntry::isOpenForTests`.

Note that there are still `FileEntry` APIs that aren't wrapped and I
plan to deal with these separately / incrementally, as they are needed.

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

3 years ago[MLIR][SPIRV] Start module combiner.
ergawy [Fri, 30 Oct 2020 18:36:19 +0000 (14:36 -0400)]
[MLIR][SPIRV] Start module combiner.

This commit adds a new library that merges/combines a number of spv
modules into a combined one. The library has a single entry point:
combine(...).

To combine a number of MLIR spv modules, we move all the module-level ops
from all the input modules into one big combined module. To that end, the
combination process can proceed in 2 phases:

  (1) resolving conflicts between pairs of ops from different modules
  (2) deduplicate equivalent ops/sub-ops in the merged module. (TODO)

This patch implements only the first phase.

Reviewed By: antiagainst

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

3 years ago[AMDGPU] Refactor and extend elf-header-flags-mach tests
Scott Linder [Fri, 30 Oct 2020 18:37:28 +0000 (18:37 +0000)]
[AMDGPU] Refactor and extend elf-header-flags-mach tests

* Factor out common elements of the input YAML document and use sed to
  macro replace the run line specific elements.
* Add checks for the common elements which depend on the ELF class.
* Use non-numeric suffix for temporary files to avoid merge conflicts.
* Sort tests by GFX# ascending.
* Group ELF and YAML tests by GFX#.

Reviewed By: t-tye

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

3 years ago[libc++] Fix tests failing with Clang after removing GCC warnings
Louis Dionne [Fri, 30 Oct 2020 18:55:37 +0000 (14:55 -0400)]
[libc++] Fix tests failing with Clang after removing GCC warnings

3 years agotsan: add Go race detector support for macOS/ARM64
Dmitry Vyukov [Fri, 30 Oct 2020 18:42:48 +0000 (19:42 +0100)]
tsan: add Go race detector support for macOS/ARM64

Add Go race detector support for macOS/ARM64. The Go counterpart is https://golang.org/cl/266373 .

Author: cherry (Cherry Zhang)
Reviewed-in: https://reviews.llvm.org/D90435

3 years ago[gn build] Port 940d0a310dc
LLVM GN Syncbot [Fri, 30 Oct 2020 18:08:01 +0000 (18:08 +0000)]
[gn build] Port 940d0a310dc

3 years agoRevert "FileManager: Improve the FileEntryRef API and customize its OptionalStorage...
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 18:06:15 +0000 (14:06 -0400)]
Revert "FileManager: Improve the FileEntryRef API and customize its OptionalStorage" and follow-ups

This reverts commit 5530fb586f30da9dcb434f6be39198dbf016b866.
This reverts commit 010238a296e61cbf6f4d7f4383e26cf00c4e4992.
This reverts commit 84e8257937ec6a332aa0b688f4dce57016516ffd.

Having trouble getting the bots compiling. Will try again later.

3 years agoSpeculative fix for bots after 84e8257937ec6a332aa0b688f4dce57016516ffd, v2
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 18:04:48 +0000 (14:04 -0400)]
Speculative fix for bots after 84e8257937ec6a332aa0b688f4dce57016516ffd, v2

Looks like some bots don't like the defaulted default constructor, try
being explicit.

3 years agoSpeculative fix for bots after 84e8257937ec6a332aa0b688f4dce57016516ffd
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 17:58:00 +0000 (13:58 -0400)]
Speculative fix for bots after 84e8257937ec6a332aa0b688f4dce57016516ffd

I'm not seeing an error locally, but many bots are having a problem with
the call to `hasOptionalValue`. Try to fix it.

3 years ago[gn build] Port 84e8257937e
LLVM GN Syncbot [Fri, 30 Oct 2020 17:54:57 +0000 (17:54 +0000)]
[gn build] Port 84e8257937e

3 years ago[gn build] port e58660750e76
Nico Weber [Fri, 30 Oct 2020 17:48:44 +0000 (13:48 -0400)]
[gn build] port e58660750e76

Made necessary by c479e0c99459e4, which requires std::timespec
to exist, which it only does in c++17 and later.

3 years ago[RISCV] Don't use DCI.CombineTo to replace a single result. NFCI
Craig Topper [Fri, 30 Oct 2020 17:25:44 +0000 (10:25 -0700)]
[RISCV] Don't use DCI.CombineTo to replace a single result. NFCI

Just return the new node, which is the standard practice.

I also noticed what appeared to be an unnecessary attempt at
creating an ANY_EXTEND where the type should already be correct.
I replace with an assert to verify the type.

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

3 years ago[lldb][NFC] Refactor getUUID functionality
Zequan Wu [Wed, 28 Oct 2020 18:23:56 +0000 (11:23 -0700)]
[lldb][NFC] Refactor getUUID functionality

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

3 years ago[Support] PR42623: Avoid setting the delete-on-close bit if a TempFile doesn't reside...
Ronald Wampler [Mon, 28 Sep 2020 21:07:44 +0000 (17:07 -0400)]
[Support] PR42623: Avoid setting the delete-on-close bit if a TempFile doesn't reside on a local drive

On Windows, after commit 881ba104656c40098d4bc90c52613c08136f0fe1, tools
using TempFile would error with "bad file descriptor" when writing the
file on a network drive. It appears that setting the delete-on-close bit via
SetFileInformationByHandle/FileDispositionInfo prevented it from
accessing the file on network drives, and although using
FILE_DISPOSITION_INFO seems to work, it causes other troubles.

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

3 years agoFileManager: Improve the FileEntryRef API and customize its OptionalStorage
Duncan P. N. Exon Smith [Tue, 20 Oct 2020 03:36:26 +0000 (23:36 -0400)]
FileManager: Improve the FileEntryRef API and customize its OptionalStorage

Make a few changes to the `FileEntryRef` API in preparation for
propagating it enough to remove `FileEntry::getName()`.

- Allow `FileEntryRef` to degrade implicitly to `const FileEntry*`. This
  allows functions currently returning `const FileEntry *` to be updated
  to return `FileEntryRef` without requiring all callers to be updated
  in the same patch. This helps avoid both (a) massive patches where
  many fields and locals are updated simultaneously and (b) noisy
  incremental patches where the first patch adds `getFileEntry()` at
  call sites and the second patch removes it. (Once `FileEntryRef` is
  everywhere, we should remove this API.)
- Change `operator==` to compare the underlying `FileEntry*`, ignoring
  any difference in the spelling of the filename. There were 0 users of
  the existing function because it's not useful.  In case comparing the
  exact named reference becomes important, add/test `isSameRef`.
- Add `==` comparisons between `FileEntryRef` and `const FileEntry *`
  (compares the `FileEntry*`).
- Customize `OptionalStorage<FileEntryRef>` to be pointer-sized. Add
  a private constructor that initializes with `nullptr` and specialize
  `OptionalStorage` to use it. This unblocks updating fields in
  size-sensitive data structures that currently use `const FileEntry *`.
- Add `OptionalFileEntryRefDegradesToFileEntryPtr`, a wrapper around
  `Optional<FileEntryRef>` that degrades to `const FileEntry*`. This
  facilitates future incremental patches, like the same operator on
  `FileEntryRef`. (Once `FileEntryRef` is everywhere, we should remove
  this class.)
- Remove the unncessary `const` from the by-value return of
  `FileEntryRef::getName`.
- Delete the unused function `FileEntry::isOpenForTests`.

Note that there are still `FileEntry` APIs that aren't wrapped and I
plan to deal with these separately / incrementally, as they are needed.

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

3 years agoPR47861: Expand dangling reference warning to look through copy
Richard Smith [Fri, 30 Oct 2020 02:01:19 +0000 (19:01 -0700)]
PR47861: Expand dangling reference warning to look through copy
construction, and to assume that assignment operators return *this.

3 years ago[lld][WebAssembly] Give better warnings on bad relocation sites
Sam Clegg [Fri, 30 Oct 2020 03:37:16 +0000 (20:37 -0700)]
[lld][WebAssembly] Give better warnings on bad relocation sites

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

3 years ago[NFC] Clean up PassBuilder
Arthur Eubanks [Thu, 29 Oct 2020 22:43:31 +0000 (15:43 -0700)]
[NFC] Clean up PassBuilder

Make DebugLogging a member variable so that users of PassBuilder don't
need to pass it around so much.

Move call to TargetMachine::registerPassBuilderCallbacks() within
PassBuilder so users don't need to remember to call it.

Reviewed By: asbirlea

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

3 years agoUse uint64_t for branch weights instead of uint32_t
Arthur Eubanks [Wed, 30 Sep 2020 19:11:46 +0000 (12:11 -0700)]
Use uint64_t for branch weights instead of uint32_t

CallInst::updateProfWeight() creates branch_weights with i64 instead of i32.
To be more consistent everywhere and remove lots of casts from uint64_t
to uint32_t, use i64 for branch_weights.

Reviewed By: davidxl

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

3 years ago[clang][driver] Rename DriverOption as NoXarchOption (NFC)
Andrzej Warzynski [Fri, 30 Oct 2020 15:57:42 +0000 (15:57 +0000)]
[clang][driver] Rename DriverOption as NoXarchOption (NFC)

As discussed in [1], ClangFlags::DriverOption is currently only used to
mark options that should not be forwarded to other tools via `-Xarch`
options. This patch renames this flag accordingly and updates the
corresponding driver diagnostic.

A comment in ToolChain::TranslateXarchArgs is also updated to reflect
the change. The original comment referred to isDriverOption(), which is
no longer available.

[1] http://lists.llvm.org/pipermail/cfe-dev/2020-October/066953.html

Reviewed By: MaskRay

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

3 years ago[libc++] Add -Wno-sized-deallocation to avoid spurious GCC warnings
Louis Dionne [Fri, 30 Oct 2020 16:50:58 +0000 (12:50 -0400)]
[libc++] Add -Wno-sized-deallocation to avoid spurious GCC warnings

GCC tries to be nice and tell us that we probably want to also implement
sized deallocation functions when we override the normal ones. However,
we know what we're doing in the test suite and don't want to override
them.

3 years ago[NFC][Reg2Mem] modernize loops iterators
Pedro Tammela [Fri, 30 Oct 2020 16:50:07 +0000 (16:50 +0000)]
[NFC][Reg2Mem] modernize loops iterators

This patch updates the Reg2Mem loops to use more modern iterators.

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

3 years ago[NFC][LoopSimplify] modernize for loops over LoopInfo
Pedro Tammela [Fri, 30 Oct 2020 16:34:01 +0000 (16:34 +0000)]
[NFC][LoopSimplify] modernize for loops over LoopInfo

This patch modifies two for loops to use the range based syntax.
Since they are equivalent, this patch is tagged NFC.

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

3 years ago[libc++] NFC: Fix several GCC warnings in the test suite
Louis Dionne [Fri, 30 Oct 2020 15:19:07 +0000 (11:19 -0400)]
[libc++] NFC: Fix several GCC warnings in the test suite

- Several -Wshadow warnings
- Several places where we did not initialize our base class explicitly
- Unused variable warnings
- Some tautological comparisons
- Some places where we'd pass null arguments to functions expecting
  non-null (in unevaluated contexts)
- Add a few pragmas to turn off spurious warnings
- Fix warnings about declarations that don't declare anything
- Properly disable deprecation warnings in ext/ tests (the pragmas we
  were using didn't work on GCC)
- Disable include_as_c.sh.cpp because GCC complains about C++ flags
  when compiling as C. I couldn't find a way to fix this one properly,
  so I'm disabling the test. This isn't great, but at least we'll be
  able to enable warnings in the whole test suite with GCC.

3 years ago[libunwind] Support DW_CFA_remember/restore_state without heap allocation.
Daniel Kiss [Fri, 30 Oct 2020 16:42:23 +0000 (17:42 +0100)]
[libunwind] Support DW_CFA_remember/restore_state without heap allocation.

This patch just reorganises the code to make possible to use alloca
instead of malloc. This makes possible to use `.cfi_remember_state`/`.cfi_restore_state` on
platforms without heap allocation.
Also it will be safe to backtrace/unwind faults related to the allocator behind malloc.
`_LIBUNWIND_REMEMBER_HEAP_ALLOC ` option reenables the heap usage for `.cfi_remember_state`/`.cfi_restore_state`.
Define _LIBUNWIND_REMEMBER_STACK_ALLOC to force stack allocation.

Reviewed By: #libunwind, mstorsjo

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

3 years ago[x86] add cost overrides for mul with overflow
Sanjay Patel [Fri, 30 Oct 2020 16:05:01 +0000 (12:05 -0400)]
[x86] add cost overrides for mul with overflow

I'm assuming the standard size integer instructions for this end up as something like:
mulq %rsi
seto %al

And the 'mul' generally has reciprocal throughput of 1 on typical implementations
(higher latency, but that's not handled here).
The default costs may end up much higher than that, and that's what we see in the test diffs.

Vector types are left as a 'TODO'.

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

3 years ago[CodeView] Encode signed int values correctly when emitting S_CONSTANTs
Amy Huang [Tue, 27 Oct 2020 00:11:45 +0000 (17:11 -0700)]
[CodeView] Encode signed int values correctly when emitting S_CONSTANTs

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

3 years ago[CodeGen][X86] Remove unused check-prefix in constrained fma tests
Simon Pilgrim [Fri, 30 Oct 2020 16:22:55 +0000 (16:22 +0000)]
[CodeGen][X86] Remove unused check-prefix in constrained fma tests

3 years ago[CodeGen][X86] Remove unused check-prefix in movdir tests
Simon Pilgrim [Fri, 30 Oct 2020 16:18:44 +0000 (16:18 +0000)]
[CodeGen][X86] Remove unused check-prefix in movdir tests

3 years ago[lldb] Ignore binary data in crashlog
Jonas Devlieghere [Fri, 30 Oct 2020 16:17:10 +0000 (09:17 -0700)]
[lldb] Ignore binary data in crashlog

Skip the instruction stream section in the crashlog section.

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

3 years ago[CodeGen][X86] Cleanup + fix unused check-prefixes in bmi tests
Simon Pilgrim [Fri, 30 Oct 2020 16:13:14 +0000 (16:13 +0000)]
[CodeGen][X86] Cleanup + fix unused check-prefixes in bmi tests

3 years ago[CodeGen][X86] Tidyup CHECKs on bitscan tests
Simon Pilgrim [Fri, 30 Oct 2020 16:12:15 +0000 (16:12 +0000)]
[CodeGen][X86] Tidyup CHECKs on bitscan tests

3 years ago[CodeGen][X86] Remove unused check-prefix in bitscan tests
Simon Pilgrim [Fri, 30 Oct 2020 16:07:30 +0000 (16:07 +0000)]
[CodeGen][X86] Remove unused check-prefix in bitscan tests

3 years ago[CodeGen][X86] Remove unused check-prefix in bswap tests
Simon Pilgrim [Fri, 30 Oct 2020 16:04:20 +0000 (16:04 +0000)]
[CodeGen][X86] Remove unused check-prefix in bswap tests

3 years ago[CodeGen][X86] Cleanup + remove unused check-prefixes in avx union tests
Simon Pilgrim [Fri, 30 Oct 2020 16:01:33 +0000 (16:01 +0000)]
[CodeGen][X86] Cleanup + remove unused check-prefixes in avx union tests

3 years ago[CodeGen][X86] Remove unused check-prefix in amx inline asm tests
Simon Pilgrim [Fri, 30 Oct 2020 15:56:16 +0000 (15:56 +0000)]
[CodeGen][X86] Remove unused check-prefix in amx inline asm tests

3 years agoFix an embarrasing use-after-free from a895a446bcde
Pavel Labath [Fri, 30 Oct 2020 15:38:23 +0000 (16:38 +0100)]
Fix an embarrasing use-after-free from a895a446bcde

3 years ago[nfc] [lldb] Align `user_id_t` format to the current `DIERef` format
Jan Kratochvil [Fri, 30 Oct 2020 15:43:45 +0000 (16:43 +0100)]
[nfc] [lldb] Align `user_id_t` format to the current `DIERef` format

Current user_id_t format is:
        63{isDebugTypes} 62..32{dwo || 7fffffff}
        31..0 {die_offset}
while current DIERef format is (I have made up the bit positions but the
field widths do match):
        63{m_section==isDebugTypes} 62{m_dwo_num_valid} 61..32{m_dwo_num}
        31..0 {m_die_offset}

Proposing to change user_id_t to:
        63{isDebugTypes} 62{dwo_is_valid} 61..32{dwo; 0 if !valid}
        31..0 {die_offset}

There is no benefit of having 31-bits wide dwo_num in user_id_t when it
gets converted to 30-bits width in DIERef.

This patch is for future DWZ patchset which extends the dwo_is_valid bit
into a 2-bit field (normal, DWO, DWZ, DWZcommon) so that both user_id_t
and DIERef can be changed then the same way.

It would be best to somehow unify user_id_t and DIERef but I do not plan
to do that. user_id_t should probably remain a number for the Python API
compatibility while there still needs to be some class with all the
methods to access it.

SymbolFileDWARF::GetDwpSymbolFile() and SymbolFileDWARF::GetDIE use
0x3fffffff for DWP but that does not clash:

formerly:
  31bits32..62:0x7fffffff = normal unit / not any DWO
  31bits32..62:0x3fffffff = DWP
  31bits32..62:others = DWO unit number

after this patch:
  bit62=0 30bits32..61:any = normal unit / not any DWO
  bit62=1 30bits32..61:0x3fffffff = DWP
  bit62=1 30bits32..61:others = DWO unit number

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

3 years ago[VE][NFC] move scalar tests to Scalar/
Simon Moll [Fri, 30 Oct 2020 15:44:13 +0000 (16:44 +0100)]
[VE][NFC] move scalar tests to Scalar/

Restructure lit tests to follow downstream

Reviewed By: kaz7

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

3 years ago[llvm-cov][NFC] Remove unused prefixes from FileCheck usage
Keith Smiley [Fri, 30 Oct 2020 15:27:50 +0000 (08:27 -0700)]
[llvm-cov][NFC] Remove unused prefixes from FileCheck usage

This is to enable `--allow-unused-duplicates=false`. These prefixes
appear to be outdated and intentionally unused.

Reviewed By: vsk

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

3 years ago[gvn] PRE needs to skip convergent intrinsics/calls.
Michael Liao [Fri, 30 Oct 2020 14:55:04 +0000 (10:55 -0400)]
[gvn] PRE needs to skip convergent intrinsics/calls.

- As convergent intrinsics/calls could only be moved to
  control-equivalent blocks, or more precisely the same divergent
  branch, PRE needs to skip them.

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

3 years ago[DSE] Improve partial overlap detection
Evgeniy Brevnov [Thu, 29 Oct 2020 07:27:54 +0000 (14:27 +0700)]
[DSE] Improve partial overlap detection

Currently isOverwrite returns OW_MaybePartial even for accesss known not to overlap. This is not a big problem for legacy implementation (since isPartialOverwrite follows isOverwrite and clarifies the result). Contrary SSA based version does a lot of work to later find out that accesses don't overlap. Besides negative impact on compile time we quickly reach MemorySSAPartialStoreLimit and miss optimization opportunities.

Note: In fact, I think it would be cleaner implementation if isOverwrite returned fully clarified result in the first place whithout need to call isPartialOverwrite. This can be done as a follow up. What do you think?

Reviewed By: fhahn, asbirlea

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

3 years ago[SLP][X86] Extend target coverage for PR47629
Simon Pilgrim [Fri, 30 Oct 2020 15:18:01 +0000 (15:18 +0000)]
[SLP][X86] Extend target coverage for PR47629

As suggested on D90445, add tests for various SSE/AVX levels and more complex gep pointer offsets

3 years agoUse cast<> instead of dyn_cast<> as we dereference the pointers immediately. NFCI.
Simon Pilgrim [Fri, 30 Oct 2020 15:05:23 +0000 (15:05 +0000)]
Use cast<> instead of dyn_cast<> as we dereference the pointers immediately. NFCI.

Fix clang static analyzer warnings - we're better off relying on cast<> asserting on failure rather than a null dereference crash.

3 years ago[VE][NFC] Split up lowering init
Simon Moll [Fri, 30 Oct 2020 15:14:42 +0000 (16:14 +0100)]
[VE][NFC] Split up lowering init

Split up the monolithic VETargetLowering ctor into three initialization phases:
1. initRegisterClasses()
2. initSPUActions()
3. // TODO initVPUActions()

Reviewed By: kaz7

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

3 years agoAMDGPU: Fix missing writelane cases to skip with exec=0
Matt Arsenault [Sat, 17 Oct 2020 00:33:02 +0000 (20:33 -0400)]
AMDGPU: Fix missing writelane cases to skip with exec=0

3 years ago[clang][aarch64] Address various fixed-length SVE vector operations
Cullen Rhodes [Thu, 29 Oct 2020 11:04:35 +0000 (11:04 +0000)]
[clang][aarch64] Address various fixed-length SVE vector operations

This patch adds tests and support for operations on SVE vectors created
by the 'arm_sve_vector_bits' attribute, described by the Arm C Language
Extensions (ACLE, version 00bet6, section 3.7.3.3) for SVE [1].

This covers the following:
* VLSTs support the same forms of element-wise initialization as GNU
  vectors.
* VLSTs support the same built-in C and C++ operators as GNU vectors.
* Conditional and binary expressions containing GNU and SVE vectors
  (fixed or sizeless) are invalid since the ambiguity around the result
  type affects the ABI.

No functional changes were required to support vector initialization and
operators. The functional changes are to address unsupported conditional and
binary expressions.

[1] https://developer.arm.com/documentation/100987/latest

Reviewed By: fpetrogalli

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

3 years agoRevert "[MLIR][SPIRV] Start module combiner"
Mehdi Amini [Fri, 30 Oct 2020 15:09:09 +0000 (15:09 +0000)]
Revert "[MLIR][SPIRV] Start module combiner"

This reverts commit 316593ce839f05af936e705182747743e4638f3c.
Build is broken with:

TestModuleCombiner.cpp:(.text._ZN12_GLOBAL__N_122TestModuleCombinerPass14runOnOperationEv+0x195): undefined reference to `mlir::spirv::combine(llvm::MutableArrayRef<mlir::spirv::ModuleOp>, mlir::OpBuilder&, llvm::function_ref<void (mlir::spirv::ModuleOp, llvm::StringRef, llvm::StringRef)>)'

3 years ago[ARM] Update target triple in tests. NFC
David Green [Fri, 30 Oct 2020 15:06:49 +0000 (15:06 +0000)]
[ARM] Update target triple in tests. NFC

3 years ago[VPlan] Use isa<> instead getVPRecipeID in getFirstNonPhi (NFC).
Florian Hahn [Fri, 30 Oct 2020 14:45:08 +0000 (14:45 +0000)]
[VPlan] Use isa<> instead getVPRecipeID in getFirstNonPhi (NFC).

As per the comment in VPRecipeBase, clients should not rely on
getVPRecipeID, as it may change in the future. It should only be used in
classof implementations. Use isa instead in getFirstNonPhi.

3 years ago[SCEV] SCEVExpander::InsertNoopCastOfTo - reduce scope of pointer type. NFCI.
Simon Pilgrim [Fri, 30 Oct 2020 14:54:52 +0000 (14:54 +0000)]
[SCEV] SCEVExpander::InsertNoopCastOfTo - reduce scope of pointer type. NFCI.

By reducing the scope of the dyn_cast<PointerType> we can make this a cast<PointerType> and avoid clang static analyzer null deference warnings.

3 years ago[MLIR] Use `llvm::is_one_of` in walk templates
Frederik Gossen [Fri, 30 Oct 2020 14:41:37 +0000 (14:41 +0000)]
[MLIR] Use `llvm::is_one_of` in walk templates

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

3 years ago[lit] Ship and bundle license for lit package
serge-sans-paille [Mon, 26 Oct 2020 08:09:25 +0000 (09:09 +0100)]
[lit] Ship and bundle license for lit package

lit is bundled independently from LLVM in at least one location
(https://pypi.org/project/lit/), it's easier to state its license locally.

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

3 years ago[stack-clash] Fix probing of dynamic alloca
serge-sans-paille [Tue, 27 Oct 2020 09:59:42 +0000 (10:59 +0100)]
[stack-clash] Fix probing of dynamic alloca

- Perform the probing in the correct direction.
  Related to https://github.com/rust-lang/rust/pull/77885#issuecomment-711062924

- The first touch on a dynamic alloca cannot use a mov because it clobbers
  existing space. Use a xor 0 instead

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

3 years agoUse cast<> instead of dyn_cast<> as we dereference the pointer immediately. NFCI.
Simon Pilgrim [Fri, 30 Oct 2020 14:27:50 +0000 (14:27 +0000)]
Use cast<> instead of dyn_cast<> as we dereference the pointer immediately. NFCI.

Fix clang static analyzer warning - we know that the arg should be ConstantInt and we're better off relying on cast<> asserting on failure rather than a null dereference crash.

3 years agoBitcodeReader::popValue - pass SmallVectorImpl<> as const reference. NFCI.
Simon Pilgrim [Fri, 30 Oct 2020 12:05:39 +0000 (12:05 +0000)]
BitcodeReader::popValue - pass SmallVectorImpl<> as const reference. NFCI.

Fixes cppcheck warning.

3 years ago[clang] add fexperimental-strict-floating-point to test cases that fail on arm and...
Melanie Blower [Fri, 30 Oct 2020 14:29:37 +0000 (07:29 -0700)]
[clang] add fexperimental-strict-floating-point to test cases that fail on arm and aarch not sure this will work due to commit rG13bfd89c4962

3 years ago[lldb/DWARF] Fix dwo flavour of TestTypeGetModule
Pavel Labath [Fri, 30 Oct 2020 14:18:11 +0000 (15:18 +0100)]
[lldb/DWARF] Fix dwo flavour of TestTypeGetModule

SymbolFileDWARF::GetTypes was not handling dwo correctly. The fix is
simple -- adding a GetNonSkeletonUnit call -- but I've snuck in a small
refactor as well.

3 years agoAddress ABI issues introduced with CXCursor_CXXAddrspaceCastExpr
Marco Antognini [Thu, 29 Oct 2020 10:30:11 +0000 (10:30 +0000)]
Address ABI issues introduced with CXCursor_CXXAddrspaceCastExpr

Revert values in CXCursorKind as they were before
CXCursor_CXXAddrspaceCastExpr was introduced in a6a237f2046a ([OpenCL]
Added addrspace_cast operator in C++ mode., 2020-05-18).

Insert CXCursor_CXXAddrspaceCastExpr after the last expression in
CXCursorKind using the next available value.

Reviewed By: akyrtzi, svenvh

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

3 years ago[NFCI][SCEV] getPtrToIntExpr(): use SCEVRewriteVisitor<> for ptrtoint cast sinking
Roman Lebedev [Fri, 30 Oct 2020 12:34:11 +0000 (15:34 +0300)]
[NFCI][SCEV] getPtrToIntExpr(): use SCEVRewriteVisitor<> for ptrtoint cast sinking

This is functionally-identical to the previous implementation,
just using a generic interface to do that instead of hand-rolled one,
with caching as a bonus. Thought the sinking is still recursive..

Note that SCEVRewriteVisitor<>'s default implementations
don't preserve NoWrap flags on Add/Mul (but does on AddRec!),
but here we know we can preserve them,
so `visitAddExpr()`/`visitMulExpr()` are specialized.

3 years ago[TTI] Add VecPred argument to getCmpSelInstrCost.
Florian Hahn [Fri, 30 Oct 2020 13:48:28 +0000 (13:48 +0000)]
[TTI] Add VecPred argument to getCmpSelInstrCost.

On some targets, like AArch64, vector selects can be efficiently lowered
if the vector condition is a compare with a supported predicate.

This patch adds a new argument to getCmpSelInstrCost, to indicate the
predicate of the feeding select condition. Note that it is not
sufficient to use the context instruction when querying the cost of a
vector select starting from a scalar one, because the condition of the
vector select could be composed of compares with different predicates.

This change greatly improves modeling the costs of certain
compare/select patterns on AArch64.

I am also planning on putting up patches to make use of the new argument in
SLPVectorizer & LV.

Reviewed By: dmgreen, RKSimon

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

3 years agoPR47372: Fix Lambda invoker calling conventions
Erich Keane [Fri, 16 Oct 2020 16:09:09 +0000 (09:09 -0700)]
PR47372: Fix Lambda invoker calling conventions

As mentioned in the defect, the lambda static invoker does not follow
the calling convention of the lambda itself, which seems wrong. This
patch ensures that the calling convention of operator() is passed onto
the invoker and conversion-operator type.

This is accomplished by extracting the calling-convention determination
code out into a separate function in order to better reflect the 'thiscall'
work, as well as somewhat better support the future implementation of
https://devblogs.microsoft.com/oldnewthing/20150220-00/?p=44623

For any target (basically just win32) that has a different free and
static function calling convention, this generates BOTH alternatives.
This required some work to get the Windows mangler to work correctly for
this, as well as some tie-breaking for the unary operators.

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

3 years ago[MLIR][SPIRV] Start module combiner
ergawy [Fri, 30 Oct 2020 13:18:29 +0000 (09:18 -0400)]
[MLIR][SPIRV] Start module combiner

This commit adds a new library that merges/combines a number of spv
modules into a combined one. The library has a single entry point:
combine(...).

To combine a number of MLIR spv modules, we move all the module-level ops
from all the input modules into one big combined module. To that end, the
combination process can proceed in 2 phases:

  (1) resolving conflicts between pairs of ops from different modules
  (2) deduplicate equivalent ops/sub-ops in the merged module. (TODO)

This patch implements only the first phase.

Reviewed By: antiagainst

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

3 years ago[SVE] Add fatal error for unnamed SVE variadic arguments
David Sherwood [Tue, 27 Oct 2020 13:59:29 +0000 (13:59 +0000)]
[SVE] Add fatal error for unnamed SVE variadic arguments

We don't currently support passing unnamed variadic SVE arguments
so I've added a fatal error if we hit such cases to prevent any
silent ABI issues in future.

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

3 years ago[ARM] Match MVE vqdmulh
David Green [Fri, 30 Oct 2020 13:34:27 +0000 (13:34 +0000)]
[ARM] Match MVE vqdmulh

This adds ISel matching for a form of VQDMULH. There are several ir
patterns that we could match to that instruction, this one is for:

min(ashr(mul(sext(a), sext(b)), 7), 127)

Which is what llvm will optimize to once it has removed the max that
usually makes up the min/max saturate pattern, as in this case the
compare will always be false. The additional complication to match i32
patterns (which extend into an i64) is that the min will be a
vselect/setcc, as vmin is not supported for i64 vectors. Tablegen
patterns have also been updated to attempt to reuse the MVE_TwoOpPattern
patterns.

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

3 years ago[lldb/test] Remove a double debugserver launch in TestGdbRemoteGPacket
Pavel Labath [Fri, 30 Oct 2020 13:24:21 +0000 (14:24 +0100)]
[lldb/test] Remove a double debugserver launch in TestGdbRemoteGPacket

Debug server is already launched by prep_debug_monitor_and_inferior. The
second seems to have been benign so far, but after 8cc49bec2 this test
started failing frequently on GreenDragon, and this is the only unusual
thing about it.

3 years ago[lldb/test] Simplify/generalize YAMLModuleTester
Pavel Labath [Thu, 29 Oct 2020 13:25:24 +0000 (14:25 +0100)]
[lldb/test] Simplify/generalize YAMLModuleTester

The class only supports a single DWARF unit (needed for my new test), and it
reimplements chunks of object and symbol file classes. We can just make it use
the real thing, save some LOC and get the full feature set.

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

3 years ago[libc++] Add a new concept of ConfigAction, and use it in the DSL
Louis Dionne [Thu, 29 Oct 2020 20:02:21 +0000 (16:02 -0400)]
[libc++] Add a new concept of ConfigAction, and use it in the DSL

This will allow adding bare compiler flags through the new
configuration DSL. Previously, this would have required adding
a Lit feature for each such flag.

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

3 years ago[yaml2obj] - Make `Section::Link` field to be `Optional<>`.
Georgii Rymar [Thu, 29 Oct 2020 13:04:45 +0000 (16:04 +0300)]
[yaml2obj] - Make `Section::Link` field to be `Optional<>`.

`Link` is not an optional field currently.
Because of this it is not convenient to write macros.

This makes it optional and fixes corresponding test cases.

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

3 years ago[clang][FPEnv] Diagnose Strict FP pragmas if target does not support StrictFP
Melanie Blower [Wed, 28 Oct 2020 16:23:21 +0000 (09:23 -0700)]
[clang][FPEnv] Diagnose Strict FP pragmas if target does not support StrictFP

Reviewers: sepavloff, kpn, aaron.ballman

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

3 years ago[mlir] Implement lowering to LLVM of async.execute ops with token dependencies
Eugene Zhulenev [Fri, 30 Oct 2020 12:19:42 +0000 (05:19 -0700)]
[mlir] Implement lowering to LLVM of async.execute ops with token dependencies

Add support for lowering `async.execute` operations with token dependencies

Example:

```
%dep = ... : !async.token
%token = async.execute[%dep] {
...
}
```

Token dependencies lowered to `async.await` operations inside the outline coroutine body.

Reviewed By: herhut, mehdi_amini, ftynse

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

3 years ago[AST] Fix traversal over CXXConstructExpr in Syntactic mode
Stephen Kelly [Sun, 21 Jun 2020 12:31:27 +0000 (13:31 +0100)]
[AST] Fix traversal over CXXConstructExpr in Syntactic mode

Summary:
Skip over elidable nodes, and ensure that intermediate
CXXFunctionalCastExpr nodes are also skipped if they are semantic.

Reviewers: klimek, ymandel

Subscribers: cfe-commits

Tags: #clang

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

3 years ago[Aarch64] Fix assumption that Windows implies x86
David Truby [Mon, 26 Oct 2020 14:45:11 +0000 (14:45 +0000)]
[Aarch64] Fix assumption that Windows implies x86

When compiling for Windows on Arm the amd64 debug interfce from the Visual
Studio SDK is used as the cmake currently only distinguishes between x86 and
amd64 by checking the pointer size. Instead we can get the target
architecture for the compilier and check that to distinguish between
architectures.

3 years agoRevert rG22c383763456 "[RISCV] Remove include of RISCVRegisterInfo.h from RISCVBaseIn...
Simon Pilgrim [Fri, 30 Oct 2020 11:59:21 +0000 (11:59 +0000)]
Revert rG22c383763456 "[RISCV] Remove include of RISCVRegisterInfo.h from RISCVBaseInfo.h"

This reverts commit 22c38376345670c1883963e5e1cccd597a15b3a5.

This is causing a build failure with MSVC - reported on D90322

3 years ago[Flang] Fix build failures (NFC)
Andrzej Warzynski [Fri, 30 Oct 2020 11:27:04 +0000 (11:27 +0000)]
[Flang] Fix build failures (NFC)

Some changes introduced in https://reviews.llvm.org/D88655 cause compiler
warnings. Since in Flang warnings are treated as errors (`-Werror` is on by
default), these are in practice compiler errors (verified with clang-10 and
clang-11, gcc-10). This patches fixes these warning/failures.

Warning/error 1:
```
llvm-project/flang/lib/Semantics/check-omp-structure.cpp:107:3: error:
unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
```

Warning/error 2:
```
llvm-project/flang/lib/Semantics/check-directive-structure.h:39:9: error: field
'currentDirective_' will be initialized after field 'upperCaseDirName_'
[-Werror,-Wreorder-ctor]
```

Failing buildbot:
* http://lab.llvm.org:8011/#/builders/33/builds/386

3 years ago[AMDGPU] SILowerControlFlow::removeMBBifRedundant. Refactoring plus fix for the null...
alex-t [Wed, 28 Oct 2020 16:01:02 +0000 (19:01 +0300)]
[AMDGPU] SILowerControlFlow::removeMBBifRedundant. Refactoring plus fix for the null MBB pointer in MF->splice

Detailed description: This change addresses the refactoring adviced by foad. It also contain the fix for the case when getNextNode is null if the successor block is the last in MachineFunction.

Reviewed By: foad

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

3 years ago[clangd] Fix MSVC implicit capture build failure.
Simon Pilgrim [Fri, 30 Oct 2020 11:36:27 +0000 (11:36 +0000)]
[clangd] Fix MSVC implicit capture build failure.

MSVC builds were failing because the constexpr wasn't couldn't be captured by the lamdba.

Fix an implicit double to float truncation warning as well.

3 years ago[SROA] Pass Twine by const reference. NFCI.
Simon Pilgrim [Thu, 29 Oct 2020 17:43:24 +0000 (17:43 +0000)]
[SROA] Pass Twine by const reference. NFCI.

Fixes clang-tidy warnings.