2 weeks agoMerge branch 'user_id_t3-debug-scoped-errors2-dwz3-main-test-symlink-misc' into user_... dwz
Jan Kratochvil [Wed, 9 Sep 2020 07:46:50 +0000 (09:46 +0200)]
Merge branch 'user_id_t3-debug-scoped-errors2-dwz3-main-test-symlink-misc' into user_id_t3-debug-scoped-errors2-dwz3-main-test-symlink-misc-noerrors2

2 weeks agoMerge branch 'user_id_t3-debug-scoped-errors2-dwz3-main-test-symlink' into user_id_t3...
Jan Kratochvil [Wed, 9 Sep 2020 07:46:48 +0000 (09:46 +0200)]
Merge branch 'user_id_t3-debug-scoped-errors2-dwz3-main-test-symlink' into user_id_t3-debug-scoped-errors2-dwz3-main-test-symlink-misc

2 weeks agoMerge branch 'user_id_t3-debug-scoped-errors2-dwz3-main-test' into user_id_t3-debug...
Jan Kratochvil [Wed, 9 Sep 2020 07:46:46 +0000 (09:46 +0200)]
Merge branch 'user_id_t3-debug-scoped-errors2-dwz3-main-test' into user_id_t3-debug-scoped-errors2-dwz3-main-test-symlink

2 weeks agoMerge branch 'user_id_t3-debug-scoped-errors2-dwz3-main' into user_id_t3-debug-scoped...
Jan Kratochvil [Wed, 9 Sep 2020 07:46:44 +0000 (09:46 +0200)]
Merge branch 'user_id_t3-debug-scoped-errors2-dwz3-main' into user_id_t3-debug-scoped-errors2-dwz3-main-test

2 weeks agoMerge branch 'user_id_t3-debug-scoped-errors2-dwz3' into user_id_t3-debug-scoped...
Jan Kratochvil [Wed, 9 Sep 2020 07:46:43 +0000 (09:46 +0200)]
Merge branch 'user_id_t3-debug-scoped-errors2-dwz3' into user_id_t3-debug-scoped-errors2-dwz3-main

2 weeks agoMerge branch 'user_id_t3-debug-scoped-errors2' into user_id_t3-debug-scoped-errors2...
Jan Kratochvil [Wed, 9 Sep 2020 07:46:41 +0000 (09:46 +0200)]
Merge branch 'user_id_t3-debug-scoped-errors2' into user_id_t3-debug-scoped-errors2-dwz3

2 weeks agoMerge branch 'user_id_t3-debug-scoped' into user_id_t3-debug-scoped-errors2
Jan Kratochvil [Wed, 9 Sep 2020 07:46:39 +0000 (09:46 +0200)]
Merge branch 'user_id_t3-debug-scoped' into user_id_t3-debug-scoped-errors2

2 weeks agoMerge branch 'user_id_t3-debug' into user_id_t3-debug-scoped
Jan Kratochvil [Wed, 9 Sep 2020 07:46:38 +0000 (09:46 +0200)]
Merge branch 'user_id_t3-debug' into user_id_t3-debug-scoped

2 weeks agoMerge branch 'user_id_t3' into user_id_t3-debug
Jan Kratochvil [Wed, 9 Sep 2020 07:46:36 +0000 (09:46 +0200)]
Merge branch 'user_id_t3' into user_id_t3-debug

2 weeks agoMerge remote-tracking branch 'origin/master' into user_id_t3
Jan Kratochvil [Wed, 9 Sep 2020 07:46:34 +0000 (09:46 +0200)]
Merge remote-tracking branch 'origin/master' into user_id_t3

2 weeks ago[MLIR][Standard] Update `tensor_from_elements` assembly format
Frederik Gossen [Wed, 9 Sep 2020 07:44:38 +0000 (07:44 +0000)]
[MLIR][Standard] Update `tensor_from_elements` assembly format

Remove the redundant parenthesis that are used for none of the other operation

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

2 weeks ago[gn build] Port c0e5e3fbfa5
LLVM GN Syncbot [Wed, 9 Sep 2020 07:32:57 +0000 (07:32 +0000)]
[gn build] Port c0e5e3fbfa5

2 weeks ago[Ignore Expressions] Fix performance regression by inlining `Ignore*SingleStep`
Eduardo Caldas [Tue, 8 Sep 2020 11:32:02 +0000 (11:32 +0000)]
[Ignore Expressions] Fix performance regression by inlining `Ignore*SingleStep`

We also add a `const` versions of `IgnoreExprNodes`

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

2 weeks ago[lldb][doc] Mention python3-dev instead of python2.7-dev in build docs
Raphael Isemann [Wed, 9 Sep 2020 07:29:51 +0000 (09:29 +0200)]
[lldb][doc] Mention python3-dev instead of python2.7-dev in build docs

2 weeks ago[MLIR] Add debug support for ignored patterns
Frederik Gossen [Wed, 9 Sep 2020 07:16:45 +0000 (07:16 +0000)]
[MLIR] Add debug support for ignored patterns

The rewrite engine's cost model may determine some patterns to be irrelevant
ahead of their application. These patterns were silently ignored previously and
now cause a message in `--debug` mode.

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

2 weeks ago[Statepoints] Properly handle const base pointer.
Denis Antrushin [Mon, 7 Sep 2020 15:04:07 +0000 (22:04 +0700)]
[Statepoints] Properly handle const base pointer.

Current code in InstEmitter assumes all GC pointers are either
VRegs or stack slots - hence, taking only one operand.
But it is possible to have constant base, in which case it
occupies two machine operands.

