1. Apr 11, 2020
    • Jonas Devlieghere's avatar
      [lldb/Test] Rewrite ReproducerInstrumentationTest · f78fcd69
      Jonas Devlieghere authored
      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.
      f78fcd69
    • Sam Clegg's avatar
      [WebAssembly] Minor cleanup to WebAssemblySubtarget. NFC. · 16206ee0
      Sam Clegg authored
      Pretty much all other platforms pass CPU string as arg0 of
      initializeSubtargetDependencies.
      
      Differential Revision: https://reviews.llvm.org/D77894
      16206ee0
    • Martijn Vels's avatar
      Make basic_string::operator=() tail call properly · 7ba045a4
      Martijn Vels authored
      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
      7ba045a4
    • Daniel Sanders's avatar
      Add -debugify-and-strip-all to add debug info before a pass and remove it after · f71350f0
      Daniel Sanders authored
      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
      f71350f0
    • Julian Lettner's avatar
      [lit] Increase sleep time in timeout test · 5925c4a0
      Julian Lettner authored
      Fixup for cbe42a9d.  Increase values for testing the overall lit
      timeout (--max-time) which wasn't enough for the test to complete on
      very slow build bots.
      5925c4a0
    • Lang Hames's avatar
    • Matt Arsenault's avatar
      Disable test on windows · 1e93b3d8
      Matt Arsenault authored
      1e93b3d8
    • Mircea Trofin's avatar
      [llvm][NFC] Inliner.cpp: ensure InlineHistory ID is always initialized; · da9bcdaa
      Mircea Trofin authored
      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
      da9bcdaa
    • Daniel Sanders's avatar
      [mir-strip-debug] Optionally preserve debug info that wasn't from debugify/mir-debugify · dfca98d6
      Daniel Sanders authored
      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
      dfca98d6
    • Julian Lettner's avatar
      [lit] Add SKIPPED test result category · cbe42a9d
      Julian Lettner authored
      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
      cbe42a9d
    • Christopher Tetreault's avatar
      Clean up usages of asserting vector getters in Type · 889f6606
      Christopher Tetreault authored
      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
      889f6606
    • River Riddle's avatar
      [mlir][Pass] Allow duplicate pass registration. · 33f76e23
      River Riddle authored
      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
      33f76e23
    • Louis Dionne's avatar
      [libc++] NFC: Clean up a lot of old Lit features · 7149bb70
      Louis Dionne authored
      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).
      7149bb70
    • Christopher Tetreault's avatar
      Clean up usages of asserting vector getters in Type · 40ed21bb
      Christopher Tetreault authored
      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
      40ed21bb
    • River Riddle's avatar
      [mlir][ODS] Add support for optional operands and results with a new Optional directive. · aba1acc8
      River Riddle authored
      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
      aba1acc8
    • Christopher Tetreault's avatar
      Clean up usages of asserting vector getters in Type · 2a922da3
      Christopher Tetreault authored
      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
      2a922da3
    • Daniel Sanders's avatar
      Make TargetPassConfig and llc add pre/post passes the same way. NFC · c162bc2a
      Daniel Sanders authored
      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
      c162bc2a
    • Christopher Tetreault's avatar
      Clean up usages of asserting vector getters in Type · 92dde8a6
      Christopher Tetreault authored
      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
      92dde8a6
    • Lang Hames's avatar
      [ORC] Use CodeGenOpt::Default as the default level in JITTargetMachineBuilder. · 92210cb2
      Lang Hames authored
      This matches EngineBuilder/MCJIT's default.
      92210cb2
    • Louis Dionne's avatar
    • River Riddle's avatar
      [mlir] Emit errors if global constructors are found within lib/ · 3db57d14
      River Riddle authored
      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
      3db57d14
    • Sanjay Patel's avatar
      [x86] add test for FP->int->FP casts; NFC (PR36617) · ebf22a49
      Sanjay Patel authored
      Also, add a common prefix for SSE to reduce redundant CHECK lines.
      ebf22a49
    • Jacques Pienaar's avatar
      [mlir][drr] Allow specifying string in location · d6b32e39
      Jacques Pienaar authored
      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
      d6b32e39
    • Craig Topper's avatar
    • LLVM GN Syncbot's avatar
      [gn build] Port ea11f472 · 516a671b
      LLVM GN Syncbot authored
      516a671b
    • Marcello Maggioni's avatar
      Split LiveRangeCalc in LiveRangeCalc/LiveIntervalCalc. NFC · ea11f472
      Marcello Maggioni authored
      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
      ea11f472
    • Nicolas Vasilache's avatar
      [mlir][Linalg] Create a tool to generate named Linalg ops from a Tensor... · 882ba484
      Nicolas Vasilache authored
      [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 loo...
      882ba484
    • Sumanth Gundapaneni's avatar
    • Matt Morehouse's avatar
      Implement `-fsanitize-coverage-whitelist` and `-fsanitize-coverage-blacklist` for clang · bef187c7
      Matt Morehouse authored
      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
      bef187c7
    • Fangrui Song's avatar
      [MC][RISCV] Make .reloc support arbitrary relocation types · a7aaaf70
      Fangrui Song authored
      Similar to D76746 (ARM), D76754 (AArch64) and llvmorg-11-init-6967-g152d14da (x86)
      
      Differential Revision: https://reviews.llvm.org/D77018
      a7aaaf70
    • Matt Arsenault's avatar
      AMDGPU: Teach toolchain to link rocm device libs · 4593e413
      Matt Arsenault authored
      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).
      4593e413
    • Adrian Prantl's avatar
    • Craig Topper's avatar
      [CallSite removal][X86] Remove unneeded use of CallSite. NFC · a6732069
      Craig Topper authored
      We already have a CallInst, we can just get the calling convention from it.
      a6732069
    • Raphael Isemann's avatar
      02d152bb
    • David Blaikie's avatar
      Fix a few mismatched iterator types revealed from a libc++ + LLVM_EXPENSIVE_CHECKS build · 67a2cc80
      David Blaikie authored
      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.
      67a2cc80
    • Kevin P. Neal's avatar
      [FPEnv][AArch64] Platform-specific builtin constrained FP enablement · 7f38812d
      Kevin P. Neal authored
      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
      7f38812d
    • Nemanja Ivanovic's avatar
      [PowerPC][NFC] Add test for 5b18b6e9 · 95b718e5
      Nemanja Ivanovic authored
      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.
      95b718e5
    • Simon Pilgrim's avatar
    • Simon Pilgrim's avatar
    • Fangrui Song's avatar
      [llvm-dwarfdump] Interface cleanup. NFC · b1849231
      Fangrui Song authored
      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
      b1849231