1. May 05, 2020
    • Sam Parker's avatar
      [NFC] Update tests · f35ccfa2
      Sam Parker authored
      Run the update script on a couple of tests.
      f35ccfa2
    • Louis Dionne's avatar
      [libc++] Remove unused functions and minor features of the test suite · 7e6221da
      Louis Dionne authored
      This commit removes minor features of the test suite that I've never
      seen used and that are basically just a maintenance burden:
      
      - color_diagnostics: Diagnostics are colored by default when running
        from a terminal, and not colored otherwise. This is the right behavior.
        Being able to tweak this has minor value, and could be achieved by
        modifying the %{compile_flags} instead if absolutely needed.
      
      - ccache: This can be achieved by using a wrapper for the %{cxx}
        substitution.
      
      - _dump_macros_verbose is just a dead function now.
      7e6221da
    • Ehsan Toosi's avatar
      [MLIR][LINALG] Convert Linalg on Tensors to Buffers · 6ccaf738
      Ehsan Toosi authored
      This is a basic pass to convert Linalg.GenericOp which works on tensors to use
      buffers instead.
      
      Differential Revision: https://reviews.llvm.org/D78996
      6ccaf738
    • Jay Foad's avatar
      [InstCombine] Remove hasOneUse check for pow(C,x) -> exp2(log2(C)*x) · fa2783d7
      Jay Foad authored
      I don't think there's any good reason not to do this transformation when
      the pow has multiple uses.
      
      Differential Revision: https://reviews.llvm.org/D79407
      fa2783d7
    • Louis Dionne's avatar
      [libc++] Allow <__config_site> not being included · 17a53a14
      Louis Dionne authored
      Otherwise, we can't test other standard libraries.
      17a53a14
    • Matt Arsenault's avatar
      Elaborate more on --rocm-path flag. · 684dc1be
      Matt Arsenault authored
      I'm not sure what the conventions are for this documentation. The
      format seems limiting. I don't see how to refer to other flags, or
      mark flags as deprecated. The rst I believe these generate seems to be
      in source, and out of date.
      684dc1be
    • Louis Dionne's avatar
    • Raphael Isemann's avatar
      Revert "[lldb][cmake] Also use local submodule visibility on Darwin" · 5d33faeb
      Raphael Isemann authored
      This reverts commit 8baa0b94. This broke the
      LLDB Green Dragon bot where htonl is getting miscompiled on macOS 10.14 and 10.15
      SDKs, causing networking tests to fail as IP addressed were being inverted
      (e.g., 127.0.0.1 became 1.0.0.127 with an enabled modules build).
      
      Reverting until this is fixed.
      5d33faeb
    • Jonathan Coe's avatar
      [clang-format] C# always regards && as a binary operator · 047898c9
      Jonathan Coe authored
      Reviewers: krasimir, MyDeveloperDay
      
      Reviewed By: MyDeveloperDay
      
      Subscribers: cfe-commits
      
      Tags: #clang-format, #clang
      
      Differential Revision: https://reviews.llvm.org/D79414
      047898c9
    • Sebastian Neubauer's avatar
      [AMDGPU] Don't mark the .note section as ALLOC · 1de4e569
      Sebastian Neubauer authored
      Marking a section as ALLOC tells the ELF loader to load the section into memory.
      As we do not want to load the notes into VRAM, the flag should not be there.
      
      On AMDHSA, .note is still marked as ALLOC, apparently this is currently
      needed for OpenCL (see https://reviews.llvm.org/D74995).
      
      Differential Revision: https://reviews.llvm.org/D76278
      1de4e569
    • Sander de Smalen's avatar
      [AArch64][SVE] Guard bitcast patterns under IsLE predicate · 8cb5663a
      Sander de Smalen authored
      Reviewed By: efriedma
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79352
      8cb5663a
    • David Green's avatar
      [ARM] Correct the type on a predicate cast · f85acb19
      David Green authored
      A PREDICATE_CAST(PREDICATE_CAST(X)) can be converted to a
      PREDICATE_CAST(X) as the operation can convert between any forms of
      predicates (v4i1/v8i1/v16i1/i32). Unfortunately I got the type wrong on
      one of the rarer converts, which would lead to invalid nodes during
      isel. This fixes it up to use the correct type.
      
      Differential Revision: https://reviews.llvm.org/D79402
      f85acb19
    • Sander de Smalen's avatar
      [SveEmitter] Add builtins for svreinterpret · 5ba32905
      Sander de Smalen authored
      The reinterpret builtins are generated separately because they
      need the cross product of all types, 121 functions in total,
      which is inconvenient to specify in the arm_sve.td file.
      
      Reviewers: SjoerdMeijer, efriedma, ctetreau, rengolin
      
      Reviewed By: efriedma
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D78756
      5ba32905
    • Jean-Michel Gorius's avatar
      [mlir][standalone] NFC: Update CMakeLists.txt to reflect best practices · 98b8b36d
      Jean-Michel Gorius authored
      Update to follow the changes introduced in 5469f434 and documented in 93f7e525.
      98b8b36d
    • Simon Pilgrim's avatar
      [InstCombine] Fold or(zext(bswap(x)),shl(zext(bswap(y)),bw/2)) ->... · 5c91aa66
      Simon Pilgrim authored
      [InstCombine] Fold or(zext(bswap(x)),shl(zext(bswap(y)),bw/2)) -> bswap(or(zext(x),shl(zext(y), bw/2))
      
      This adds a general combine that can be used to fold:
      
        or(zext(OP(x)), shl(zext(OP(y)),bw/2))
      -->
        OP(or(zext(x), shl(zext(y),bw/2)))
      
      Allowing us to widen 'concat-able' style or+zext patterns - I've just set this up for BSWAP but we could use this for other similar ops (BITREVERSE for instance).
      
      We already do something similar for bitop(bswap(x),bswap(y)) --> bswap(bitop(x,y))
      
      Fixes PR45715
      
      Reviewed By: @lebedev.ri
      
      Differential Revision: https://reviews.llvm.org/D79041
      5c91aa66
    • Alexander Belyaev's avatar
      [MLIR] Link MLIRStandardOpsTransforms with MLIRTransforms. · 72700fea
      Alexander Belyaev authored
      Summary: This fixes shared lib build.
      
      Differential Revision: https://reviews.llvm.org/D79403
      72700fea
    • Simon Pilgrim's avatar
      [X86][AVX] combineVectorSignBitsTruncation - avoid complex vXi64->vXi32 PACKSS... · e53d4869
      Simon Pilgrim authored
      [X86][AVX] combineVectorSignBitsTruncation - avoid complex vXi64->vXi32 PACKSS truncations (PR45794)
      
      Unless we're truncating an 'all-bits' result, using PACKSS for vXi64->vXi32 truncation causes problems with later combines as ComputeNumSignBits struggles to see through BITCASTs to smaller types. If we don't use PACKSS in these cases then we fallback to shuffles which are usually just as good.
      e53d4869
    • Simon Pilgrim's avatar
      371a69ac
    • Kadir Cetinkaya's avatar
      [clangd] Get rid of Inclusion::R · d870016b
      Kadir Cetinkaya authored
      Summary:
      This is only used by documentlink and go-to-definition. We are pushing
      range detection logic from Inclusion creation to users. This would make using
      stale preambles easier.
      
      For document links we make use of the spelledtokens stored in tokenbuffers to
      figure out file name range.
      
      For go-to-def, we keep storing the line number we've seen the include directive.
      
      Reviewers: sammccall
      
      Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D79315
      d870016b
    • James Henderson's avatar
      [docs][llvm-objcopy] Update --output-target text with right defaults · 5beb9fa4
      James Henderson authored
      The --output-target documentation has slightly rotted, as the default is
      no longer purely based on the input file format, but also the value of
      --input-target. This patch updates the documentation to make this
      explicit.
      
      Reviewed by: MaskRay, alexshap
      
      Differential Revision: https://reviews.llvm.org/D79318
      5beb9fa4
    • Nico Weber's avatar
      [gn build] (manually) merge 07f8ca6a · f174f1c5
      Nico Weber authored
      f174f1c5
    • Andrea Di Biagio's avatar
      Forgot to add a -mtriple to a test. NFC · 5bb5fa3c
      Andrea Di Biagio authored
      This should unbreak the clang-ppc64be-linux buildbot.
      5bb5fa3c
    • Kirill Bobyrev's avatar
      [clangd] NFC: Cleanup unused headers and libraries · 07f8ca6a
      Kirill Bobyrev authored
      Summary: Extended version of D78843.
      
      Reviewers: sammccall
      
      Reviewed By: sammccall
      
      Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D79313
      07f8ca6a
    • Sander de Smalen's avatar
      Reland D78750: [SveEmitter] Add builtins for svdupq and svdupq_lane · aed6bd6f
      Sander de Smalen authored
      Edit: Changed a few CHECK lines into CHECK-DAG lines.
      
      This reverts commit 90f3f62c.
      aed6bd6f
    • Sam Parker's avatar
      [NFC][CostModel] Add TargetCostKind to relevant APIs · 40574fef
      Sam Parker authored
      Make the kind of cost explicit throughout the cost model which,
      apart from making the cost clear, will allow the generic parts to
      calculate better costs. It will also allow some backends to
      approximate and correlate the different costs if they wish. Another
      benefit is that it will also help simplify the cost model around
      immediate and intrinsic costs, where we currently have multiple APIs.
      
      RFC thread:
      http://lists.llvm.org/pipermail/llvm-dev/2020-April/141263.html
      
      Differential Revision: https://reviews.llvm.org/D79002
      40574fef
    • Andrea Di Biagio's avatar
      [MCA] Fixed a bug where loads and stores were sometimes incorrectly marked as... · 5578ec32
      Andrea Di Biagio authored
      [MCA] Fixed a bug where loads and stores were sometimes incorrectly marked as depedent. Fixes PR45793.
      
      This fixes a regression introduced by a very old commit 280ac1fd (was
      llvm-svn 361950).
      
      Commit 280ac1fd redesigned the logic in the LSUnit with the goal of
      speeding up isReady() queries, and stabilising the LSUnit API (while also making
      the load store unit more customisable).
      
      The concept of MemoryGroup (effectively an alias set) was added by that commit
      to better describe and track dependencies between memory operations.  However,
      that concept was not just used for alias dependencies, but it was also used for
      describing memory "order" dependencies (enforced by the memory consistency
      model).
      
      Instructions of a same memory group were considered "equivalent" as in:
      independent operations that can potentially execute in parallel.  The problem
      was that the cost of a dependency (in terms of number of cycles) should have
      been different for "order" dependency. Instructions in an order dependency
      simply have to have to wait until their predecessors are "issued" to an
      underlying pipeline (rather than having to wait until predecessors have beeng
      fully executed). For simple "order" dependencies, this was effectively
      introducing an artificial delay on the "issue" of independent loads and stores.
      
      This patch fixes the issue and adds a new test named 'independent-load-stores.s'
      to a bunch of x86 targets. That test contains the reproducible posted by Fabian
      Ritter on PR45793.
      
      I had to rerun the update-mca-tests script on several files. To avoid expected
      regressions on some Exynos tests, I have added a -noalias=false flag (to match
      the old strict behavior on latencies).
      
      Some tests for processor Barcelona are improved/fixed by this change and they
      now show better results.  In a few tests we were incorrectly counting the time
      spent by instructions in a scheduler queue.  In one case in particular we now
      correctly see a store executed out of order.  That test was affected by the same
      underlying issue reported as PR45793.
      
      Reviewers: mattd
      
      Differential Revision: https://reviews.llvm.org/D79351
      5578ec32
    • Pratyai Mazumder's avatar
      [SanitizerCoverage] Replace the unconditional store with a load, then a conditional store. · 08032e71
      Pratyai Mazumder authored
      Reviewers: vitalybuka, kcc
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79392
      08032e71
    • Alex Zinenko's avatar
      [mlir] NFC: update ::build signature in the tutorial document · 898f74c3
      Alex Zinenko authored
      This was missing from the original commit that changed the interface of
      `::build` methods to take `OpBuilder &` instead of `Builder *.
      898f74c3
    • Heejin Ahn's avatar
      [WebAssembly] Fix block marker placing after fixUnwindMismatches · 834debff
      Heejin Ahn authored
      Summary:
      This fixes a few things that are connected. It is very hard to provide
      an independent test case for each of those fixes, because they are
      interconnected and sometimes one masks another. The provided test case
      triggers some of those bugs below but not all.
      
      ---
      
      1. Background:
      `placeBlockMarker` takes a BB, and if the BB is a destination of some
      branch, it places `end_block` marker there, and computes the nearest
      common dominator of all predecessors (what we call 'header') and places
      a `block` marker there.
      
      When we first place markers, we traverse BBs from top to bottom. For
      example, when there are 5 BBs A, B, C, D, and E and B, D, and E are
      branch destinations, if mark the BB given to `placeBlockMarker` with `*`
      and draw a rectangle representing the border of `block` and `end_block`
      markers, the process is going to look like
      ```
                             -------
                 -----       |-----|
       ---       |---|       ||---||
       |A|       ||A||       |||A|||
       ---  -->  |---|  -->  ||---||
       *B        | B |       || B ||
        C        | C |       || C ||
        D        -----       |-----|
        E         *D         |  D  |
                   E         -------
                               *E
      ```
      which means when we first place markers, we go from inner to outer
      scopes. So when we place a `block` marker, if the header already
      contains other `block` or `try` marker, it has to belong to an inner
      scope, so the existing `block`/`try` markers should go _after_ the new
      marker. This was the assumption we had.
      
      But after placing all markers we run `fixUnwindMismatches` function.
      There we do some control flow transformation and create some branches,
      and we call `placeBlockMarker` again to place `block`/`end_block`
      markers for those newly created branches. We can't assume that we are
      traversing branch destination BBs from top to bottom now because we are
      basically inserting some new markers in the middle of existing markers.
      
      Fix:
      In `placeBlockMarker`, we don't have the assumption that the BB given is
      in the order of top to bottom, and when placing `block` markers,
      calculates whether existing `block` or `try` markers are inner or
      outer scopes with respect to the current scope.
      
      ---
      
      2. Background:
      In `fixUnwindMismatches`, when there is a call whose correct unwind
      destination mismatches the current destination after initially placing
      `try` markers, we wrap that with a new nested `try`/`catch`/`end` and
      jump to the correct handler within the new `catch`. The correct handler
      code is split as a separate BB from its original EH pad so it can be
      branched to. Here's an example:
      
      - Before
      ```
      mbb:
        call @foo       <- Unwind destination mismatch!
      wrong-ehpad:
        catch
        ...
      cont:
        end_try
        ...
      correct-ehpad:
        catch
        [handler code]
      ```
      
      - After
      ```
      mbb:
        try                (new)
        call @foo
      nested-ehpad:        (new)
        catch              (new)
        local.set n / drop (new)
        br %handleri       (new)
      nested-end:          (new)
        end_try            (new)
      wrong-ehpad:
        catch
        ...
      cont:
        end_try
        ...
      correct-ehpad:
        catch
        local.set n / drop (new)
      handler:             (new)
        end_try
        [handler code]
      ```
      
      Note that after this transformation, it is possible there are no calls
      to actually unwind to `correct-ehpad` here. `call @foo` now
      branches to `handler`, and there can be no other calls to unwind to
      `correct-ehpad`. In this case `correct-ehpad` does not have any
      predecessors anymore.
      
      This can cause a bug in `placeBlockMarker`, because we may need to place
      `end_block` marker in `handler`, and `placeBlockMarker` computes the
      nearest common dominator of all predecessors. If one of `handler`'s
      predecessor (here `correct-ehpad`) does not have any predecessors, i.e.,
      no way of reaching it, we cannot correctly compute the common dominator
      of predecessors of `handler`, and end up placing no `block`/`end`
      markers. This bug actually sometimes masks the bug 1.
      
      Fix:
      When we have an EH pad that does not have any predecessors after this
      transformation, deletes all its successors, so that its successors don't
      have any dangling predecessors.
      
      ---
      
      3. Background:
      Actually the `handler` BB in the example shown in bug 2 doesn't need
      `end_block` marker, despite it being a new branch destination, because
      it already has `end_try` marker which can serve the same purpose. I just
      put that example there for an illustration purpose. There is a case we
      actually need to place `end_block` marker: when the branch dest is the
      appendix BB. The appendix BB is created when there is a call that is
      supposed to unwind to the caller ends up unwinding to a wrong EH pad. In
      this case we also wrap the call with a nested `try`/`catch`/`end`,
      create an 'appendix' BB at the very end of the function, and branch to
      that BB, where we rethrow the exception to the caller.
      
      Fix:
      When we don't actually need to place block markers, we don't.
      
      ---
      
      4. In case we fall through to the continuation BB after the catch block,
      after extracting handler code in `fixUnwindMismatches` (refer to bug 2
      for an example), we now have to add a branch to it to bypass the
      handler.
      - Before
      ```
      try
        ...
        (falls through to 'cont')
      catch
        handler body
      end
                    <-- cont
      ```
      
      - After
      ```
      try
        ...
        br %cont    (new)
      catch
      end
      handler body
                    <-- cont
      ```
      
      The problem is, we haven't been placing a new `end_block` marker in the
      `cont` BB in this case. We should, and this fixes it. But it is hard to
      provide a test case that triggers this bug, because the current
      compilation pipeline from .ll to .s does not generate this kind of code;
      we always have a `br` after `invoke`. But code without `br` is still
      valid, and we can have that kind of code if we have some pipeline
      changes or optimizations later. Even mir test cases cannot trigger this
      part for now, because we don't encode auxiliary EH-related data
      structures (such as `WasmEHFuncInfo`) in mir now. Those functionalities
      can be added later, but I don't think we should block this fix on that.
      
      Reviewers: dschuff
      
      Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D79324
      834debff
    • Pierre-vh's avatar
      [Target][ARM] Fold or(A, B) more aggressively for I1 vectors · d5eb7ffa
      Pierre-vh authored
      This patch makes the folding of or(A, B) into not(and(not(A), not(B)))
      more agressive for I1 vector. This only affects Thumb2 MVE and improves
      codegen, because it removes a lot of msr/mrs instructions on VPR.P0.
      
      This patch also adds a xor(vcmp) -> !vcmp fold for MVE.
      
      Differential Revision: https://reviews.llvm.org/D77202
      d5eb7ffa
    • Pierre-vh's avatar
      [Target][ARM] Add PerformVSELECTCombine for MVE Integer Ops · ffdda495
      Pierre-vh authored
      This patch adds an implementation of PerformVSELECTCombine in the
      ARM DAG Combiner that transforms vselect(not(cond), lhs, rhs) into
      vselect(cond, rhs, lhs).
      
      Normally, this should be done by the target-independent DAG Combiner,
      but it doesn't handle the kind of constants that we generate, so we
      have to reimplement it here.
      
      Differential Revision: https://reviews.llvm.org/D77712
      ffdda495
    • Peter Smith's avatar
      [ELF][ARM] Do not create .ARM.exidx sections for out of range inputs · 48aebfc9
      Peter Smith authored
      A linker will create .ARM.exidx sections for InputSections that don't
      have them. This can cause a relocation out of range error If the
      InputSection happens to be extremely far away from the other sections.
      This is often the case for the vector table on older ARM CPUs as the only
      two places that the table can be placed is 0 or 0xffff0000. We fix this
      by removing InputSections that need a linker generated .ARM.exidx
      section if that would cause an error.
      
      Differential Revision: https://reviews.llvm.org/D79289
      48aebfc9
    • David Green's avatar
      [ARM] MVE predcast with const test. NFC · 09767af8
      David Green authored
      09767af8
    • Martin Storsjö's avatar
      5a1c3017
    • Haojian Wu's avatar
      [clang] Fix an uint32_t overflow in large preamble. · 4f8d9722
      Haojian Wu authored
      Summary:
      I was surprised to see the LocalOffset can exceed uint32_t, but it
      does happen and lead to crashes in one of our internal huge TU with a large
      preamble.
      
      with this patch, the crash is gone.
      
      Reviewers: sammccall
      
      Subscribers: cfe-commits
      
      Tags: #clang
      
      Differential Revision: https://reviews.llvm.org/D79397
      4f8d9722
    • Alexander Belyaev's avatar
      [MLIR] Add conversion from AtomicRMWOp -> GenericAtomicRMWOp. · b79751e8
      Alexander Belyaev authored
      Adding this pattern reduces code duplication. There is no need to have a
      custom implementation for lowering to llvm.cmpxchg.
      
      Differential Revision: https://reviews.llvm.org/D78753
      b79751e8
    • David Sherwood's avatar
      [CodeGen] Fix warnings due to SelectionDAG::getSplatSourceVector · cd3a54c5
      David Sherwood authored
      Summary:
      I have fixed several places in getSplatSourceVector and isSplatValue
      to work correctly with scalable vectors. I added new support for
      the ISD::SPLAT_VECTOR DAG node as one of the obvious cases we can
      support with scalable vectors. In other places I have tried to do
      the sensible thing, such as bail out for vector types we don't yet
      support or don't intend to support.
      
      It's not possible to add IR test cases to cover these changes, since
      they are currently only ever exercised on certain targets, e.g.
      only X86 targets use the result of getSplatSourceVector. I've
      assumed that X86 tests already exist to test these code paths for
      fixed vectors. However, I have added some AArch64 unit tests that
      test the specific functions I have changed.
      
      Differential revision: https://reviews.llvm.org/D79083
      cd3a54c5
    • Julian Lettner's avatar
      [lit] Create one output file when `--output` is specified more than once · 47b25c33
      Julian Lettner authored
      The argparse 'append' action concatenates multiple occurrences of an
      argument (even when we specify `nargs=1` or `nargs='?'`).  This means
      that we create multiple identical output files if the `--output`
      argument is given more than once.  This isn't useful and we instead want
      this to behave like a standard optional argument: last occurrence wins.
      47b25c33
    • Reid Kleckner's avatar
      [PDB] Move stream index tracking to GSIStreamBuilder · b7438c25
      Reid Kleckner authored
      The GSIHashStreamBuilder doesn't need to know the stream index.
      Standardize the naming (Idx -> Index in public APIs).
      b7438c25
    • Stephen Neuendorffer's avatar