Add a convinience function to StackMaps to get index of next
meta argument and use it in InsrEmitter to properly advance to
the next statepoint meta operand.

Reviewed By: reames

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

2 weeks ago[ARM] Try to rematerialize VCTP instructions
Sam Parker [Wed, 9 Sep 2020 06:32:30 +0000 (07:32 +0100)]
[ARM] Try to rematerialize VCTP instructions

We really want to try and avoid spilling P0, which can be difficult
since there's only one register, so try to rematerialize any VCTP

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

2 weeks ago[Attributor][NFC] Improve check lines in depgraph.ll
Johannes Doerfert [Tue, 8 Sep 2020 20:58:58 +0000 (15:58 -0500)]
[Attributor][NFC] Improve check lines in depgraph.ll

This adds the check lines with -NEXT so we see any change in the future.

2 weeks ago[Attributor] Cleanup `::initialize` of various AAs
Johannes Doerfert [Sun, 30 Aug 2020 19:14:33 +0000 (14:14 -0500)]
[Attributor] Cleanup `::initialize` of various AAs

This commit cleans up the ::initialize method of various AAs in the
following ways:
  - If an associated function is required, give up on declarations.
    This was discovered as a real problem when lots of llvm.dbg.XXX
    call sites were assumed `noreturn` until proven otherwise. That
    does not make any sense and caused huge regressions and missed
  - Require more associated declarations for function interface AAs.
  - Use the IRAttribute::initialize to determine if function interface
    AAs can be used in IPO, don't replicate the checks (especially
    isFunctionIPOAmendable) all over the place. Arguably the function
    declaration check should be moved to some central place to.

2 weeks ago[llvm-cov gcov] Simply computation of line counts and exit block counter
Fangrui Song [Wed, 9 Sep 2020 06:15:37 +0000 (23:15 -0700)]
[llvm-cov gcov] Simply computation of line counts and exit block counter

2 weeks ago[Attributor] Associate the callback callee with a call site argument (if any)
Johannes Doerfert [Fri, 4 Sep 2020 16:20:28 +0000 (11:20 -0500)]
[Attributor] Associate the callback callee with a call site argument (if any)

If we have a callback, call site arguments were already associated with
the callback callee. Now we also associate the function with the
callback callee, thus we know ensure that the following holds true (if
all return nonnull):
   `getAssociatedArgument()->getParent() == getAssociatedFunction()`

To test this an early exit from
is included as well. Without the change to getAssociatedFunction() this
kind of early exit for declarations would cause callback call site
arguments to miss out.

2 weeks ago[Attributor] Cleanup `IRPosition::getArgNo` usages
Johannes Doerfert [Sat, 5 Sep 2020 18:20:31 +0000 (13:20 -0500)]
[Attributor] Cleanup `IRPosition::getArgNo` usages

As we handle callback calls we need to disambiguate the call site
argument number from the callee argument number. While always equal in
non-callback calls, a callback comes with a partial parameter-argument
mapping so there is no implicit correspondence. Here we split
`IRPosition::getArgNo()` into two public functions, `getCallSiteArgNo()`
and `getCalleeArgNo()`. Usages are adjusted to pick the right one for
their purpose. This fixed some problems that would have been exposed as
we more aggressively optimize callbacks.

2 weeks ago[Attributor] Selectively look at the callee even when there are operand bundles
Johannes Doerfert [Fri, 4 Sep 2020 16:14:33 +0000 (11:14 -0500)]
[Attributor] Selectively look at the callee even when there are operand bundles

While operand bundles carry unpredictable semantics, we know some of
them and can therefore "ignore" them. In this case we allow to look at
the declaration of `llvm.assume` when asked for the attributes at a call
site. The assume operand bundles we have do not invalidate the
declaration attributes.

We cannot test this in isolation because the llvm.assume attributes are
determined by the parser. However, a follow up patch will provide test

2 weeks ago[Attributor] Re-enable a run line in noalias.ll
Johannes Doerfert [Fri, 4 Sep 2020 16:41:58 +0000 (11:41 -0500)]
[Attributor] Re-enable a run line in noalias.ll

This was disabled as we were looking for a weird CGSCC problem. I
think/hope we fixed it as there were a lot of updates recently. I could
never reproduce this locally so I'll use the pre-commit phab builds to
confirm this suspicion and if they seem to be happy I'll assume this is

Reviewed By: sstefan1

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

2 weeks ago[Attributor] Provide a command line option that limits recursion depth
Johannes Doerfert [Tue, 18 Aug 2020 20:27:41 +0000 (15:27 -0500)]
[Attributor] Provide a command line option that limits recursion depth

In `MultiSource/Benchmarks/tramp3d-v4/tramp3d-v4.cpp` we initialized
attributes until stack frame ~35k caused space to run out. The initial
size 1024 is pretty much random.

2 weeks ago[flang][msvc] Avoid range-based for over initializer_list. NFC.
Michael Kruse [Wed, 9 Sep 2020 02:52:23 +0000 (21:52 -0500)]
[flang][msvc] Avoid range-based for over initializer_list. NFC.

Msvc crashes with "INTERNAL COMPILER ERROR" when iterating over an `std::initializer_list` in a constexpr constructor. Explicitly use the iterator instead.

