1. Jan 07, 2020
    • Raphael Isemann's avatar
      [lldb][NFC] Take a llvm::Triple in ClangASTContext constructor · d3648153
      Raphael Isemann authored
      This constructor is supposed to take a string representing an llvm::Triple.
      We might as well take a llvm::Triple here which saves us all the string
      conversions in the call sites and we make this more type safe.
      d3648153
    • Jim Lin's avatar
      [NFC] Use isX86() instead of getArch() · ab1bcda8
      Jim Lin authored
      Summary: This is a clean up for https://reviews.llvm.org/D72247.
      
      Reviewers: MaskRay, craig.topper, jhenderson
      
      Reviewed By: MaskRay
      
      Subscribers: hiraditya, rupprecht, cfe-commits, llvm-commits
      
      Tags: #clang, #llvm
      
      Differential Revision: https://reviews.llvm.org/D72320
      ab1bcda8
    • Ulrich Weigand's avatar
      [SystemZ] Fix python failure in test case · 4814b68b
      Ulrich Weigand authored
      With recent Python the Large/spill-02.py test failed with an error:
      TypeError: can't multiply sequence by non-int of type 'float'
      4814b68b
    • Ehud Katz's avatar
    • serge-sans-paille's avatar
      Fix compiler extension example cmake integration · 5a9c24b5
      serge-sans-paille authored
      - Do not add it to the Export file
      - Update install target
      
      Differential Revision: https://reviews.llvm.org/D72255
      5a9c24b5
    • Raphael Isemann's avatar
      [lldb] Fix LLDB build after API change to printInst (D72172) · 9890cc2e
      Raphael Isemann authored
      It seems in D72172 we always pass a 0 as the new default argument so let's
      do the same in LLDB to get the build bot running.
      9890cc2e
    • Ehud Katz's avatar
      [APFloat] Fix fusedMultiplyAdd when `this` equals to `Addend` · 08de551f
      Ehud Katz authored
      Up until now, the arguments to `fusedMultiplyAdd` are passed by
      reference. We must save the `Addend` value on the beginning of the
      function, before we modify `this`, as they may be the same reference.
      
      To fix this, we now pass the `addend` parameter of `multiplySignificand`
      by value (instead of by-ref), and have a default value of zero.
      
      Fix PR44051.
      
      Differential Revision: https://reviews.llvm.org/D70422
      08de551f
    • Siva Chandra Reddy's avatar
      [libc] Move implementations of strcat and strcpy to the string directory. · 188f72ab
      Siva Chandra Reddy authored
      Summary:
      Now that tests live in separate top-level directory, keeping the
      implementations of individual functions in a directory of their own is
      not meaningful. Hence, this change moves them into the higher level
      string directory.
      
      NFC intended.
      
      Reviewers: MaskRay
      
      Subscribers: mgorny, tschuett, libc-commits
      
      Tags: #libc-project
      
      Differential Revision: https://reviews.llvm.org/D72295
      188f72ab
    • Kazuaki Ishizaki's avatar
      [OpenMP] NFC: Fix trivial typos in comments · 4c6a098a
      Kazuaki Ishizaki authored
      Reviewers: jdoerfert, Jim
      
      Reviewed By: Jim
      
      Subscribers: Jim, mgorny, guansong, jfb, openmp-commits
      
      Tags: #openmp
      
      Differential Revision: https://reviews.llvm.org/D72285
      4c6a098a
    • Siva Chandra Reddy's avatar
      [libc] Add __attribute__((always_inline)) to x86_64 syscall functions. · 6598af4a
      Siva Chandra Reddy authored
      Summary:
      Some syscalls like SYS_clone do not tolerate a return instruction after
      the syscall instruction. Marking the syscall functions with the
      `always_inline` attribute accommodates such syscalls as inlining
      eliminates the return instruction.
      
      Reviewers: abrachet, phosek
      
      Subscribers: MaskRay, tschuett, libc-commits
      
      Tags: #libc-project
      
      Differential Revision: https://reviews.llvm.org/D72102
      6598af4a
    • Juneyoung Lee's avatar
      Let PassBuilder Expose PassInstrumentationCallbacks · ff554a91
      Juneyoung Lee authored
      Summary:
      This is an effort to allowing external libraries register their own pass instrumentation during their llvmGetPassPluginInfo() calls.
      
      By exposing this through the added getPIC(), now a pass writer can do something like this:
      
      ```
      extern "C" ::llvm::PassPluginLibraryInfo LLVM_ATTRIBUTE_WEAK
      llvmGetPassPluginInfo() {
        return {
          ..,
          [](llvm::PassBuilder &PB) {
            PB.getPIC()->registerAfterPassCallback(move(f));
          }
        };
      }
      ```
      
      Reviewers: chandlerc, philip.pfaffe, fedor.sergeev
      
      Reviewed By: fedor.sergeev
      
      Subscribers: llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71086
      ff554a91
    • Fangrui Song's avatar
      [MC] Add parameter `Address` to MCInstrPrinter::printInstruction · 3d87d0b9
      Fangrui Song authored
      Follow-up of D72172.
      
      Reviewed By: jhenderson, rnk
      
      Differential Revision: https://reviews.llvm.org/D72180
      3d87d0b9
    • Fangrui Song's avatar
      [MC] Add parameter `Address` to MCInstPrinter::printInst · aa708763
      Fangrui Song authored
      printInst prints a branch/call instruction as `b offset` (there are many
      variants on various targets) instead of `b address`.
      
      It is a convention to use address instead of offset in most external
      symbolizers/disassemblers. This difference makes `llvm-objdump -d`
      output unsatisfactory.
      
      Add `uint64_t Address` to printInst(), so that it can pass the argument to
      printInstruction(). `raw_ostream &OS` is moved to the last to be
      consistent with other print* methods.
      
      The next step is to pass `Address` to printInstruction() (generated by
      tablegen from the instruction set description). We can gradually migrate
      targets to print addresses instead of offsets.
      
      In any case, downstream projects which don't know `Address` can pass 0 as
      the argument.
      
      Reviewed By: jhenderson
      
      Differential Revision: https://reviews.llvm.org/D72172
      aa708763
    • Matt Arsenault's avatar
    • Nicolas Vasilache's avatar
      [mlir][Linalg] Add a linalg.reshape op · e3750caf
      Nicolas Vasilache authored
      Summary:
      This diff adds a new operation to linalg to allow reshaping of an
      existing view into a new view in the same buffer at the same offset.
      
      More specifically:
      The `linalg.reshape` op produces a new view whose sizes are a reassociation
      of the original `view`. Depending on whether or not the reassociated
      MemRefType is contiguous, the resulting memref may require explicit alloc
      and copies.
      
      A reassociation is defined as a continous grouping of dimensions and is
      represented with a affine map array attribute. In the future, non-continous
      groupings may be allowed (i.e. permutations, reindexings etc).
      
      For now, it is assumed that either:
        1. a reassociation produces and consumes contiguous MemRefType or,
        2. the reshape op will be folded into its consumers (by changing the shape
           of the computations).
      All other cases are undefined behavior and a reshape op may not lower to
      LLVM if it cannot be proven statically that it does not require alloc+copy.
      
      A reshape may either collapse or expand dimensions, depending on the
      relationship between source and target memref ranks. The verification rule
      is that the reassociation maps are applied to the memref with the larger
      rank to obtain the memref with the smaller rank. In the case of a dimension
      expansion, the reassociation maps can be interpreted as inverse maps.
      
      Examples:
      
      ```mlir
         // Dimension collapse (i, j) -> i' and k -> k'
         %1 = linalg.reshape %0 [(i, j, k) -> (i, j),
                                 (i, j, k) -> (k)] :
           memref<?x?x?xf32, stride_spec> into memref<?x?xf32, stride_spec_2>
      ```
      
      ```mlir
         // Dimension expansion i -> (i', j') and (k) -> (k')
         %1 = linalg.reshape %0 [(i, j, k) -> (i, j),
                                 (i, j, k) -> (k)] :
           memref<?x?xf32, stride_spec> into memref<?x?x?xf32, stride_spec_2>
      ```
      
      The relevant invalid and roundtripping tests are added.
      
      Reviewers: AlexEichenberger, ftynse, rriddle, asaadaldien, yangjunpro
      
      Subscribers: kiszk, merge_guards_bot, mehdi_amini, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D72168
      e3750caf
    • QingShan Zhang's avatar
      d877229b
    • Matt Arsenault's avatar
      AMDGPU: Add run line to int_to_fp tests · e8d9d202
      Matt Arsenault authored
      This wasn't catching a regression on targets with legal i16 triggered
      in a future commit.
      e8d9d202
    • Matt Arsenault's avatar
      AMDGPU: Select llvm.amdgcn.interp.p2.f16 directly · 452f6243
      Matt Arsenault authored
      This will enable automatic GlobalISel support in a future commit.
      452f6243
    • Richard Smith's avatar
      Always deduce the lengths of contained parameter packs when deducing a · 907cefe7
      Richard Smith authored
      pack expansion.
      
      Previously, if all parameter / argument pairs for a pack expansion
      deduction were non-deduced contexts, we would not deduce the arity of
      the pack, and could end up deducing a different arity (leading to
      failures during substitution) or defaulting to an arity of 0 (leading to
      bad diagnostics about passing the wrong number of arguments to a
      variadic function). Instead, we now always deduce the arity for all
      involved packs any time we deduce a pack expansion.
      
      This will result in less substitution happening in some cases, which
      could avoid non-SFINAEable errors, and should generally improve the
      quality of diagnostics when passing initializer lists to variadic
      functions.
      907cefe7
    • Matt Arsenault's avatar
      AMDGPU: Use default operands for clamp/omod · e93b1ffc
      Matt Arsenault authored
      We have a lot of complex pattern variants that just set the source
      modifiers that are really handled, and then set the output modifiers
      to 0. We're unlikely to ever match output modifiers from the use
      instruction side, and we already match clamp/omod in a separate pass.
      e93b1ffc
    • Heejin Ahn's avatar
      [WebAssembly] Fix landingpad-only case in Emscripten EH · 21f7b362
      Heejin Ahn authored
      Summary:
      Previously we didn't set `Changed` to true when there are only landing
      pads but not invokes. This fixes it and we set `Changed` to true
      whenever we have landing pads. (There can't be invokes without landing
      pads, so that case is covered too)
      
      The test case for this has to be a separate file because this pass is a
      `ModulePass` and `Changed` is computed based on the whole module.
      
      Reviewers: tlively
      
      Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D72308
      21f7b362
    • Matt Arsenault's avatar
      52afc93c
    • Akira Hatanaka's avatar
      [CodeGen][ObjC] Push the properties of a protocol before pushing the · 20f005d2
      Akira Hatanaka authored
      properties of the protocol it inherits
      
      This fixes a bug where the type string for a @dynamic property of an
      @implementation didn't have 'D' in it when the protocol it conforms to
      redeclares the property declared in the base protocol.
      
      rdar://problem/45503561
      20f005d2
    • Evgenii Stepanov's avatar
      7ba4595c
    • Mark de Wever's avatar
      [NFC] Fixes -Wrange-loop-analysis warnings · 5e0e0e3f
      Mark de Wever authored
      This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall.
      5e0e0e3f
    • Fangrui Song's avatar
      Add Triple::isX86() · 6904cd94
      Fangrui Song authored
      Reviewed By: craig.topper, skan
      
      Differential Revision: https://reviews.llvm.org/D72247
      6904cd94
    • Akira Hatanaka's avatar
      Use FileCheck instead of grep · c6fd16af
      Akira Hatanaka authored
      c6fd16af
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Select G_UADDE/G_USUBE · d4c9e133
      Matt Arsenault authored
      d4c9e133
    • Matt Arsenault's avatar
      AMDGPU/GlobalISel: Replace handling of boolean values · 4e85ca95
      Matt Arsenault authored
      This solves selection failures with generated selection patterns,
      which would fail due to inferring the SGPR reg bank for virtual
      registers with a set register class instead of VCC bank. Use
      instruction selection would constrain the virtual register to a
      specific class, so when the def was selected later the bank no longer
      was set to VCC.
      
      Remove the SCC reg bank. SCC isn't directly addressable, so it
      requires copying from SCC to an allocatable 32-bit register during
      selection, so these might as well be treated as 32-bit SGPR values.
      
      Now any scalar boolean value that will produce an outupt in SCC should
      be widened during RegBankSelect to s32. Any s1 value should be a
      vector boolean during selection. This makes the vcc register bank
      unambiguous with a normal SGPR during selection.
      
      Summary of how this should now work:
      
      - G_TRUNC is always a no-op, and never should use a vcc bank result.
      
      - SALU boolean operations should be promoted to s32 in RegBankSelect
        apply mapping
      
      - An s1 value means vcc bank at selection. The exception is for
        legalization artifacts that use s1, which are never VCC. All other
        contexts should infer the VCC register classes for s1 typed
        registers. The LLT for the register is now needed to infer the
        correct register class. Extensions with vcc sources should be
        legalized to a select of constants during RegBankSelect.
      
      - Copy from non-vcc to vcc ensures high bits of the input value are
        cleared during selection.
      
      - SALU boolean inputs should ensure the inputs are 0/1. This includes
        select, conditional branches, and carry-ins.
      
      There are a few somewhat dirty details. One is that G_TRUNC/G_*EXT
      selection ignores the usual register-bank from register class
      functions, and can't handle truncates with VCC result banks. I think
      this is OK, since the artifacts are specially treated anyway. This
      does require some care to avoid producing cases with vcc. There will
      also be no 100% reliable way to verify this rule is followed in
      selection in case of register classes, and violations manifests
      themselves as invalid copy instructions much later.
      
      Standard phi handling also only considers the bank of the result
      register, and doesn't insert copies to make the source banks
      match. This doesn't work for vcc, so we have to manually correct phi
      inputs in this case. We should add a verifier check to make sure there
      are no phis with mixed vcc and non-vcc register bank inputs.
      
      There's also some duplication with the LegalizerHelper, and some code
      which should live in the helper. I don't see a good way to share
      special knowledge about what types to use for intermediate operations
      depending on the bank for example. Using the helper to replace
      extensions with selects also seems somewhat awkward to me.
      
      Another issue is there are some contexts calling
      getRegBankFromRegClass that apparently don't have the LLT type for the
      register, but I haven't yet run into a real issue from this.
      
      This also introduces new unnecessary instructions in most cases, since
      we don't yet try to optimize out the zext when the source is known to
      come from a compare.
      4e85ca95
    • Matt Arsenault's avatar
      TableGen/GlobalISel: Handle default operands that are used · 26f714ff
      Matt Arsenault authored
      Copy the logic from the existing handling in the DAG matcher emittter.
      
      This will enable some AMDGPU pattern cleanups without breaking
      GlobalISel tests, and eventually handle importing more patterns.
      
      The test is a bit annoying since the sections seem to randomly sort
      themselves if anything else is added in the future.
      26f714ff
    • Matt Arsenault's avatar
      GlobalISel: Implement lower for G_INTRINSIC_ROUND · f3de8ab5
      Matt Arsenault authored
      Mostly copied from AMDGPU lowering implementation, except used
      G_SITOFP instead of directly creating a select on -1.0, 0.0.
      f3de8ab5
    • Jason Molenda's avatar
      Change the patterns to include the prefix '= ' so we don't pass errantly. · 450073c6
      Jason Molenda authored
      Looking at a sometimes-passing test case on a platform
      where random values were being returned - sometimes
      the expected digit ('1' or '2') would be included in the
      random returned value.  Add a prefix to reduce the likelihood of
      this a bit.
      450073c6
    • Philip Reames's avatar
    • Evgenii Stepanov's avatar
      [msan] Check qsort input. · b5e7f95c
      Evgenii Stepanov authored
      Summary:
      Qsort interceptor suppresses all checks by unpoisoning the data in the
      wrapper of a comparator function, and then unpoisoning the output array
      as well.
      
      This change adds an explicit run of the comparator on all elements of
      the input array to catch any sanitizer bugs.
      
      Reviewers: vitalybuka
      
      Subscribers: #sanitizers, llvm-commits
      
      Tags: #sanitizers, #llvm
      
      Differential Revision: https://reviews.llvm.org/D71780
      b5e7f95c
    • Davide Italiano's avatar
      [NSArray] Remove a very old and deprecated formatter. · 59fadc14
      Davide Italiano authored
      Checked with the Foundation folks.
      59fadc14
    • Petr Hosek's avatar
      [CMake] Pass symlink dependency to add_llvm_install_targets explicitly · 71a2a621
      Petr Hosek authored
      The install-${name}-stripped targets don't strip when ${name} is being
      symlinked, e.g. llvm-ar or llvm-objcopy. The problem is that
      llvm_install_symlink passes install-${dest} as a dependency of
      install-${name}, e.g. install-llvm-ar becomes a dependency of both
      install-llvm-ranlib and install-llvm-ranlib-stripped. What this means is
      that when installing a distribution that contains both llvm-ar and
      llvm-ranlib is that first the stripped version of llvm-ar is installed
      (by the install-llvm-ar-stripped target) and then it's overwritten by an
      unstripped version of llvm-ar bnecause install-llvm-ranlib-stripped has
      install-llvm-ranlib as a dependency as mentioned earlier. To avoid this
      issue, rather than passing the install-${dest} as dependency, we
      introduce a new argument to add_llvm_install_targets for symlink target
      which expands it into an appropriate dependency, i.e. install-${dest}
      for install-${name} target and install-${dest}-stripped for
      install-${name}-stripped.
      
      Differential Revision: https://reviews.llvm.org/D71951
      71a2a621
    • Bill Wendling's avatar
      Don't rely on 'l'(ell) modifiers to indicate a label reference · 83d690a1
      Bill Wendling authored
      Summary:
      It's not necessary to use an 'l'(ell) modifier when referencing a label.
      Treat block addresses and MBB references as if the modifier is used
      anyway. This prevents us from generating references to ficticious
      labels.
      
      Reviewers: jyknight, nickdesaulniers, hfinkel
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D71849
      83d690a1
    • Thomas Preud'homme's avatar
      [FileCheck] Remove FileCheck prefix in API · d8fd92ea
      Thomas Preud'homme authored
      Summary:
      When FileCheck was made a library, types in the public API were renamed
      to add a FileCheck prefix, such as Pattern to FileCheckPattern. Many
      types were moved into a private interface and thus don't need this
      prefix anymore. This commit removes those unneeded prefixes.
      
      Reviewers: jhenderson, jdenny, probinson, grimar, arichardson, rnk
      
      Reviewed By: jhenderson
      
      Subscribers: hiraditya, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D72186
      d8fd92ea
    • Jinsong Ji's avatar
      [PowerPC][NFC] Rename record instructions to use _rec suffix instead of o · 24ee4ede
      Jinsong Ji authored
      We use o suffix to indicate record form instuctions,
      (as it is similar to dot '.' in mne?)
      
      This was fine before, as we did not support XO-form.
      However, with https://reviews.llvm.org/D66902,
      we now have XO-form support.
      
      It becomes confusing now to still use 'o' for record form,
      and it is weird to have something like 'Oo' .
      
      This patch rename all 'o' instructions to use '_rec' instead.
      Also rename `isDot` to `isRecordForm`.
      
      Reviewed By: #powerpc, hfinkel, nemanjai, steven.zhang, lkail
      
      Differential Revision: https://reviews.llvm.org/D70758
      24ee4ede
    • Tyker's avatar
      [Diagnostic] make Wmisleading-indendation not warn about labels · f5329bfc
      Tyker authored
      Reviewers: aaron.ballman, xbolva00
      
      Reviewed By: aaron.ballman
      
      Subscribers: nickdesaulniers, nathanchance
      
      Differential Revision: https://reviews.llvm.org/D72202
      f5329bfc