platform/upstream/llvm.git
4 years ago[GVN] Fix VNCoercion for Scalable Vector.
Huihui Zhang [Sat, 11 Apr 2020 00:48:56 +0000 (17:48 -0700)]
[GVN] Fix VNCoercion for Scalable Vector.

Summary:
For VNCoercion, skip scalable vector when analysis rely on fixed size,
otherwise call TypeSize::getFixedSize() explicitly.

Add unit tests to check funtionality of GVN load elimination for scalable type.

Reviewers: sdesmalen, efriedma, spatel, fhahn, reames, apazos, ctetreau

Reviewed By: efriedma

Subscribers: bjope, hiraditya, jfb, llvm-commits

Tags: #llvm

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

4 years ago[lit] Fix tests on Windows
Julian Lettner [Sat, 11 Apr 2020 00:12:54 +0000 (17:12 -0700)]
[lit] Fix tests on Windows

max-time.py:
  Windows does not have a native `sleep` command, use `time.sleep()` in
  Python instead.

max-failures.py:
  The max-failure test reused the shtest-shell test inputs instead of
  defining its own "test domain".  However, the output of this
  shtest-shell "test domain" is slightly different on Windows, which now
  bites us since we made the max-failures test stricter.  Let's define
  our own "max failures" test domain.

4 years agollvm-dwarfdump: Report errors when failing to parse loclist/debug_loc entries
David Blaikie [Sat, 11 Apr 2020 00:26:11 +0000 (17:26 -0700)]
llvm-dwarfdump: Report errors when failing to parse loclist/debug_loc entries

This probably isn't ideal - the error was being printed specifically
inline with the dumping that was more legible - but then the error
wasn't reported to stderr and didn't produce a non-zero exit code.

Probably the error message could be improved by adding more context now
that it isn't printed in-situ of the DIE dumping as much.

4 years agoExclude bitcast and ext/trunc signbit optimization on ppc_fp128
Eric Christopher [Sat, 11 Apr 2020 00:06:17 +0000 (17:06 -0700)]
Exclude bitcast and ext/trunc signbit optimization on ppc_fp128

Revision a1c05fe <https://reviews.llvm.org/rGa1c05fe20f3def1f1be9f50d2adefc6b6f1578ad>
removed bitcast from the list of problematic transformations, however:

  %97 = fptrunc ppc_fp128 %2 to double            // we need to check ppc_fp128 here to prevent the transformation
  %98 = bitcast double %97 to i64                 // a1c05fe checks ppc_fp128 at here
  %99 = icmp slt i64 %98, 0
  %100 = zext i1 %99 to i8
  store i8 %100, i8* %7, align 1

so this patch does that. I'm also disabling it in the presence of extend just in case.

I verified separately that the hash of -std::infinity and std::infinity don't match now.

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

4 years ago[ELF][test] Reorganize format-binary.test
Fangrui Song [Fri, 10 Apr 2020 23:27:49 +0000 (16:27 -0700)]
[ELF][test] Reorganize format-binary.test

Also drop dependency on the output directory name (lit implementation detail).

4 years ago[BasicAA] Fix aliasGEP/DecomposeGEPExpression for scalable type.
Huihui Zhang [Fri, 10 Apr 2020 23:24:18 +0000 (16:24 -0700)]
[BasicAA] Fix aliasGEP/DecomposeGEPExpression for scalable type.

Summary:
Don't attempt to analyze the decomposed GEP for scalable type.
GEP index scale is not compile-time constant for scalable type.
Be conservative, return MayAlias.

Explicitly call TypeSize::getFixedSize() to assert on places where
scalable type doesn't make sense.

Add unit tests to check functionality of -basicaa for scalable type.

This patch is needed for D76944.

Reviewers: sdesmalen, efriedma, spatel, bjope, ctetreau

Reviewed By: efriedma

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[lldb/Test] Rewrite ReproducerInstrumentationTest
Jonas Devlieghere [Fri, 10 Apr 2020 22:42:28 +0000 (15:42 -0700)]
[lldb/Test] Rewrite ReproducerInstrumentationTest

The instrumentation unit tests' current implementation uses global
variables to track constructor calls for the instrumented classes during
replay. This is suboptimal because it indirectly relies on how the
reproducer instrumentation is implemented. I found out when adding
support for passive replay and the test broke because we made an extra
(temporary) copy of the instrumented objects.

Additionally, the old approach wasn't very self-explanatory. It took me
a bit of time to understand why we were expecting the number of objects
in the test.

This patch rewrites the test and uses the index-to-object-mapping to
verify the objects created during replay. You can now specify the
expected objects, in order, and whether they should be valid or not. I
find that it makes the tests much easier to understand. More
importantly, this approach is resilient to implementation detail changes
in the instrumentation.

4 years ago[WebAssembly] Minor cleanup to WebAssemblySubtarget. NFC.
Sam Clegg [Fri, 10 Apr 2020 20:07:19 +0000 (13:07 -0700)]
[WebAssembly] Minor cleanup to WebAssemblySubtarget. NFC.

Pretty much all other platforms pass CPU string as arg0 of
initializeSubtargetDependencies.

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

4 years agoMake basic_string::operator=() tail call properly
Martijn Vels [Fri, 10 Apr 2020 22:36:31 +0000 (18:36 -0400)]
Make basic_string::operator=() tail call properly

Summary: We discovered that the compiler may chose not to inline the operator=, which leads to an expensive extra stack frame. This change makes __assign_no_alias always tail called.

Reviewers: EricWF, #libc!

Subscribers: libcxx-commits

Tags: #libc

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

4 years agoAdd -debugify-and-strip-all to add debug info before a pass and remove it after
Daniel Sanders [Wed, 8 Apr 2020 20:48:40 +0000 (13:48 -0700)]
Add -debugify-and-strip-all to add debug info before a pass and remove it after

Summary:
This allows us to test each backend pass under the presence
of debug info using pre-existing tests. The tests should not
fail as a result of this so long as it's true that debug info
does not affect CodeGen.

In practice, a few tests are sensitive to this:
* Tests that check the pass structure (e.g. O0-pipeline.ll)
* Tests that check --debug output. Specifically instruction
  dumps containing MMO's (e.g. prelegalizercombiner-extends.ll)
* Tests that contain debugify metadata as mir-strip-debug will
  remove it (e.g. fastisel-debugvalue-undef.ll)
* Tests with partial debug info (e.g.
  patchable-function-entry-empty.mir had debug info but no
  !llvm.dbg.cu)
* Tests that check optimization remarks overly strictly (e.g.
  prologue-epilogue-remarks.mir)
* Tests that would inject the pass in an unsafe region (e.g.
  seqpairspill.mir would inject between register alloc and
  virt reg rewriter)