This patch is part of the series to [[ http://lists.llvm.org/pipermail/flang-dev/2020-July/000448.html | make flang compilable with MS Visual Studio ]].

Reviewed By: isuruf

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

2 weeks ago[NFC] Move functon from IndVarSimplify to SCEV
Max Kazantsev [Wed, 9 Sep 2020 04:20:59 +0000 (11:20 +0700)]
[NFC] Move functon from IndVarSimplify to SCEV

This function can be reused in other places.

Differential Revision: https://reviews.llvm.org/D87274
Reviewed By: fhahn, lebedev.ri

2 weeks ago[libFuzzer] Add a command-line option for tracing mutation of corpus inputs in the...
Dokyung Song [Wed, 8 Jul 2020 19:30:53 +0000 (19:30 +0000)]
[libFuzzer] Add a command-line option for tracing mutation of corpus inputs in the dot graph format.

This patch adds a new command-line option -mutation_graph_file=FILE for
debugging purposes, which traces how corpus inputs evolve during a fuzzing
run. For each new input that is added to the corpus, a new vertex corresponding
to the added input, as well as a new edge that connects its base input to itself
are written to the given file. Each vertex is labeled with the filename of the
input, and each edge is labeled with the mutation sequence that led to the input
w.r.t. its base input.

The format of the mutation graph file is the dot file format. Once prepended and
appended with "graph {" and "}", respectively, the graph becomes a valid dot
file and can be visualized.

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

2 weeks ago[Hexagon] Fix order of operands in V6_vdealb4w
Krzysztof Parzyszek [Wed, 9 Sep 2020 03:09:28 +0000 (22:09 -0500)]
[Hexagon] Fix order of operands in V6_vdealb4w

2 weeks ago[llvm-cov gcov] Compute unmeasured arc counts by Kirchhoff's circuit law
Fangrui Song [Wed, 9 Sep 2020 01:45:11 +0000 (18:45 -0700)]
[llvm-cov gcov] Compute unmeasured arc counts by Kirchhoff's circuit law

For a CFG G=(V,E), Knuth describes that by Kirchoff's circuit law, the minimum
number of counters necessary is |E|-(|V|-1). The emitted edges form a spanning
tree. libgcov emitted .gcda files leverages this optimization while clang
--coverage's doesn't.

Propagate counts by Kirchhoff's circuit law so that llvm-cov gcov can
correctly print line counts of gcc --coverage emitted files and enable
the future improvement of clang --coverage.

2 weeks ago[PowerPC] Set setMaxAtomicSizeInBitsSupported appropriately for 32-bit PowerPC in...
Brad Smith [Wed, 9 Sep 2020 01:21:14 +0000 (21:21 -0400)]
[PowerPC] Set setMaxAtomicSizeInBitsSupported appropriately for 32-bit PowerPC in PPCTargetLowering

Reviewed By: nemanjai

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

2 weeks ago[EarlyCSE] Add testcase for masked loads and stores, NFC
Krzysztof Parzyszek [Wed, 9 Sep 2020 00:27:37 +0000 (19:27 -0500)]
[EarlyCSE] Add testcase for masked loads and stores, NFC

2 weeks ago[obj2yaml][test] Test generating and dumping a broken debug_ranges section.
Xing GUO [Wed, 9 Sep 2020 00:48:04 +0000 (08:48 +0800)]
[obj2yaml][test] Test generating and dumping a broken debug_ranges section.

This patch tests generating and dumping a broken debug_ranges section.

Reviewed By: jhenderson

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

2 weeks ago[NFC][ThinLTO] EmbedBitcodeSection doesn't need the Config
Mircea Trofin [Tue, 8 Sep 2020 23:42:16 +0000 (16:42 -0700)]
[NFC][ThinLTO] EmbedBitcodeSection doesn't need the Config

Instead, passing in the command line options, initialized to nullptr. In
an upcoming patch, we can then use the parameter to pass actual command
line options.

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

2 weeks agoHandle masked loads and stores in MemoryLocation/Dependence
Krzysztof Parzyszek [Wed, 2 Sep 2020 19:05:41 +0000 (14:05 -0500)]
Handle masked loads and stores in MemoryLocation/Dependence

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

2 weeks agoRemove unused variable(s)
David Blaikie [Tue, 8 Sep 2020 23:12:46 +0000 (16:12 -0700)]
Remove unused variable(s)

2 weeks ago[NFC] Fixing a gcc compiler warning.
Puyan Lotfi [Tue, 8 Sep 2020 23:42:38 +0000 (19:42 -0400)]
[NFC] Fixing a gcc compiler warning.

warning: type qualifiers ignored on cast result type [-Wignored-qualifiers]

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

2 weeks ago[llvm] [unittest] Allow getting a C string from the TempDir helper class
Sergej Jaskiewicz [Tue, 8 Sep 2020 22:53:01 +0000 (01:53 +0300)]
[llvm] [unittest] Allow getting a C string from the TempDir helper class

The TempDir.path() member function returns a StringRef. We've been
calling the data() method on that StringRef, which does not guarantee
to return a null-terminated string (required by chdir and other POSIX

Introduce the c_str() method in the TempDir class, which returns the
proper string without the need to create a copy of the path at use site.

2 weeks ago[SelectionDAGBuilder] Remove Unnecessary FastMathFlags temporary. Use SDNodeFlags...
Craig Topper [Tue, 8 Sep 2020 22:48:47 +0000 (15:48 -0700)]
[SelectionDAGBuilder] Remove Unnecessary FastMathFlags temporary. Use SDNodeFlags instead. NFCI

This was a missed simplication in D87200

2 weeks ago[libunwind] Replace chain-of-ifdefs for dl_iterate_phdr
Ryan Prichard [Fri, 28 Aug 2020 06:46:49 +0000 (23:46 -0700)]
[libunwind] Replace chain-of-ifdefs for dl_iterate_phdr

Define a _LIBUNWIND_USE_DL_ITERATE_PHDR macro in config.h when there is
no other unwind info lookup method. Also define a

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

2 weeks agollvm-symbolizer: Add optional "start file" to match "start line"
David Blaikie [Tue, 8 Sep 2020 21:05:20 +0000 (14:05 -0700)]
llvm-symbolizer: Add optional "start file" to match "start line"

Since a function might have portions of its code coming from multiple
different files, "start line" is ambiguous (it can't just be resolved
relative to the file/line specified). Add start file to disambiguate it.

2 weeks ago[SelectionDAGBuilder] Pass fast math flags to getNode calls rather than trying to...
Craig Topper [Tue, 8 Sep 2020 22:09:35 +0000 (15:09 -0700)]
[SelectionDAGBuilder] Pass fast math flags to getNode calls rather than trying to set them after the fact.:

This removes the after the fact FMF handling from D46854 in favor of passing fast math flags to getNode. This should be a superset of D87130.

This required adding a SDNodeFlags to SelectionDAG::getSetCC.

Now we manage to contant fold some stuff undefs during the
initial getNode that we don't do in later DAG combines.

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

2 weeks agoInsert missing bracket in docs.
Nate Voorhies [Tue, 8 Sep 2020 21:19:00 +0000 (14:19 -0700)]
Insert missing bracket in docs.

Body of unrolled loop was missing opening bracket.

Reviewed By: Meinersbur

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

2 weeks ago[MLIR] Change Operation::create() methods to use Value/Type/Block ranges.
Rahul Joshi [Wed, 2 Sep 2020 22:33:19 +0000 (15:33 -0700)]
[MLIR] Change Operation::create() methods to use Value/Type/Block ranges.

- Introduce a new BlockRange class to represent range of blocks (constructible from
  an ArrayRef<Block *> or a SuccessorRange);
- Change Operation::create() methods to use TypeRange for result types, ValueRange for
  operands and BlockRange for successors.

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

2 weeks ago[Hexagon] Handle widening of truncation's operand with legal result
Krzysztof Parzyszek [Tue, 8 Sep 2020 19:20:41 +0000 (14:20 -0500)]
[Hexagon] Handle widening of truncation's operand with legal result

Failing example: v8i8 = truncate v8i32. v8i8 is legal, but v8i32 was
widened to HVX. Make sure that v8i8 does not get altered (even if it's
changed to another legal type).

2 weeks ago[NFC][Asan] Remove Debug code
Vitaly Buka [Tue, 1 Sep 2020 12:26:53 +0000 (05:26 -0700)]
[NFC][Asan] Remove Debug code

Used for https://github.com/google/sanitizers/issues/1193

Reviewed By: morehouse

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

2 weeks ago[Asan] Don't crash if metadata is not initialized
Vitaly Buka [Tue, 1 Sep 2020 11:49:49 +0000 (04:49 -0700)]
[Asan] Don't crash if metadata is not initialized

Fixes https://github.com/google/sanitizers/issues/1193.

AsanChunk can be uninitialized yet just after return from the secondary
allocator. If lsan starts scan just before metadata assignment it can
fail to find corresponding AsanChunk.

It should be safe to ignore this and let lsan to assume that
AsanChunk is in the beginning of the block. This block is from the
secondary allocator and created with mmap, so it should not contain
any pointers and will make lsan to miss some leaks.

Similar already happens for primary allocator. If it can't find real
AsanChunk it falls back and assume that block starts with AsanChunk.
Then if the block is already returned to allocator we have  garbage in
AsanChunk and may scan dead memory hiding some leaks.
I'll fix this in D87135.

Reviewed By: morehouse

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

2 weeks agoRevert "Retry of D84974"
Walter Erquinigo [Tue, 8 Sep 2020 20:40:42 +0000 (13:40 -0700)]
Revert "Retry of D84974"

This reverts commit 5b2b4f331d78f326e5e29166bec5ad92c864343d.

This caused a link error in

2 weeks ago[HIP] Add gfx1031 and gfx1030
Yaxun (Sam) Liu [Tue, 8 Sep 2020 20:01:30 +0000 (16:01 -0400)]
[HIP] Add gfx1031 and gfx1030

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

2 weeks agoSema: extract a check for `isCFError` (NFC)
Saleem Abdulrasool [Tue, 8 Sep 2020 20:06:07 +0000 (20:06 +0000)]
Sema: extract a check for `isCFError` (NFC)

Extract a simple check to check if a `RecordDecl` is a `CFError` Decl.
This is a simple refactoring to prepare for an upcoming change.  NFC.

Patch is extracted from

2 weeks agofix typos; improve a couple of descriptions;
Paul C. Anagnostopoulos [Sun, 30 Aug 2020 18:00:25 +0000 (14:00 -0400)]
fix typos; improve a couple of descriptions;
add release note

2 weeks ago[ValueTracking] Compute known bits of min/max intrinsics
Nikita Popov [Tue, 8 Sep 2020 19:06:59 +0000 (21:06 +0200)]
[ValueTracking] Compute known bits of min/max intrinsics

Implement known bits for the min/max intrinsics based on the
recently added KnownBits primitives.

2 weeks ago[InstCombine] Add tests for known bits for min/max intrinsics (NFC)
Nikita Popov [Tue, 8 Sep 2020 18:57:40 +0000 (20:57 +0200)]
[InstCombine] Add tests for known bits for min/max intrinsics (NFC)

We already have test coverage for the underlying calculation,
this just checked that the folding is wired up...

2 weeks agoRetry of D84974
Walter Erquinigo [Wed, 2 Sep 2020 01:52:14 +0000 (18:52 -0700)]
Retry of D84974

The test is being disabled on Linux, as lldb-vscode has a bug with
--wait-for on LInux.
I'm also fixing some compilation warnings.

2 weeks ago[UnifyFunctionExitNodes] Remove unused getters, NFC
David Stenberg [Tue, 8 Sep 2020 16:54:30 +0000 (18:54 +0200)]
[UnifyFunctionExitNodes] Remove unused getters, NFC

The get{Return,Unwind,Unreachable}Block functions in
UnifyFunctionExitNodes have not been used for many years,
so just remove them.

Reviewed By: bjope

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

2 weeks ago[LLD][ELF] Fix performance of MarkLive::scanEhFrameSection
Andrew Ng [Mon, 7 Sep 2020 16:36:14 +0000 (17:36 +0100)]
[LLD][ELF] Fix performance of MarkLive::scanEhFrameSection

MarkLive::scanEhFrameSection is used to retain personality/LSDA
functions when --gc-sections is enabled.

Improve its performance by only iterating over the .eh_frame relocations
that need to be resolved for an EhSectionPiece. This optimization makes
the same assumption as elsewhere in LLD that the .eh_frame relocations
are sorted by r_offset.

This appears to be a performance regression introduced in commit
e6c24299d237 (https://reviews.llvm.org/D59800).

This change has been seen to reduce link time by up to ~50%.

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

2 weeks ago[llvm-install-name-tool] Add a test with multiple input files
Alexander Shaposhnikov [Tue, 8 Sep 2020 17:24:58 +0000 (10:24 -0700)]
[llvm-install-name-tool] Add a test with multiple input files

This diff adds a test which checks the error-message when multiple input files
are passed to llvm-install-name-tool.

Test plan: make check-all

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

2 weeks agoUpdate clang/test/Driver/darwin-infer-simulator-sdkroot.c
Azharuddin Mohammed [Tue, 8 Sep 2020 17:57:06 +0000 (10:57 -0700)]
Update clang/test/Driver/darwin-infer-simulator-sdkroot.c

 - Fix it to work on Apple Silicon
 - Add testcases for simulators running on Apple Silicon

2 weeks ago[InstCombine] Fold comparison of abs with int min
Nikita Popov [Tue, 8 Sep 2020 18:23:03 +0000 (20:23 +0200)]
[InstCombine] Fold comparison of abs with int min

If the abs is poisoning, this is already folded to true/false.
For non-poisoning abs, we can convert this to a comparison with
the operand.

2 weeks ago[InstCombine] Test comparison of abs with int min (NFC)
Nikita Popov [Tue, 8 Sep 2020 18:20:32 +0000 (20:20 +0200)]
[InstCombine] Test comparison of abs with int min (NFC)

2 weeks ago[InstCombine] Fold abs of known negative operand
Nikita Popov [Sat, 5 Sep 2020 15:23:48 +0000 (17:23 +0200)]
[InstCombine] Fold abs of known negative operand

If we know that the abs operand is known negative, we can replace
it with a neg.

To avoid computing known bits twice, I've removed the fold for the
non-negative case from InstSimplify. Both the non-negative and the
negative case are handled by InstCombine now, with one known bits call.

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

2 weeks ago[Coroutine] Make dealing with alloca spills more robust
Xun Li [Tue, 8 Sep 2020 17:58:35 +0000 (10:58 -0700)]
[Coroutine] Make dealing with alloca spills more robust

D66230 attempted to fix a problem where when there are allocas used before CoroBegin.
It keeps allocas and their uses stay in put if there are no escapse/changes to the data before CoroBegin.
Unfortunately that's incorrect.
Consider this code:

%var = alloca i32
%1 = getelementptr .. %var; stays put
%f = call i8* @llvm.coro.begin
store ... %1
After this fix, %1 will now stay put, however if a store happens after coro.begin and hence modifies the content, this change will not be reflected in the coroutine frame (and will eventually be DCEed).
To generalize the problem, if any alias ptr is created before coro.begin for an Alloca and that alias ptr is latter written into after coro.begin, it will lead to incorrect behavior.

There are also a few other minor issues, such as incorrect dominate condition check in the ptr visitor, unhandled memory intrinsics and etc.
Ths patch attempts to fix some of these issue, and make it more robust to deal with aliases.

While visiting through the alloca pointer, we also keep track of all aliases created that will be used after CoroBegin. We track the offset of each alias, and then reacreate these aliases after CoroBegin using these offset.
It's worth noting that this is not perfect and there will still be cases we cannot handle. I think it's impractical to handle all cases given the current design.
This patch makes it more robust and should be a pure win.
In the meantime, we need to think about what how to completely elimiante these issues, likely through the route as @rjmccall mentioned in D66230.

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

2 weeks ago[X86] SSE4_A should only imply SSE3 not SSSE3 in the frontend.
Craig Topper [Tue, 8 Sep 2020 17:49:32 +0000 (10:49 -0700)]
[X86] SSE4_A should only imply SSE3 not SSSE3 in the frontend.

SSE4_1 and SSE4_2 due imply SSSE3. So I guess I got confused when
switching the code to being table based in D83273.

Fixes PR47464

2 weeks agoAdd detailed reference for the SearchableTables backend.
Paul C. Anagnostopoulos [Wed, 2 Sep 2020 15:50:30 +0000 (11:50 -0400)]
Add detailed reference for the SearchableTables backend.

2 weeks agoRevert "[ARM] Follow AACPS standard for volatile bit-fields access width"
Ties Stuij [Tue, 8 Sep 2020 17:43:59 +0000 (18:43 +0100)]
Revert "[ARM] Follow AACPS standard for volatile bit-fields access width"

This reverts commit 514df1b2bb1ecd1a33327001ea38a347fd2d0380.

Some of the buildbots got llvm-lit errors on CodeGen/volatile.c

2 weeks agoCFGUpdate.h - remove unused APInt include. NFCI.
Simon Pilgrim [Tue, 8 Sep 2020 17:24:52 +0000 (18:24 +0100)]
CFGUpdate.h - remove unused APInt include. NFCI.

2 weeks agoRISCVMatInt.h - remove unnecessary includes. NFCI.
Simon Pilgrim [Tue, 8 Sep 2020 17:04:41 +0000 (18:04 +0100)]
RISCVMatInt.h - remove unnecessary includes. NFCI.

Add APInt forward declaration and move include to RISCVMatInt.cpp

2 weeks ago[sanitizers] Remove unneeded MaybeCall*DefaultOptions() and nullptr checks
Fangrui Song [Sat, 5 Sep 2020 02:19:20 +0000 (19:19 -0700)]
[sanitizers] Remove unneeded MaybeCall*DefaultOptions() and nullptr checks

D28596 added SANITIZER_INTERFACE_WEAK_DEF which can guarantee `*_default_options` are always defined.
The weak attributes on the `__{asan,lsan,msan,ubsan}_default_options` declarations can thus be removed.

`MaybeCall*DefaultOptions` no longer need nullptr checks, so their call sites can just be replaced by `__*_default_options`.

Reviewed By: #sanitizers, vitalybuka

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

2 weeks agoAdd more explicit error message when creating a type or attribute for an unregistered...
Mehdi Amini [Tue, 8 Sep 2020 16:53:24 +0000 (16:53 +0000)]
Add more explicit error message when creating a type or attribute for an unregistered dialect (NFC)

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

2 weeks ago[GVN] Add testcase that uses masked loads and stores, NFC
Krzysztof Parzyszek [Tue, 8 Sep 2020 16:26:10 +0000 (11:26 -0500)]
[GVN] Add testcase that uses masked loads and stores, NFC

2 weeks ago[ARM] Follow AACPS standard for volatile bit-fields access width
Ties Stuij [Fri, 28 Aug 2020 14:08:02 +0000 (15:08 +0100)]
[ARM] Follow AACPS standard for volatile bit-fields access width

This patch resumes the work of D16586.
According to the AAPCS, volatile bit-fields should
be accessed using containers of the widht of their
declarative type. In such case:
struct S1 {
  short a : 1;
should be accessed using load and stores of the width
(sizeof(short)), where now the compiler does only load
the minimum required width (char in this case).
However, as discussed in D16586,
that could overwrite non-volatile bit-fields, which
conflicted with C and C++ object models by creating
data race conditions that are not part of the bit-field,
struct S2 {
  short a;
  int  b : 16;
Accessing `S2.b` would also access `S2.a`.

The AAPCS Release 2020Q2
section 8.1 Data Types, page 36, "Volatile bit-fields -
preserving number and width of container accesses" has been
updated to avoid conflict with the C++ Memory Model.
Now it reads in the note:
This ABI does not place any restrictions on the access widths of bit-fields where the container
overlaps with a non-bit-field member or where the container overlaps with any zero length bit-field
placed between two other bit-fields. This is because the C/C++ memory model defines these as being
separate memory locations, which can be accessed by two threads simultaneously. For this reason,
compilers must be permitted to use a narrower memory access width (including splitting the access into
multiple instructions) to avoid writing to a different memory location. For example, in
struct S { int a:24; char b; }; a write to a must not also write to the location occupied by b, this requires at least two
memory accesses in all current Arm architectures. In the same way, in struct S { int a:24; int:0; int b:8; };,
writes to a or b must not overwrite each other.

Patch D16586 was updated to follow such behavior by verifying that we
only change volatile bit-field access when:
 - it won't overlap with any other non-bit-field member
 - we only access memory inside the bounds of the record
 - avoid overlapping zero-length bit-fields.

Regarding the number of memory accesses, that should be preserved, that will
be implemented by D67399.

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

The following people contributed to this patch:
- Diogo Sampaio
- Ties Stuij

2 weeks agoGlobalISel: Combine `op undef, x` to 0
Volkan Keles [Tue, 8 Sep 2020 16:46:38 +0000 (09:46 -0700)]
GlobalISel: Combine `op undef, x` to 0


2 weeks ago[WebAssembly] Fix fixEndsAtEndOfFunction for try-catch
Heejin Ahn [Sun, 6 Sep 2020 17:36:07 +0000 (10:36 -0700)]
[WebAssembly] Fix fixEndsAtEndOfFunction for try-catch

When the function return type is non-void and `end` instructions are at
the very end of a function, CFGStackify's `fixEndsAtEndOfFunction`
function fixes the corresponding block/loop/try's type to match the
function's return type. This is applied to consecutive `end` markers at
the end of a function. For example, when the function return type is
block i32    ;; return type is fixed to i32
  loop i32   ;; return type is fixed to i32

But try-catch is a little different, because it consists of two parts:
a try part and a catch part, and both parts' return type should satisfy
the function's return type. Which means,
try i32      ;; return type is fixed to i32
  block i32  ;; this should be changed i32 too!
As you can see in this example, it is not sufficient to only `end`
instructions at the end of a function; in case of `try`, we should
check instructions before `catch`es, in case their corresponding `try`'s
type has been fixed.

This changes `fixEndsAtEndOfFunction`'s algorithm to use a worklist
that contains a reverse iterator, each of which is a starting point for
a new backward `end` instruction search.

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

Reviewed By: dschuff, tlively

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

2 weeks agoLiveRegUnits.h - reduce MachineRegisterInfo.h include. NFC.
Simon Pilgrim [Tue, 8 Sep 2020 16:21:28 +0000 (17:21 +0100)]
LiveRegUnits.h - reduce MachineRegisterInfo.h include. NFC.

We only need to include MachineInstrBundle.h, but exposes an implicit dependency in MachineOutliner.h.

Also, remove duplicate includes from LiveRegUnits.cpp + MachineOutliner.cpp.

2 weeks agoAdd an option for unrolling loops up to a factor.
Lubomir Litchev [Thu, 3 Sep 2020 20:15:39 +0000 (13:15 -0700)]
Add an option for unrolling loops up to a factor.

Currently, there is no option to allow for unrolling a loop up to a specific factor (specified by the user).
The code for doing that is there and there are benefits when unrolling is done  to smaller loops (smaller than the factor specified).

Reviewed By: bondhugula

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

2 weeks ago[clang-tidy] Fix linking for FrontendOpenMP
Heejin Ahn [Tue, 8 Sep 2020 16:20:06 +0000 (09:20 -0700)]
[clang-tidy] Fix linking for FrontendOpenMP

Without this, builds with `-DBUILD_SHARED_LIBS=ON` fail.

2 weeks ago[AMDGPU] Support disassembly for AMDGPU kernel descriptors
Ronak Chauhan [Mon, 7 Sep 2020 09:10:00 +0000 (14:40 +0530)]
[AMDGPU] Support disassembly for AMDGPU kernel descriptors

Decode AMDGPU Kernel descriptors as assembler directives.

Reviewed By: scott.linder, jhenderson, kzhuravl

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

2 weeks ago[clang-format] Handle shifts within conditions
mydeveloperday [Tue, 8 Sep 2020 15:39:11 +0000 (16:39 +0100)]
[clang-format] Handle shifts within conditions

In some situation shifts can be treated as a template, and is thus formatted as one. So, by doing a couple extra checks to assure that the condition doesn't contain a template, and is in fact a bit shift should solve this problem.

This is a fix for [[ https://bugs.llvm.org/show_bug.cgi?id=46969 | bug 46969 ]]

Reviewed By: MyDeveloperDay

Patch By: Saldivarcher

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

2 weeks ago[libc++] Allow overriding the cached value of LIBCXX_TEST_CONFIG
Louis Dionne [Tue, 8 Sep 2020 15:29:32 +0000 (11:29 -0400)]
[libc++] Allow overriding the cached value of LIBCXX_TEST_CONFIG

2 weeks ago[libc++] Make sure we always print all available features
Louis Dionne [Tue, 8 Sep 2020 15:17:10 +0000 (11:17 -0400)]
[libc++] Make sure we always print all available features

Previously, we'd only print the features added through the new config,
however printing all the features is important for debugging purposes.

2 weeks ago[DAGTypeLegalizer] Handle ZERO_EXTEND of promoted type in WidenVecRes_Convert.
Jonas Paulsson [Wed, 19 Aug 2020 10:01:03 +0000 (12:01 +0200)]
[DAGTypeLegalizer] Handle ZERO_EXTEND of promoted type in WidenVecRes_Convert.

On SystemZ, a ZERO_EXTEND of an i1 vector handled by WidenVecRes_Convert()
always ended up being scalarized, because the type action of the input is
promotion which was previously an unhandled case in this method.

This fixes https://bugs.llvm.org/show_bug.cgi?id=47132.

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

Patch by Eli Friedman.
Review: Ulrich Weigand

2 weeks ago[clang-tidy] Fix dynamic build failures after 156b127945a8c923d141e608b7380427da024376
Haojian Wu [Tue, 8 Sep 2020 14:26:48 +0000 (16:26 +0200)]
[clang-tidy] Fix dynamic build failures after 156b127945a8c923d141e608b7380427da024376

2 weeks agoRevert 3e782bf809 "[Sema][MSVC] warn at dynamic_cast when /GR- is given"
Hans Wennborg [Tue, 8 Sep 2020 14:09:33 +0000 (16:09 +0200)]
Revert 3e782bf809 "[Sema][MSVC] warn at dynamic_cast when /GR- is given"

This caused more warnings than expected, see https://crbug.com/1126019

Also reverts the follow-up 7907e5516.

> Differential Revision: https://reviews.llvm.org/D86369

2 weeks agoStructPackAlignCheck: Fix a -Winconsistent-missing-override warning
Nico Weber [Tue, 8 Sep 2020 14:02:00 +0000 (10:02 -0400)]
StructPackAlignCheck: Fix a -Winconsistent-missing-override warning

2 weeks ago[gn build] (manually) port 156b127945a8
Nico Weber [Tue, 8 Sep 2020 14:00:24 +0000 (10:00 -0400)]
[gn build] (manually) port 156b127945a8

2 weeks ago[DSE,MemorySSA] Increase walker limit a bit.
Florian Hahn [Fri, 4 Sep 2020 15:44:58 +0000 (16:44 +0100)]
[DSE,MemorySSA] Increase walker limit a bit.

This slightly bumps the walker limit so that it covers more cases while
not increasing compile-time too much:

2 weeks ago[NFC][ARM] Precommit test
Sam Parker [Tue, 8 Sep 2020 13:41:42 +0000 (14:41 +0100)]
[NFC][ARM] Precommit test

2 weeks ago[mlir][VectorOps] Fix more GCC5 weirdness
Benjamin Kramer [Tue, 8 Sep 2020 13:40:14 +0000 (15:40 +0200)]
[mlir][VectorOps] Fix more GCC5 weirdness

VectorToSCF.cpp:515:47: error: specialization of 'template<class TransferOpTy> mlir::LogicalResult mlir::VectorTransferRewriter<TransferOpTy>::matchAndRewrite(mlir::Operation*, mlir::PatternRewriter&) const' in different namespace [-fpermissive]

2 weeks ago[clang] Limit the maximum level of fold-expr expansion.
Haojian Wu [Tue, 8 Sep 2020 13:34:52 +0000 (15:34 +0200)]
[clang] Limit the maximum level of fold-expr expansion.

Introduce a new diagnostic, and respect the bracket-depth (256) by default.

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

2 weeks agoAdd a new altera check for structure packing and alignment.
Frank Derry Wanye [Tue, 8 Sep 2020 13:35:14 +0000 (09:35 -0400)]
Add a new altera check for structure packing and alignment.

The altera struct pack align lint check finds structs that are inefficiently
packed or aligned and recommends packing/aligning of the structs using the
packed and aligned attributes as needed in a warning.

2 weeks ago[InstCombine] add bitwise logic fold tests for D86395; NFC
Sanjay Patel [Tue, 8 Sep 2020 13:17:01 +0000 (09:17 -0400)]
[InstCombine] add bitwise logic fold tests for D86395; NFC

2 weeks ago[analyzer] [NFC] Introduce refactoring of PthreadLockChecker
Denys Petrov [Fri, 4 Sep 2020 12:03:09 +0000 (15:03 +0300)]
[analyzer] [NFC] Introduce refactoring of PthreadLockChecker

Change capitalization of some names due to LLVM naming rules.
Change names of some variables to make them more speaking.
Rework similar bug reports into one common function.

Prepare code for the next patches to reduce unrelated changes.

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

2 weeks ago[CMake] Remove dead FindPythonInterp code
Raul Tambre [Sat, 5 Sep 2020 14:52:23 +0000 (17:52 +0300)]
[CMake] Remove dead FindPythonInterp code

LLVM has bumped the minimum required CMake version to 3.13.4, so this has become dead code.

Reviewed By: #libc, ldionne

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

2 weeks ago[mlir] Fix bug in copy removal
Ehsan Toosi [Mon, 24 Aug 2020 11:19:50 +0000 (13:19 +0200)]
[mlir] Fix bug in copy removal

A crash could happen due to copy removal. The bug is fixed and two more
test cases are added.

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

2 weeks ago[mlir][VectorOps]
Benjamin Kramer [Tue, 8 Sep 2020 12:02:46 +0000 (14:02 +0200)]

Put back anonymous namespace to work around GCC5 bug.

VectorToSCF.cpp:241:61: error: specialization of 'template<class ConcreteOp> mlir::LogicalResult {anonymous}::NDTransferOpHelper<ConcreteOp>::doReplace()' in different namespace [-fpermissive]

2 weeks ago[Codegen][X86] Begin moving X86 specific codegen tests into X86 subfolder.
Simon Pilgrim [Tue, 8 Sep 2020 12:01:09 +0000 (13:01 +0100)]
[Codegen][X86] Begin moving X86 specific codegen tests into X86 subfolder.

Discussed with @craig.topper and @spatel - this is to try and tidyup the codegen folder and move the x86 specific tests (as opposed to general tests that just happen to use x86 triples) into subfolders. Its up to other targets if they follow suit.

It also helps speed up test iterations as using wildcards on lit commands often misses some filenames.

2 weeks agoX86CallLowering.cpp - improve auto const/pointer/reference qualifiers. NFCI.
Simon Pilgrim [Tue, 8 Sep 2020 11:46:00 +0000 (12:46 +0100)]
X86CallLowering.cpp - improve auto const/pointer/reference qualifiers. NFCI.

Fix clang-tidy warnings by ensuring auto variables are more cleanly qualified, or just avoid auto entirely.

2 weeks agoX86DomainReassignment.cpp - improve auto const/pointer/reference qualifiers. NFCI.
Simon Pilgrim [Tue, 8 Sep 2020 11:45:08 +0000 (12:45 +0100)]
X86DomainReassignment.cpp - improve auto const/pointer/reference qualifiers. NFCI.

Fix clang-tidy warnings by ensuring auto variables are more cleanly qualified, or just avoid auto entirely.

2 weeks ago[DWARFYAML] Make the debug_ranges section optional.
Xing GUO [Tue, 8 Sep 2020 11:55:14 +0000 (19:55 +0800)]
[DWARFYAML] Make the debug_ranges section optional.

This patch makes the debug_ranges section optional. When we specify an
empty debug_ranges section, yaml2obj only emits the section header.

Reviewed By: jhenderson

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

2 weeks ago[mlir] remove BufferAssignmentPlacer from BufferAssignmentOpConversionPattern
Ehsan Toosi [Thu, 20 Aug 2020 10:56:19 +0000 (12:56 +0200)]
[mlir] remove BufferAssignmentPlacer from BufferAssignmentOpConversionPattern

BufferPlacement has been removed, as allocations are no longer placed during the conversion.

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