1. Feb 17, 2020
  2. Feb 16, 2020
    • Sanjay Patel's avatar
      [VectorCombine] fix cost calc for extract-cmp · 62dd44d7
      Sanjay Patel authored
      getOperationCost() is not the cost we wanted; that's not the
      throughput value that the rest of the calculation uses.
      
      We may want to switch everything in this code to use the
      getInstructionThroughput() wrapper to avoid these kinds of
      problems, but I'll look at that as a follow-up because that
      can create other logical diffs via using optional parameters
      (we'd need to speculatively create the vector instruction to
      make a fair(er) comparison).
      62dd44d7
    • Sanjay Patel's avatar
      [x86] form broadcast of scalar memop even with >1 use · e48b536b
      Sanjay Patel authored
      The unseen logic diff occurs because MayFoldLoad() is defined like this:
      
      static bool MayFoldLoad(SDValue Op) {
        return Op.hasOneUse() && ISD::isNormalLoad(Op.getNode());
      }
      
      The test diffs here all seem ok to me on screen/paper, but it's hard to know
      if that will lead to universally better perf for all targets. For example,
      if a target implements broadcast from mem as multiple uops, we would have to
      weigh the potential reduction of instructions and register pressure vs.
      possible increase in number of uops. I don't know if we can make a truly
      informed decision on this at compile-time.
      
      The motivating case that I'm looking at in PR42024:
      https://bugs.llvm.org/show_bug.cgi?id=42024
      ...resembles the diff in extract-concat.ll, but we're not going to change the
      larger example there without at least 1 other fix.
      
      Differential Revision: https://reviews.llvm.org/D74088
      e48b536b
    • Nikita Popov's avatar
      [InstCombine] Create new log2 intrinsic; NFCI · 893c630f
      Nikita Popov authored
      Rather than mixing creation of new instructions and in-place
      modification here, create a new log2 intrinsic. This should be
      NFC apart from worklist order changes.
      893c630f
    • Nikita Popov's avatar
      [InstCombine] Add multiuse tests for cttz transform; NFC · 6cdc36af
      Nikita Popov authored
      These show incorrect duplication of instructions.
      6cdc36af
    • Mark de Wever's avatar
      [Sema] Adds the pointer-to-int-cast diagnostic · 9658d895
      Mark de Wever authored
      Converting a pointer to an integer whose result cannot represented in the
      integer type is undefined behavior is C and prohibited in C++. C++ already
      has a diagnostic when casting. This adds a diagnostic for C.
      
      Since this diagnostic uses the range of the conversion it also modifies
      int-to-pointer-cast diagnostic to use a range.
      
      Fixes PR8718: No warning on casting between pointer and non-pointer-sized int
      
      Differential Revision: https://reviews.llvm.org/D72231
      9658d895
    • Nikita Popov's avatar
      [IRBuilder] Try to fix warnings · 1b04866a
      Nikita Popov authored
      Try to fix -Wnon-virtual-dtor warnings that cause build failure
      on clang-pcc64le-rhel.
      1b04866a
    • Nikita Popov's avatar
      [IRBuilder] Virtualize IRBuilder · 0765d382
      Nikita Popov authored
      Related llvm-dev thread:
      http://lists.llvm.org/pipermail/llvm-dev/2020-February/138951.html
      
      This patch moves the IRBuilder from templating over the constant
      folder and inserter towards making both of these virtual.
      There are a couple of motivations for this:
      
      1. It's not possible to share code between use-sites that use
      different IRBuilder folders/inserters (short of templating the code
      and moving it into headers).
      2. Methods currently defined on IRBuilderBase (which is not templated)
      do not use the custom inserter, resulting in subtle bugs (e.g.
      incorrect InstCombine worklist management). It would be possible to
      move those into the templated IRBuilder, but...
      3. The vast majority of the IRBuilder implementation has to live
      in the header, because it depends on the template arguments.
      4. We have many unnecessary dependencies on IRBuilder.h,
      because it is not easy to forward-declare. (Significant parts of
      the backend depend on it via TargetLowering.h, for example.)
      
      This patch addresses the issue by making the following changes:
      
      * IRBuilderDefaultInserter::InsertHelper becomes virtual.
        IRBuilderBase accepts a reference to it.
      * IRBuilderFolder is introduced as a virtual base class. It is
       implemented by ConstantFolder (default), NoFolder and TargetFolder.
        IRBuilderBase has a reference to this as well.
      * All the logic is moved from IRBuilder to IRBuilderBase. This means
        that methods can in the future replace their IRBuilder<> & uses
        (or other specific IRBuilder types) with IRBuilderBase & and thus
        be usable with different IRBuilders.
      * The IRBuilder class is now a thin wrapper around IRBuilderBase.
        Essentially it only stores the folder and inserter and takes care
        of constructing the base builder.
      
      What this patch doesn't do, but should be simple followups after this change:
      
      * Fixing use of the inserter for creation methods originally defined
        on IRBuilderBase.
      * Replacing IRBuilder<> uses in arguments with IRBuilderBase, where useful.
      * Moving code from the IRBuilder header to the source file.
      
      From the user perspective, these changes should be mostly transparent:
      The only thing that consumers using a custom inserted may need to do is
      inherit from IRBuilderDefaultInserter publicly and mark their InsertHelper
      as public.
      
      Differential Revision: https://reviews.llvm.org/D73835
      0765d382
    • Georgii Rymar's avatar
      [llvm-readobj] - Refactor the code that dumps relocations. · 22ebf080
      Georgii Rymar authored
      The current code has following issues:
      1) It has a duplicated logic part.
      2) This logic relies on unwrapOrError calls, but if we want to convert
         them to warnings, we will need to change all of them what is hard to do
         because of the duplication.
      
      In this patch I've created a new method that returns Expected<> what allows
      now to catch all errors in a single place and remove the code duplication.
      
      Note: this change is itself a refactor NFC. It does not change the current logic
      anyhow. It prepares the code for the follow-up(s).
      
      Differential revision: https://reviews.llvm.org/D74545
      22ebf080
    • riverriddle@google.com's avatar
      [mlir] Allow adding extra class declarations to interfaces. · 857b655d
      riverriddle@google.com authored
      Summary: This matches the similar feature on operation definitions.
      
      Reviewers: jpienaar, antiagainst
      
      Reviewed By: jpienaar, antiagainst
      
      Subscribers: mehdi_amini, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits
      
      Tags: #llvm
      
      Differential Revision: https://reviews.llvm.org/D74438
      857b655d
    • River Riddle's avatar
      [mlir][Parser][NFC] Remove several usages of getEncodedSourceLocation · 9b07512f
      River Riddle authored
      Summary: getEncodedSourceLocation can be very costly to compute, especially if the input line becomes very long. This revision inlines some of the verification of a few `getChecked` methods to avoid the materialization of an encoded source location.
      
      Differential Revision: https://reviews.llvm.org/D74587
      9b07512f
    • Johannes Doerfert's avatar
      [FIX] Do not copy an llvm::function_ref if it has to be reused · 857bf5da
      Johannes Doerfert authored
      Some buildbots signaled a problem in this method when the
      llvm::function_ref was copied and reused after 1228d42d. To
      eliminate the problem we avoid copying the llvm::function_ref and
      instead we pass it as a const reference.
      857bf5da
    • Johannes Doerfert's avatar
    • Dimitry Andric's avatar
      Restore functionality of --sysroot on FreeBSD after b18cb9c4 · 62654cab
      Dimitry Andric authored
      After b18cb9c4, clang would sometimes prefer the host C++ includes
      (e.g. in /usr/include/c++/v1) before those specified via --sysroot.
      While this behavior may be desirable on Linux, it is not so on FreeBSD,
      where we make extensive use of --sysroot during the build of the base
      system.  In that case, clang must *not* search outside the sysroot,
      except for its own internal headers.
      
      Add an override addLibCxxIncludePaths() to restore the old behavior,
      which is to simply append /usr/include/c++/v1 to the specified sysroot.
      While here, apply clang-format to the FreeBSD specific toolchain files.
      
      Fixes PR44923.
      62654cab
    • Greg Clayton's avatar
      [NFC] Move ValidTextRanges out of DwarfTransformer and into GsymCreator and... · 5e13e0ce
      Greg Clayton authored
      [NFC] Move ValidTextRanges out of DwarfTransformer and into GsymCreator and unify address is not in GSYM errors so all strings match.
      5e13e0ce
    • Johannes Doerfert's avatar
    • Eric Fiselier's avatar
      [libc++] Move abs and div into stdlib.h to fix header cycle. · 82b47b29
      Eric Fiselier authored
      libc++ is careful to not fracture overload sets. When one overload
      is visible to a user, all of them should be. Anything less causes
      subtle bugs and ODR violations.
      
      Previously, in order to support ::abs and ::div being supplied by
      both <cmath> and <cstdlib> we had to do awful things that make
      <math.h> and <stdlib.h> have header cycles and be non-modular.
      This really breaks with modules.
      
      Specifically the problem was that in C++ ::abs introduces overloads
      for floating point numbers, these overloads forward to ::fabs,
      which are defined in math.h. Therefore ::abs needed to be in math.h
      too. But this required stdlib.h to include math.h and math.h to
      include stdlib.h.
      
      To avoid these problems the definitions have been moved to stddef.h
      (which math includes), and the floating point overloads of ::abs
      have been changed to call __builtin_fabs, which both Clang and GCC
      support.
      82b47b29
    • Eric Fiselier's avatar