In all cases, the checks can either be updated or
--debugify-and-strip-all-safe=0 can be used to avoid being
affected by something like llvm-lit -Dllc='llc --debugify-and-strip-all-safe'

I tested this without the lost debug locations verifier to
confirm that AArch64 behaviour is unaffected (with the fixes
in this patch) and with it to confirm it finds the problems
without the additional RUN lines we had before.

Depends on D77886, D77887, D77747

Reviewers: aprantl, vsk, bogner

Subscribers: qcolombet, kristof.beyls, hiraditya, danielkiss, llvm-commits

Tags: #llvm

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

4 years ago[lit] Increase sleep time in timeout test
Julian Lettner [Fri, 10 Apr 2020 23:22:00 +0000 (16:22 -0700)]
[lit] Increase sleep time in timeout test

Fixup for cbe42a9d5fa.  Increase values for testing the overall lit
timeout (--max-time) which wasn't enough for the test to complete on
very slow build bots.

4 years ago[ORC] Add an OrcV2 C API function for configuring TargetMachines.
Lang Hames [Fri, 10 Apr 2020 21:07:51 +0000 (14:07 -0700)]
[ORC] Add an OrcV2 C API function for configuring TargetMachines.

4 years agoDisable test on windows
Matt Arsenault [Fri, 10 Apr 2020 22:47:48 +0000 (18:47 -0400)]
Disable test on windows

4 years ago[llvm][NFC] Inliner.cpp: ensure InlineHistory ID is always initialized;
Mircea Trofin [Fri, 10 Apr 2020 15:16:49 +0000 (08:16 -0700)]
[llvm][NFC] Inliner.cpp: ensure InlineHistory ID is always initialized;

Summary:
The inline history is associated with a call site. There are two locations
we fetch inline history. In one, we fetch it together with the call
site. In the other, we initialize it under certain conditions, use it
later under same conditions (different if check), and otherwise is
uninitialized. Although currently there is no uninitialized use, the
code is more challenging to maintain correctly, than if the value were
always initialized.

Changed to the upfront initialization pattern already present in this
file.

Reviewers: davidxl, dblaikie

Subscribers: eraman, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mir-strip-debug] Optionally preserve debug info that wasn't from debugify/mir-debugify
Daniel Sanders [Thu, 9 Apr 2020 17:36:50 +0000 (10:36 -0700)]
[mir-strip-debug] Optionally preserve debug info that wasn't from debugify/mir-debugify

Summary:
A few tests start out with debug info and expect it to reach
the output. For these tests we shouldn't strip the debug info

Reviewers: aprantl, vsk, bogner

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lit] Add SKIPPED test result category
Julian Lettner [Fri, 8 Mar 2019 04:48:24 +0000 (20:48 -0800)]
[lit] Add SKIPPED test result category

Track and print the number of skipped tests.  Skipped tests are tests
that should have been executed but weren't due to:
  * user interrupt [Ctrl+C]
  * --max-time (overall lit timeout)
  * --max-failures

This is part of a larger effort to ensure that all discovered tests are
properly accounted for.

Add test for overall lit timeout feature (`--max-time` option) to
observe skipped tests.  Extend test for `--max-failures` option.

Reviewed By: jdenny

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Fri, 10 Apr 2020 21:23:20 +0000 (14:23 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: stoklund, sdesmalen, efriedma

Reviewed By: sdesmalen

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir][Pass] Allow duplicate pass registration.
River Riddle [Fri, 10 Apr 2020 21:49:44 +0000 (14:49 -0700)]
[mlir][Pass] Allow duplicate pass registration.

Summary: With users registering their own dependencies, duplicate pass registration becomes more and more common. This revision relaxes that pass registration be unique. This is safe to assume given that we key on the passID, which is guaranteed to be unique per pass class.

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

4 years ago[libc++] NFC: Clean up a lot of old Lit features
Louis Dionne [Fri, 10 Apr 2020 20:14:10 +0000 (16:14 -0400)]
[libc++] NFC: Clean up a lot of old Lit features

The libc++ test suite has a lot of old Lit features used to XFAIL tests
and mark them as UNSUPPORTED. Many of them are to workaround problems on
old compilers or old platforms. As time goes by, it is good to go and
clean those up to simplify the configuration of the test suite, and also
to reflect the testing reality. It's not useful to have markup that gives
the impression that e.g. clang-3.3 is supported, when we don't really
test on it anymore (and hence several new tests probably don't have the
necessary markup on them).

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Fri, 10 Apr 2020 20:59:26 +0000 (13:59 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: dexonsmith, sdesmalen, efriedma

Reviewed By: efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir][ODS] Add support for optional operands and results with a new Optional directive.
River Riddle [Fri, 10 Apr 2020 21:11:45 +0000 (14:11 -0700)]
[mlir][ODS] Add support for optional operands and results with a new Optional directive.

Summary: This revision adds support for specifying operands or results as "optional". This is a special case of variadic where the number of elements is either 0 or 1. Operands and results of this kind will have accessors generated using Value instead of the range types, making it more natural to interface with.

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Fri, 10 Apr 2020 20:49:05 +0000 (13:49 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: dexonsmith, sdesmalen, efriedma

Reviewed By: sdesmalen

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoMake TargetPassConfig and llc add pre/post passes the same way. NFC
Daniel Sanders [Wed, 8 Apr 2020 20:43:46 +0000 (13:43 -0700)]
Make TargetPassConfig and llc add pre/post passes the same way. NFC

Summary:
At the moment, any changes we make to the passes that can be
injected before/after others (e.g. -verify-machineinstrs and
-print-after-all) have to be duplicated in both
TargetPassConfig (for normal execution, -start-before/
-stop-before/etc) and llc (for -run-pass). Unify this pass
injection into addMachinePrePass/addMachinePostPass that both
TargetPassConfig and llc can use.

Reviewers: vsk, aprantl, bogner

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Fri, 10 Apr 2020 19:55:36 +0000 (12:55 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: rriddle, efriedma, sdesmalen

Reviewed By: sdesmalen

Subscribers: frgossen, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, grosul1, llvm-commits

Tags: #llvm

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

4 years ago[ORC] Use CodeGenOpt::Default as the default level in JITTargetMachineBuilder.
Lang Hames [Fri, 10 Apr 2020 20:24:41 +0000 (13:24 -0700)]
[ORC] Use CodeGenOpt::Default as the default level in JITTargetMachineBuilder.

This matches EngineBuilder/MCJIT's default.

4 years ago[libc++] NFC: Fix typo in Lit feature (C++14 with a capital C)
Louis Dionne [Fri, 10 Apr 2020 20:11:22 +0000 (16:11 -0400)]
[libc++] NFC: Fix typo in Lit feature (C++14 with a capital C)

4 years ago[mlir] Emit errors if global constructors are found within lib/
River Riddle [Fri, 10 Apr 2020 19:57:18 +0000 (12:57 -0700)]
[mlir] Emit errors if global constructors are found within lib/

Summary: This avoids adding any additional global constructors, like cl::opt. There is a temporary exception on IR/, which has a few cl::opts that require a bit of plumbing to remove.

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

4 years ago[x86] add test for FP->int->FP casts; NFC (PR36617)
Sanjay Patel [Fri, 10 Apr 2020 19:56:10 +0000 (15:56 -0400)]
[x86] add test for FP->int->FP casts; NFC (PR36617)

Also, add a common prefix for SSE to reduce redundant CHECK lines.

4 years ago[mlir][drr] Allow specifying string in location
Jacques Pienaar [Fri, 10 Apr 2020 00:18:34 +0000 (17:18 -0700)]
[mlir][drr] Allow specifying string in location

Summary:
The string in the location is used to provide metadata for the fused location
or create a NamedLoc. This allows tagging individual locations to convey
additional rewrite information.

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

4 years ago[CallSite removal][X86] Remove uses of CallSite from X86WinEHState.cpp
Craig Topper [Fri, 10 Apr 2020 07:50:49 +0000 (00:50 -0700)]
[CallSite removal][X86] Remove uses of CallSite from X86WinEHState.cpp

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

4 years ago[gn build] Port ea11f4726f2
LLVM GN Syncbot [Fri, 10 Apr 2020 18:26:30 +0000 (18:26 +0000)]
[gn build] Port ea11f4726f2

4 years agoSplit LiveRangeCalc in LiveRangeCalc/LiveIntervalCalc. NFC
Marcello Maggioni [Mon, 23 Mar 2020 02:08:29 +0000 (19:08 -0700)]
Split LiveRangeCalc in LiveRangeCalc/LiveIntervalCalc. NFC

Summary:
Refactor LiveRangeCalc such that it is now split into two classes

The objective is to split all the "register specific" logic away
from LiveRangeCalc.
The two new classes created are:

- LiveRangeCalc - is meant as a generic class to compute and modify
  live ranges in a generic way. This class should deal only with
  SlotIndices and VNInfo objects.

- LiveIntervalCals - is meant to be equivalent to the old LiveRangeCalc.
  It computes the liveness virtual registers tracked by a LiveInterval
  object.

With this refactoring LiveRangeCalc can be used to implement tracking of
liveness of LiveRanges that represent other things than just registers.

Subscribers: MatzeB, qcolombet, mgorny, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir][Linalg] Create a tool to generate named Linalg ops from a Tensor Comprehension...
Nicolas Vasilache [Fri, 10 Apr 2020 17:54:08 +0000 (13:54 -0400)]
[mlir][Linalg] Create a tool to generate named Linalg ops from a Tensor Comprehensions-like specification.

Summary:

This revision adds a tool that generates the ODS and C++ implementation for "named" Linalg ops according to the [RFC discussion](https://llvm.discourse.group/t/rfc-declarative-named-ops-in-the-linalg-dialect/745).

While the mechanisms and language aspects are by no means set in stone, this revision allows connecting the pieces end-to-end from a mathematical-like specification.

Some implementation details and short-term decisions taken for the purpose of bootstrapping and that are not set in stone include:

    1. using a "[Tensor Comprehension](https://arxiv.org/abs/1802.04730)-inspired" syntax
    2. implicit and eager discovery of dims and symbols when parsing
    3. using EDSC ops to specify the computation (e.g. std_addf, std_mul_f, ...)

A followup revision will connect this tool to tablegen mechanisms and allow the emission of named Linalg ops that automatically lower to various loop forms and run end to end.

For the following "Tensor Comprehension-inspired" string:

```
    def batch_matmul(A: f32(Batch, M, K), B: f32(K, N)) -> (C: f32(Batch, M, N)) {
      C(b, m, n) = std_addf<k>(std_mulf(A(b, m, k), B(k, n)));
    }
```

With -gen-ods-decl=1, this emits (modulo formatting):

```
      def batch_matmulOp : LinalgNamedStructured_Op<"batch_matmul", [
        NInputs<2>,
        NOutputs<1>,
        NamedStructuredOpTraits]> {
          let arguments = (ins Variadic<LinalgOperand>:$views);
          let results = (outs Variadic<AnyRankedTensor>:$output_tensors);
          let extraClassDeclaration = [{
            llvm::Optional<SmallVector<StringRef, 8>> referenceIterators();
            llvm::Optional<SmallVector<AffineMap, 8>> referenceIndexingMaps();
            void regionBuilder(ArrayRef<BlockArgument> args);
          }];
          let hasFolder = 1;
      }
```

With -gen-ods-impl, this emits (modulo formatting):

```
      llvm::Optional<SmallVector<StringRef, 8>> batch_matmul::referenceIterators() {
          return SmallVector<StringRef, 8>{ getParallelIteratorTypeName(),
                                            getParallelIteratorTypeName(),
                                            getParallelIteratorTypeName(),
                                            getReductionIteratorTypeName() };
      }
      llvm::Optional<SmallVector<AffineMap, 8>> batch_matmul::referenceIndexingMaps()
      {
        MLIRContext *context = getContext();
        AffineExpr d0, d1, d2, d3;
        bindDims(context, d0, d1, d2, d3);
        return SmallVector<AffineMap, 8>{
            AffineMap::get(4, 0, {d0, d1, d3}),
            AffineMap::get(4, 0, {d3, d2}),
            AffineMap::get(4, 0, {d0, d1, d2}) };
      }
      void batch_matmul::regionBuilder(ArrayRef<BlockArgument> args) {
        using namespace edsc;
        using namespace intrinsics;
        ValueHandle _0(args[0]), _1(args[1]), _2(args[2]);

        ValueHandle _4 = std_mulf(_0, _1);
        ValueHandle _5 = std_addf(_2, _4);
        (linalg_yield(ValueRange{ _5 }));
      }
```

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

4 years ago[Pipeliner] Fix the bug in pragma that disables the pipeliner.
Sumanth Gundapaneni [Fri, 10 Apr 2020 17:50:43 +0000 (12:50 -0500)]
[Pipeliner] Fix the bug in pragma that disables the pipeliner.

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

4 years agoImplement `-fsanitize-coverage-whitelist` and `-fsanitize-coverage-blacklist` for...
Matt Morehouse [Fri, 10 Apr 2020 17:42:41 +0000 (10:42 -0700)]
Implement `-fsanitize-coverage-whitelist` and `-fsanitize-coverage-blacklist` for clang

Summary:
This commit adds two command-line options to clang.
These options let the user decide which functions will receive SanitizerCoverage instrumentation.
This is most useful in the libFuzzer use case, where it enables targeted coverage-guided fuzzing.

Patch by Yannis Juglaret of DGA-MI, Rennes, France

libFuzzer tests its target against an evolving corpus, and relies on SanitizerCoverage instrumentation to collect the code coverage information that drives corpus evolution. Currently, libFuzzer collects such information for all functions of the target under test, and adds to the corpus every mutated sample that finds a new code coverage path in any function of the target. We propose instead to let the user specify which functions' code coverage information is relevant for building the upcoming fuzzing campaign's corpus. To this end, we add two new command line options for clang, enabling targeted coverage-guided fuzzing with libFuzzer. We see targeted coverage guided fuzzing as a simple way to leverage libFuzzer for big targets with thousands of functions or multiple dependencies. We publish this patch as work from DGA-MI of Rennes, France, with proper authorization from the hierarchy.

Targeted coverage-guided fuzzing can accelerate bug finding for two reasons. First, the compiler will avoid costly instrumentation for non-relevant functions, accelerating fuzzer execution for each call to any of these functions. Second, the built fuzzer will produce and use a more accurate corpus, because it will not keep the samples that find new coverage paths in non-relevant functions.

The two new command line options are `-fsanitize-coverage-whitelist` and `-fsanitize-coverage-blacklist`. They accept files in the same format as the existing `-fsanitize-blacklist` option <https://clang.llvm.org/docs/SanitizerSpecialCaseList.html#format>. The new options influence SanitizerCoverage so that it will only instrument a subset of the functions in the target. We explain these options in detail in `clang/docs/SanitizerCoverage.rst`.

Consider now the woff2 fuzzing example from the libFuzzer tutorial <https://github.com/google/fuzzer-test-suite/blob/master/tutorial/libFuzzerTutorial.md>. We are aware that we cannot conclude much from this example because mutating compressed data is generally a bad idea, but let us use it anyway as an illustration for its simplicity. Let us use an empty blacklist together with one of the three following whitelists:

```
  # (a)
  src:*
  fun:*

  # (b)
  src:SRC/*
  fun:*

  # (c)
  src:SRC/src/woff2_dec.cc
  fun:*
```

Running the built fuzzers shows how many instrumentation points the compiler adds, the fuzzer will output //XXX PCs//. Whitelist (a) is the instrument-everything whitelist, it produces 11912 instrumentation points. Whitelist (b) focuses coverage to instrument woff2 source code only, ignoring the dependency code for brotli (de)compression; it produces 3984 instrumented instrumentation points. Whitelist (c) focuses coverage to only instrument functions in the main file that deals with WOFF2 to TTF conversion, resulting in 1056 instrumentation points.

For experimentation purposes, we ran each fuzzer approximately 100 times, single process, with the initial corpus provided in the tutorial. We let the fuzzer run until it either found the heap buffer overflow or went out of memory. On this simple example, whitelists (b) and (c) found the heap buffer overflow more reliably and 5x faster than whitelist (a). The average execution times when finding the heap buffer overflow were as follows: (a) 904 s, (b) 156 s, and (c) 176 s.

We explain these results by the fact that WOFF2 to TTF conversion calls the brotli decompression algorithm's functions, which are mostly irrelevant for finding bugs in WOFF2 font reconstruction but nevertheless instrumented and used by whitelist (a) to guide fuzzing. This results in longer execution time for these functions and a partially irrelevant corpus. Contrary to whitelist (a), whitelists (b) and (c) will execute brotli-related functions without instrumentation overhead, and ignore new code paths found in them. This results in faster bug finding for WOFF2 font reconstruction.

The results for whitelist (b) are similar to the ones for whitelist (c). Indeed, WOFF2 to TTF conversion calls functions that are mostly located in SRC/src/woff2_dec.cc. The 2892 extra instrumentation points allowed by whitelist (b) do not tamper with bug finding, even though they are mostly irrelevant, simply because most of these functions do not get called. We get a slightly faster average time for bug finding with whitelist (b), which might indicate that some of the extra instrumentation points are actually relevant, or might just be random noise.

Reviewers: kcc, morehouse, vitalybuka

Reviewed By: morehouse, vitalybuka

Subscribers: pratyai, vitalybuka, eternalsakura, xwlin222, dende, srhines, kubamracek, #sanitizers, lebedev.ri, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

4 years ago[MC][RISCV] Make .reloc support arbitrary relocation types
Fangrui Song [Sun, 29 Mar 2020 17:01:01 +0000 (10:01 -0700)]
[MC][RISCV] Make .reloc support arbitrary relocation types

Similar to D76746 (ARM), D76754 (AArch64) and llvmorg-11-init-6967-g152d14da64c (x86)

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

4 years agoAMDGPU: Teach toolchain to link rocm device libs
Matt Arsenault [Wed, 15 Aug 2018 15:25:25 +0000 (18:25 +0300)]
AMDGPU: Teach toolchain to link rocm device libs

Currently the library is separately linked, but this isn't correct to
implement fast math flags correctly. Each module should get the
version of the library appropriate for its combination of fast math
and related flags, with the attributes propagated into its functions
and internalized.

HIP already maintains the list of libraries, but this is not used for
OpenCL. Unfortunately, HIP uses a separate --hip-device-lib argument,
despite both languages using the same bitcode library. Eventually
these two searches need to be merged.

An additional problem is there are 3 different locations the libraries
are installed, depending on which build is used. This also needs to be
consolidated (or at least the search logic needs to deal with this
unnecessary complexity).

4 years agoAttempt to fix a compile error reported with older compilers and libstdc++
Adrian Prantl [Fri, 10 Apr 2020 17:34:08 +0000 (10:34 -0700)]
Attempt to fix a compile error reported with older compilers and libstdc++

4 years ago[CallSite removal][X86] Remove unneeded use of CallSite. NFC
Craig Topper [Fri, 10 Apr 2020 17:23:47 +0000 (10:23 -0700)]
[CallSite removal][X86] Remove unneeded use of CallSite. NFC

We already have a CallInst, we can just get the calling convention from it.

4 years ago[lldb] Make some asserts in TestFixIts more expressive
Raphael Isemann [Fri, 10 Apr 2020 17:16:33 +0000 (19:16 +0200)]
[lldb] Make some asserts in TestFixIts more expressive

4 years agoFix a few mismatched iterator types revealed from a libc++ + LLVM_EXPENSIVE_CHECKS...
David Blaikie [Fri, 10 Apr 2020 17:11:29 +0000 (10:11 -0700)]
Fix a few mismatched iterator types revealed from a libc++ + LLVM_EXPENSIVE_CHECKS build

These were accidental SCARY iterator uses that weren't guaranteed and in
libc++'s debug checking mode were actually distinct types. Use decltype
to make it easier to keep these things up to date.

4 years ago[FPEnv][AArch64] Platform-specific builtin constrained FP enablement
Kevin P. Neal [Fri, 10 Apr 2020 16:35:42 +0000 (11:35 -0500)]
[FPEnv][AArch64] Platform-specific builtin constrained FP enablement

When constrained floating point is enabled the AArch64-specific builtins don't use constrained intrinsics in some cases. Fix that.

Neon is part of this patch, so ARM is affected as well.

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

4 years ago[PowerPC][NFC] Add test for 5b18b6e9a84d985c0a907009fb71de7c1943bc88
Nemanja Ivanovic [Fri, 10 Apr 2020 16:35:42 +0000 (11:35 -0500)]
[PowerPC][NFC] Add test for 5b18b6e9a84d985c0a907009fb71de7c1943bc88

When the above commit was added to fix a kernel build break, no tests were
added. Just adding some testing to ensure similar regressions do not recur.

4 years agoTargetOptions.h - remove unused llvm::Module forward declaration. NFC.
Simon Pilgrim [Fri, 10 Apr 2020 16:34:49 +0000 (17:34 +0100)]
TargetOptions.h - remove unused llvm::Module forward declaration. NFC.

4 years agoTargetLoweringObjectFile.h - remove unnecessary ArrayRef.h include. NFC
Simon Pilgrim [Fri, 10 Apr 2020 16:28:18 +0000 (17:28 +0100)]
TargetLoweringObjectFile.h - remove unnecessary ArrayRef.h include. NFC

4 years ago[llvm-dwarfdump] Interface cleanup. NFC
Fangrui Song [Fri, 10 Apr 2020 01:23:39 +0000 (18:23 -0700)]
[llvm-dwarfdump] Interface cleanup. NFC

This patch moves interface declarations into llvm-dwarfdump.h and wrap
declarations in anonymous namespaces as appropriate. At the same time,
the externals are moved into the `llvm::dwarfdump` namespace`.

Reviewed By: djtodoro

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

4 years ago[AArch64InstPrinter] Change printAlignedLabel to print the target address in hexadeci...
Fangrui Song [Fri, 10 Apr 2020 01:46:35 +0000 (18:46 -0700)]
[AArch64InstPrinter] Change printAlignedLabel to print the target address in hexadecimal form

Similar to D76580 (x86) and D76591 (PPC).

```
// llvm-objdump -d output (before)
10000: 08 00 00 94                   bl      #32
10004: 08 00 00 94                   bl      #32

// llvm-objdump -d output (after)
10000: 08 00 00 94                   bl      0x10020
10004: 08 00 00 94                   bl      0x10024

// GNU objdump -d. The lack of 0x is not ideal due to ambiguity.
10000:       94000008        bl      10020 <bar+0x18>
10004:       94000008        bl      10024 <bar+0x1c>
```

The new output makes it easier to find the jump target.

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

4 years ago[X86] Remove defunct EmitLoweredAtomicFP declaration. NFC.
Simon Pilgrim [Fri, 10 Apr 2020 16:04:24 +0000 (17:04 +0100)]
[X86] Remove defunct EmitLoweredAtomicFP declaration. NFC.

4 years ago[Orc] Speculation.h - remove unnecessary ArrayRef.h include. NFC
Simon Pilgrim [Fri, 10 Apr 2020 16:02:54 +0000 (17:02 +0100)]
[Orc] Speculation.h - remove unnecessary ArrayRef.h include. NFC

4 years ago[X86] Remove defunct emitFMA3Instr declaration. NFC.
Simon Pilgrim [Fri, 10 Apr 2020 15:58:22 +0000 (16:58 +0100)]
[X86] Remove defunct emitFMA3Instr declaration. NFC.

4 years ago[gn build] Port 89f1321fe4e
LLVM GN Syncbot [Fri, 10 Apr 2020 15:51:31 +0000 (15:51 +0000)]
[gn build] Port 89f1321fe4e

4 years ago[clang-tidy] Add check to find calls to NSInvocation methods under ARC that don't...
Michael Wyman [Sun, 5 Apr 2020 07:28:34 +0000 (00:28 -0700)]
[clang-tidy] Add check to find calls to NSInvocation methods under ARC that don't have proper object argument lifetimes.

Summary: This check is similar to an ARC Migration check that warned about this incorrect usage under ARC, but most projects are no longer undergoing migration from pre-ARC code. The documentation for NSInvocation is not explicit about these requirements and incorrect usage has been found in many of our projects.

Reviewers: stephanemoore, benhamilton, dmaclach, alexfh, aaron.ballman, hokein, njames93

Reviewed By: stephanemoore, benhamilton, aaron.ballman

Subscribers: xazax.hun, Eugene.Zelenko, mgorny, cfe-commits

Tags: #clang, #clang-tools-extra

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

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Fri, 10 Apr 2020 14:53:02 +0000 (07:53 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: sdesmalen, efriedma, jonpa

Reviewed By: sdesmalen

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoProfileSummaryInfo.h - remove unnecessary includes. NFC
Simon Pilgrim [Fri, 10 Apr 2020 15:23:55 +0000 (16:23 +0100)]
ProfileSummaryInfo.h - remove unnecessary includes. NFC

Remove a number of includes that aren't necessary (nor are we relying on the remaining includes to provide the declarations), we just needed a llvm::Instruction forward declaration.

This exposed a couple of source files that were implicitly replying on the includes for their use of llvm::SmallSet or std::set, requiring local includes to be added there instead.

4 years ago[AMDGPU] Disable sub-dword scralar loads IR widening
Stanislav Mekhanoshin [Thu, 9 Apr 2020 22:22:33 +0000 (15:22 -0700)]
[AMDGPU] Disable sub-dword scralar loads IR widening

These will be widened in the DAG. In the meanwhile early
widening prevents otherwise possible vectorization of
such loads.

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

4 years ago[llvm][NFC] Style fixes in Inliner.cpp
Mircea Trofin [Thu, 9 Apr 2020 22:26:46 +0000 (15:26 -0700)]
[llvm][NFC] Style fixes in Inliner.cpp

Summary:
Function names: camel case, lower case first letter.
Variable names: start with upper letter. For iterators that were 'i',
renamed with a descriptive name, as 'I' is 'Instruction&'.

Lambda captures simplification.

Opportunistic boolean return simplification.

Reviewers: davidxl, dblaikie

Subscribers: eraman, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[NFC][UpdateTestChecks] Fix typos in comments
Jinsong Ji [Fri, 10 Apr 2020 15:03:16 +0000 (15:03 +0000)]
[NFC][UpdateTestChecks] Fix typos in comments

4 years ago[MSan] Add instrumentation for SystemZ
Ilya Leoshkevich [Thu, 9 Apr 2020 20:06:01 +0000 (22:06 +0200)]
[MSan] Add instrumentation for SystemZ

Summary:
This patch establishes memory layout and adds instrumentation. It does
not add runtime support and does not enable MSan, which will be done
separately.

Memory layout is based on PPC64, with the exception that XorMask
is not used - low and high memory addresses are chosen in a way that
applying AndMask to low and high memory produces non-overlapping
results.

VarArgHelper is based on AMD64. It might be tempting to share some
code between the two implementations, but we need to keep in mind that
all the ABI similarities are coincidental, and therefore any such
sharing might backfire.

copyRegSaveArea() indiscriminately copies the entire register save area
shadow, however, fragments thereof not filled by the corresponding
visitCallSite() invocation contain irrelevant data. Whether or not this
can lead to practical problems is unclear, hence a simple TODO comment.
Note that the behavior of the related copyOverflowArea() is correct: it
copies only the vararg-related fragment of the overflow area shadow.

VarArgHelper test is based on the AArch64 one.

s390x ABI requires that arguments are zero-extended to 64 bits. This is
particularly important for __msan_maybe_warning_*() and
__msan_maybe_store_origin_*() shadow and origin arguments, since non
zeroed upper parts thereof confuse these functions. Therefore, add ZExt
attribute to the corresponding parameters.

Add ZExt attribute checks to msan-basic.ll. Since with
-msan-instrumentation-with-call-threshold=0 instrumentation looks quite
different, introduce the new CHECK-CALLS check prefix.

Reviewers: eugenis, vitalybuka, uweigand, jonpa

Reviewed By: eugenis

Subscribers: kristof.beyls, hiraditya, danielkiss, llvm-commits, stefansf, Andreas-Krebbel

Tags: #llvm

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

4 years agoPromoteMemToReg.h - remove unused llvm::AliasSetTracker forward declaration. NFC.
Simon Pilgrim [Fri, 10 Apr 2020 14:46:42 +0000 (15:46 +0100)]
PromoteMemToReg.h - remove unused llvm::AliasSetTracker forward declaration. NFC.

4 years agoSimplifyLibCalls.h - remove unused llvm::BasicBlock forward declaration. NFC.
Simon Pilgrim [Fri, 10 Apr 2020 14:37:53 +0000 (15:37 +0100)]
SimplifyLibCalls.h - remove unused llvm::BasicBlock forward declaration. NFC.

4 years agoVNCoercion.h - remove unused llvm::Function forward declaration. NFC.
Simon Pilgrim [Fri, 10 Apr 2020 14:30:14 +0000 (15:30 +0100)]
VNCoercion.h - remove unused llvm::Function forward declaration. NFC.

4 years agoSizeOpts.h - remove ProfileSummaryInfo forward declaration. NFC.
Simon Pilgrim [Fri, 10 Apr 2020 14:27:18 +0000 (15:27 +0100)]
SizeOpts.h - remove ProfileSummaryInfo forward declaration. NFC.

We're include the entire ProfileSummaryInfo.h as inline functions use it in the header.

4 years agoClean up usages of asserting vector getters in Type
Christopher Tetreault [Fri, 10 Apr 2020 14:35:06 +0000 (07:35 -0700)]
Clean up usages of asserting vector getters in Type

Summary:
Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Reviewers: sdesmalen, rriddle, efriedma

Reviewed By: sdesmalen

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[RISCV] Consume error from parsing attributes section
Jessica Clarke [Fri, 10 Apr 2020 00:30:48 +0000 (01:30 +0100)]
[RISCV] Consume error from parsing attributes section

Summary:
We don't consume the error from getBuildAttributes, so an assertions
build crashes with "Program aborted due to an unhandled Error:".
Explicitly consume it like the ARM version in that case.

Reviewers: asb, jhenderson, MaskRay, HsiangKai

Reviewed By: MaskRay

Subscribers: kristof.beyls, hiraditya, simoncook, kito-cheng, shiva0217, rogfer01, rkruppe, psnobl, benna, Jim, lenary, s.egerton, sameer.abuasal, luismarques, evandro, danielkiss, llvm-commits

Tags: #llvm

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

4 years ago[CostModel][X86] Improve InsertElement costs for sub-128bit vectors
Simon Pilgrim [Fri, 10 Apr 2020 10:22:13 +0000 (11:22 +0100)]
[CostModel][X86] Improve InsertElement costs for sub-128bit vectors

If we're inserting into v2i8/v4i8/v8i8/v2i16/v4i16 style sub-128bit vectors ensure we don't use the SK_PermuteTwoSrc cost of the legalized value type - this is a followup to rG12c629ec6c59 which added equivalent sub-128bit shuffle costs

4 years ago[MLIR][NFC] fix doc comment for isKnownIsolatedFromAbove
Uday Bondhugula [Fri, 10 Apr 2020 13:43:49 +0000 (19:13 +0530)]
[MLIR][NFC] fix doc comment for isKnownIsolatedFromAbove

Fix doc comment for Operation::isKnownIsolatedFromAbove().

4 years ago[InstSimplify] add tests for folding bool select to logic; NFC
Sanjay Patel [Fri, 10 Apr 2020 12:21:52 +0000 (08:21 -0400)]
[InstSimplify] add tests for folding bool select to logic; NFC

4 years ago[mlir][spirv] Update doc regarding availability and type conversion
Lei Zhang [Thu, 9 Apr 2020 14:12:46 +0000 (10:12 -0400)]
[mlir][spirv] Update doc regarding availability and type conversion

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

4 years ago[lldb] Refactor TestFixIts so that most of it can run on aarch64-linux
Raphael Isemann [Fri, 10 Apr 2020 10:45:30 +0000 (12:45 +0200)]
[lldb] Refactor TestFixIts so that most of it can run on aarch64-linux

The final function call to `test_X` is failing on aarch64-linux with SIGILL.
Function calls to previous expressions seem to just not work on aarch64-linux
but I don't see another way to test the multiple-run Fix-Its.

This patch refactors the test that the skipIf for aarch64 Linux only covers
the part of the test that was added D77214.

4 years ago[Driver] Improve help message for -ffixed-xX flags
Simon Cook [Fri, 10 Apr 2020 10:30:24 +0000 (11:30 +0100)]
[Driver] Improve help message for -ffixed-xX flags

This improves the message by adding the missing 'x' prefix in register
names, such that the messages say for example 'Reserve the x10 register',
instead of 'Reserve the 10 register'.

4 years ago[gn build] add scan-build target
Nico Weber [Fri, 10 Apr 2020 10:16:59 +0000 (06:16 -0400)]
[gn build] add scan-build target

4 years ago[compiler-rt] Try to disable failing test on Darwin.
Florian Hahn [Fri, 10 Apr 2020 10:08:49 +0000 (11:08 +0100)]
[compiler-rt] Try to disable failing test on Darwin.

Looks like this test fails on Darwin x86_64 as well:

http://green.lab.llvm.org/green/job/clang-stage1-RA/8593/

Command Output (stderr):
--
fatal error: error in backend: Global variable '__sancov_gen_' has an invalid section specifier '__DATA,__sancov_bool_flag': mach-o section specifier requires a section whose length is between 1 and 16 characters.

4 years ago[SCCP] Use SimplifyBinOp for non-integer constant/expressions & overdef.
Florian Hahn [Fri, 10 Apr 2020 09:57:43 +0000 (10:57 +0100)]
[SCCP] Use SimplifyBinOp for non-integer constant/expressions & overdef.

For non-integer constants/expressions and overdefined, I think we can
just use SimplifyBinOp to do common folds. By just passing a context
with the DL, SimplifyBinOp should not try to get additional information
from looking at definitions.

For overdefined values, it should be enough to just pass the original
operand.

Note: The comment before the `if (isconstant(V1State)...` was wrong
originally: isConstant() also matches integer ranges with a single
element. It is correct now.

Reviewers: efriedma, davide, mssimpso, aartbik

Reviewed By: efriedma

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

4 years ago[libunwind] add hexagon support
Brian Cain [Thu, 9 Apr 2020 05:14:02 +0000 (00:14 -0500)]
[libunwind] add hexagon support

4 years agotsan: don't check libc dependency on NetBSD
Dmitry Vyukov [Fri, 10 Apr 2020 07:35:06 +0000 (09:35 +0200)]
tsan: don't check libc dependency on NetBSD

This new check fails on NetBSD as well.
It is meant to prevent regressions, so disable it on NetBSD.

Reported-by: Keith Randall (khr)
4 years ago[docs][llvm-dwarfdump] Add the release notes about --show-section-sizes
Djordje Todorovic [Fri, 10 Apr 2020 08:33:33 +0000 (10:33 +0200)]
[docs][llvm-dwarfdump] Add the release notes about --show-section-sizes

Note that the llvm-dwarfdump has the new option.

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

4 years agoRevert "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff."
Mehdi Amini [Fri, 10 Apr 2020 07:44:06 +0000 (07:44 +0000)]
Revert "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff."

This reverts commit 0445c64998d14b81f0d3a3182011fc5eae47fa71.

MLIR Build is broken by this change at the moment.

4 years ago[MLIR] Support for taskwait and taskyield operations, and translating the same to...
Kiran Kumar T P [Fri, 10 Apr 2020 07:41:04 +0000 (07:41 +0000)]
[MLIR] Support for taskwait and taskyield operations, and translating the same to LLVM IR

This patch adds support for taskwait and taskyield operations in OpenMP dialect and translation of the these constructs to LLVM IR. The OpenMP IRBuilder is used for this translation.
The patch includes code changes and a testcase modifications.

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

4 years ago[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff.
Alina Sbirlea [Fri, 10 Apr 2020 07:34:04 +0000 (07:34 +0000)]
[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff.

This replaces the ChildrenGetter inside the DominatorTree with
GraphTraits over a GraphDiff object, an object which encapsulated the
view of the previous CFG.
This also simplifies the extentions in clang which use DominatorTree, as
GraphDiff also filters nullptrs.

Re-land a90374988e4eb8c50d91e11f4e61cdbd5debb235 after moving CFGDiff.h
to Support.

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

4 years ago[MLIR][NFC] applyPatternsGreedily -> applyPatternsAndFoldGreedily
Uday Bondhugula [Sun, 5 Apr 2020 01:24:16 +0000 (06:54 +0530)]
[MLIR][NFC] applyPatternsGreedily -> applyPatternsAndFoldGreedily

Rename mlir::applyPatternsGreedily -> applyPatternsAndFoldGreedily. The
new name is a more accurate description of the method - it performs
both, application of the specified patterns and folding of all ops in
the op's region irrespective of whether any patterns have been supplied.

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

4 years agoFix `-Wextra` warning. NFC.
Michael Liao [Fri, 10 Apr 2020 07:21:14 +0000 (03:21 -0400)]
Fix `-Wextra` warning. NFC.

4 years agoRemove extra whitespace. NFC.
Michael Liao [Wed, 8 Apr 2020 19:02:52 +0000 (15:02 -0400)]
Remove extra whitespace. NFC.

4 years agoMove CFGDiff.h from IR to Support
David Blaikie [Fri, 10 Apr 2020 07:14:10 +0000 (00:14 -0700)]
Move CFGDiff.h from IR to Support

Now that it's generalized to use graph traits, it's no longer dependent
on IR.

4 years ago[lldb/Reproducers] Fix typo introduced when disabling register failing tests
Med Ismail Bennani [Fri, 10 Apr 2020 06:36:43 +0000 (08:36 +0200)]
[lldb/Reproducers] Fix typo introduced when disabling register failing tests

4 years ago[MLIR] Introduce an op trait that defines a new scope for auto allocation
Uday Bondhugula [Thu, 9 Apr 2020 09:46:24 +0000 (15:16 +0530)]
[MLIR] Introduce an op trait that defines a new scope for auto allocation

Introduce a new operation property / trait (AutomaticAllocationScope)
for operations with regions that define a new scope for automatic allocations;
such allocations (typically realized on stack) are automatically freed when
control leaves such ops' regions. std.alloca's are freed at the closest
surrounding op that has this trait. All FunctionLike operations should normally
have this trait.

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

4 years agoRevert "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff."
Mehdi Amini [Fri, 10 Apr 2020 06:25:06 +0000 (06:25 +0000)]
Revert "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff."

This reverts commit a90374988e4eb8c50d91e11f4e61cdbd5debb235 and 5da1671bf82306b7fa8dca48f495896c2b29e909.

A new dependency is introduced here from Support to IR which seems like
a layering violation. It also breaks the MLIR build at the moment.

4 years ago[PowerPC][UpdateTestChecks] Remove the extra # when scrubbing loop comments
Kang Zhang [Fri, 10 Apr 2020 06:09:01 +0000 (06:09 +0000)]
[PowerPC][UpdateTestChecks] Remove the extra # when scrubbing loop comments

Summary:
The patch D63957 is to avoid empty string when scrubbing loop comments,
it will replace loop comments to a `#`, that's correct.
But if the line has something else not only loop comments, we will get
a extra `#`.
The patch is to remove the extra `#`.

Reviewed By: jsji

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

4 years ago[PowerPC] Update alignment for ReuseLoadInfo in LowerFP_TO_INTForReuse
Kai Luo [Fri, 10 Apr 2020 05:34:05 +0000 (05:34 +0000)]
[PowerPC] Update alignment for ReuseLoadInfo in LowerFP_TO_INTForReuse

In LowerFP_TO_INTForReuse, when emitting `stfiwx`, alignment of 4 is
set for the `MachineMemOperand`, but RLI(ReuseLoadInfo)'s alignment is
not updated for following loads.

It's related to failed alignment check reported in
https://bugs.llvm.org/show_bug.cgi?id=45297

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

4 years agoRename OptimalLayout to OptimizedStructLayout at Chris's request.
John McCall [Fri, 10 Apr 2020 04:13:49 +0000 (00:13 -0400)]
Rename OptimalLayout to OptimizedStructLayout at Chris's request.

4 years agollvm-dwarfdump: Return non-zero on error
David Blaikie [Fri, 10 Apr 2020 03:53:58 +0000 (20:53 -0700)]
llvm-dwarfdump: Return non-zero on error

Makes it easier to test "this doesn't produce an error" (& indeed makes
that the implied default so we don't accidentally write tests that have
silent/sneaky errors as well as the positive behavior we're testing for)

Though the support for applying relocations is patchy enough that a
bunch of tests treat lack of relocation application as more of a warning
than an error - so rather than me trying to figure out how to add
support for a bunch of relocation types, let's degrade that to a warning
to match the usage (& indeed, it's sort of more of a tool warning anyway
- it's not that the DWARF is wrong, just that the tool can't fully cope
with it - and it's not like the tool won't dump the DWARF, it just won't
follow/render certain relocations - I guess in the most general case it
might try to render an unrelocated value & instead render something
bogus... but mostly seems to be about interesting relocations used in
eh_frame (& honestly it might be nice if we were lazier about doing this
relocation resolution anyway - if you're not dumping eh_frame, should we
really be erroring about the relocations in it?))

4 years ago[libc] Change minimum cmake requirement.
Paula Toth [Fri, 10 Apr 2020 03:41:22 +0000 (20:41 -0700)]
[libc] Change minimum cmake requirement.

Summary: As per this thread: http://lists.llvm.org/pipermail/llvm-dev/2020-April/140744.html, changed the minimum requirement to reflect the decision made to upgrade to cmake 3.13.4.

Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, libc-commits

Tags: #libc-project

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

4 years ago[gn build] Port 4275eb13315
LLVM GN Syncbot [Fri, 10 Apr 2020 03:20:36 +0000 (03:20 +0000)]
[gn build] Port 4275eb13315

4 years ago[PowerPC] Bail out of redundant LI elimination on an implicit kill
Nemanja Ivanovic [Fri, 10 Apr 2020 02:34:30 +0000 (21:34 -0500)]
[PowerPC] Bail out of redundant LI elimination on an implicit kill

The transformation currently does not differentiate between explicit
and implicit kills. However, it is not valid to later simply clear
an implicit kill flag since the kill could be due to a call or return.

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

4 years agoRe-land [Codegen/Statepoint] Allow usage of registers for non gc deopt values.
Serguei Katkov [Thu, 9 Apr 2020 11:40:53 +0000 (18:40 +0700)]
Re-land [Codegen/Statepoint] Allow usage of registers for non gc deopt values.

The change introduces the usage of physical registers for non-gc deopt values.
This require runtime support to know how to take a value from register.
By default usage is off and can be switched on by option.

The change also introduces additional fix-up patch which forces the spilling
of caller saved registers (clobbered after the call) and re-writes statepoint
to use spill slots instead of caller saved registers.

Reviewers: reames, danstrushin
Reviewed By: dantrushin
Subscribers: mgorny, hiraditya, mgrang, llvm-commits
Differential Revision: https://reviews.llvm.org/D77797

4 years ago[OpenMP] Allow <math.h> to go first in C++-mode in target regions
Johannes Doerfert [Fri, 10 Apr 2020 03:10:16 +0000 (22:10 -0500)]
[OpenMP] Allow <math.h> to go first in C++-mode in target regions

If we are in C++ mode and include <math.h> (not <cmath>) first, we still
need to make sure <cmath> is read first. The problem otherwise is that
we haven't seen the declarations of the math.h functions when the system
math.h includes our cmath overlay. However, our cmath overlay, or better
the underlying overlay, e.g. CUDA, uses the math.h functions. Since we
haven't declared them yet we get errors. CUDA avoids this by eagerly
declaring all math functions (in the __device__ space) but we cannot do
this. Instead we break the dependence by forcing cmath to go first.

Reviewed By: JonChesterfield

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

4 years ago[OpenMP] Put old APIs back and added new _async series for backward compatibility
Shilei Tian [Fri, 10 Apr 2020 02:40:30 +0000 (22:40 -0400)]
[OpenMP] Put old APIs back and added new _async series for backward compatibility

Summary: According to comments on bi-weekly meeting, this patch put back old APIs and added new `_async` series

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: yaxunl, guansong, openmp-commits

Tags: #openmp

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

4 years ago[LoopLoadElim] Fix crash by always checking simplify form
Max Kazantsev [Fri, 10 Apr 2020 01:48:29 +0000 (08:48 +0700)]
[LoopLoadElim] Fix crash by always checking simplify form

Loop simplify form should always be checked because logic of
propagateStoredValueToLoadUsers relies on it (in particular, it
requires preheader).

Reviewed By: Fedor Sergeev, Florian Hahn
Differential Revision: https://reviews.llvm.org/D77775

4 years ago[WebAssembly] Use dummy debug info in Emscripten SjLj
Heejin Ahn [Wed, 8 Apr 2020 23:02:25 +0000 (16:02 -0700)]
[WebAssembly] Use dummy debug info in Emscripten SjLj

Summary:
D74269 added debug info to newly created instructions, including calls
to `malloc` and `free`, by taking debug info from existing instructions
around, whose debug info may or may not be empty.

But there are cases debug info is required by the IR verifier: when both
the caller and the callee functions have DISubprograms, meaning we
already have declarations to `malloc` or `free` with a DISubprogram
attached, newly created calls to `malloc` and `free` should have
non-empty debug info. This patch creates a non-empty dummy debug info in
this case to those calls to make the IR verifier pass.

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

Reviewers: dschuff

Subscribers: aprantl, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

4 years agoUpdate empty() call with namespace to clear ambiguity.
Alina Sbirlea [Fri, 10 Apr 2020 01:37:13 +0000 (18:37 -0700)]
Update empty() call with namespace to clear ambiguity.

4 years agoMake BitVector::operator== return false for different-sized vectors.
Brad Moody [Fri, 10 Apr 2020 01:15:49 +0000 (20:15 -0500)]
Make BitVector::operator== return false for different-sized vectors.

This behaviour is in line with SmallBitVector and other vector-like
types.

Reviewed By: dblaikie

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