1. Mar 03, 2021
    • Qiu Chaofan's avatar
      [PowerPC] Allow spilling GPR to VSR on AIX · 72d4a41b
      Qiu Chaofan authored
      This patch enables spilling GPR to VSRs instead of stack under AIX ABI.
      
      Reviewed By: nemanjai
      
      Differential Revision: https://reviews.llvm.org/D97367
      72d4a41b
    • Craig Topper's avatar
      [LegalizeVectorTypes] Improve SplitVecRes_INSERT_SUBVECTOR to handle subvector... · 543b901e
      Craig Topper authored
      [LegalizeVectorTypes] Improve SplitVecRes_INSERT_SUBVECTOR to handle subvector being in the high half of the split or not at element 0 of the low half.
      
      This function isn't exercised in lit tests today today according to
      the code coverage report. But will be after the tests in D97543 and
      D97559.
      
      Posting this patch to help a crash that Fraser hit.
      
      Reviewed By: frasercrmck
      
      Differential Revision: https://reviews.llvm.org/D97582
      543b901e
    • Jianzhou Zhao's avatar
      Fix the build error caused by D97570 · ac4c1760
      Jianzhou Zhao authored
      ac4c1760
    • Jianzhou Zhao's avatar
      [dfsan] Propagate origin tracking at load · d866b9c9
      Jianzhou Zhao authored
      This is a part of https://reviews.llvm.org/D95835.
      
      One issue is about origin load optimization: see the
      comments of useCallbackLoadLabelAndOrigin
      
      @gbalats This change may have some conflicts with your 8bit change. PTAL the change at visitLoad.
      
      Reviewed By: morehouse, gbalats
      
      Differential Revision: https://reviews.llvm.org/D97570
      d866b9c9
    • Nathan James's avatar
      [clang][NFC] pack StaticDiagInfoRec · 335375ef
      Nathan James authored
      Exchanging types, reordering fields and borrowing a bit from OptionGroupIndex shrinks this from 12 bytes to 8.
      This knocks ~20k from the binary size.
      
      Reviewed By: aaron.ballman
      
      Differential Revision: https://reviews.llvm.org/D97553
      335375ef
    • Nathan James's avatar
      [clang-tidy][NFC] Use equalsBoundNode matchers to simplify LoopConvertCheck · 1a91b823
      Nathan James authored
      Make use of the `equalsBoundNode` matcher to ensure Init, Conditon and Increment variables all refer to the same variable during matching.
      
      Reviewed By: steveire
      
      Differential Revision: https://reviews.llvm.org/D97639
      1a91b823
    • Wang, Pengfei's avatar
      [NFC] Add x86_amx and some missed half, bfloat keywords to llvm plugin syntaxes · fd79aa72
      Wang, Pengfei authored
      Reviewed By: LuoYuanke
      
      Differential Revision: https://reviews.llvm.org/D97444
      fd79aa72
    • George Balatsouras's avatar
      [dfsan] Fix clang-tidy warnings · 6ff18b08
      George Balatsouras authored
      This addresses ~50 clang-tidy warnings on dfsan instrumentation pass.
      It also contains some refactoring (all non-functional changes) to eliminate some variables and simplify code.
      
      Reviewed By: stephan.yichao.zhao
      
      Differential Revision: https://reviews.llvm.org/D97714
      6ff18b08
    • Felix Berger's avatar
      [clang-tidy] performance-for-range-copy: Don't trigger on implicit type conversions. · a189b3b9
      Felix Berger authored
      This disables the check for false positive cases where implicit type conversion
      through either an implicit single argument constructor or a member conversion
      operator is triggered when constructing the loop variable.
      
      Fix the test cases that meant to cover these cases.
      
      Differential Revision: https://reviews.llvm.org/D97577
      
      Reviewed-by: hokein
      a189b3b9
    • Petr Hosek's avatar
      Revert "[runtimes] Use standalone build only for compiler-rt" · b3ac90da
      Petr Hosek authored
      This reverts commit 4e421b23 as this
      seemed to have broke Python 3 executable detection on some builders.
      b3ac90da
    • Petr Hosek's avatar
      [CMake] Enable Polly for Fuchsia toolchain build · 1d1983f2
      Petr Hosek authored
      We want to enable the use of Polly in Fuchsia.
      
      Differential Revision: https://reviews.llvm.org/D97819
      1d1983f2
    • Jonas Devlieghere's avatar
    • Jonas Devlieghere's avatar
    • Victor Huang's avatar
      [AIX][TLS] Generate TLS variables in assembly files · 1756b2ad
      Victor Huang authored
      This patch allows generating TLS variables in assembly files on AIX.
      Initialized and external uninitialized variables are generated with the
      .csect pseudo-op and local uninitialized variables are generated with
      the .comm/.lcomm pseudo-ops. The patch also adds a check to
      explicitly say that TLS is not yet supported on AIX.
      
      Reviewed by: daltenty, jasonliu, lei, nemanjai, sfertile
      Originally patched by: bsaleil
      Commandeered by: NeHuang
      
      Differential Revision: https://reviews.llvm.org/D96184
      1756b2ad
    • Petr Hosek's avatar
      [runtimes] Use standalone build only for compiler-rt · 4e421b23
      Petr Hosek authored
      compiler-rt needs to use standalone build because of the assumptions
      made by its build, but other runtimes can use non-standalone build.
      
      Differential Revision: https://reviews.llvm.org/D97575
      4e421b23
    • zoecarver's avatar
      [libc++] Add bind_front function (P0356R5). · 84a50f59
      zoecarver authored
      Implementes [[ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0356r5.html | P0356R5 ]]. Adds `bind_front` to `functional`.
      
      Reviewed By: ldionne, #libc, Quuxplusone
      
      Differential Revision: https://reviews.llvm.org/D60368
      84a50f59
    • Jonas Devlieghere's avatar
      [lldb] Extend Python convenience variable table with equivalent APIs · f46a441b
      Jonas Devlieghere authored
      Add a column to the table of convenience variables with the equivalent
      API to get to the current debugger, target, process, etc.
      
      We often get asked to make convenience variables available outside of
      the interactive interpreter. After explaining why that's not possible, a
      common complaint is that it's hard to find out how to get to these
      variables in a non-interactive context, for example how to get to the
      current frame when given a thread. This patch aims to alleviate that by
      including the APIs to navigate between these instances in the table.
      
      Differential revision: https://reviews.llvm.org/D97778
      f46a441b
    • Neal (nealsid)'s avatar
      Migrate to llvm::unique_function instead of static member functions for callbacks · 5826aa48
      Neal (nealsid) authored
      A few cleanups suggested in another patch review's comments:
      
      1. Use llvm:unique_function for storing & invoking callbacks from
         Editline to IOHandler
      2. Change return type of one of the callback setters from bool to void,
         since it's return value was never used
      3. Moved the callback setters inline & made them nonstatic, since that's
         more consistent with other setter definitions
      4. Removed the baton parameter since we no longer need it anymore
      
      Differential revision: https://reviews.llvm.org/D50299
      5826aa48
    • Arthur Eubanks's avatar
      [opt] Error if -debug-pass is specified alongside the new PM · 99f1e86c
      Arthur Eubanks authored
      Reviewed By: ychen
      
      Differential Revision: https://reviews.llvm.org/D97810
      99f1e86c
    • Andrei Elovikov's avatar
      [NFCI][VPlan] Modify Recipes' print methods to honor Indent parameter · b24afec8
      Andrei Elovikov authored
      Reviewed By: fhahn
      
      Differential Revision: https://reviews.llvm.org/D97787
      b24afec8
    • Fangrui Song's avatar
      [test] Fix CodeGen/VE/Scalar tests · 1e46b6f4
      Fangrui Song authored
      1e46b6f4
    • Aart Bik's avatar
      [mlir][sparse] do not ignore ordering for "dense" tensor linked with sparse type · 5b333d34
      Aart Bik authored
      Reviewed By: bixia
      
      Differential Revision: https://reviews.llvm.org/D97795
      5b333d34
    • Peter Steinfeld's avatar
      [flang] Detect circularly defined interfaces of procedures · 16005fd9
      Peter Steinfeld authored
      It's possible to define a procedure whose interface depends on a procedure
      which has an interface that depends on the original procedure.  Such a circular
      definition was causing the compiler to fall into an infinite loop when
      resolving the name of the second procedure.  It's also possible to create
      circular dependency chains of more than two procedures.
      
      I fixed this by adding the function HasCycle() to the class DeclarationVisitor
      and calling it from DeclareProcEntity() to detect procedures with such
      circularly defined interfaces.  I marked the associated symbols of such
      procedures by calling SetError() on them.  When processing subsequent
      procedures, I called HasError() before attempting to analyze their interfaces.
      Unfortunately, this did not work.
      
      With help from Tim, we determined that the SymbolSet used to track the
      erroneous symbols was instantiated using a "<" operator which was defined using
      the location of the name of the procedure.  But the location of the procedure
      name was being changed by a call to ReplaceName() between the times that the
      calls to SetError() and HasError() were made.  This caused HasError() to
      incorrectly report that a symbol was not in the set of erroneous symbols.
      
      I fixed this by changing SymbolSet to be an unordered set that uses the
      contents of the name of the symbol as the basis for its hash function.  This
      works because the contents of the name of the symbol is preserved by
      ReplaceName() even though its location changes.
      
      I also fixed the error message used when reporting recursively defined
      dummy procedure arguments by removing extra apostrophes and sorting the
      list of symbols.
      
      I also added tests that will crash the compiler without this change.
      
      Note that the "<" operator is used in other contexts, for example, in the map
      of characterized procedures, maps of items in equivalence sets, maps of
      structure constructor values, ...  All of these situations happen after name
      resolution has been completed and all calls to ReplaceName() have already
      happened and thus are not subject to the problem I ran into when ReplaceName()
      was called when processing procedure entities.
      
      Note also that the implementation of the "<" operator uses the relative
      location in the cooked character stream as the basis of its implementation.
      This is potentially problematic when symbols from diffent compilation units
      (for example symbols originating in .mod files) are put into the same map since
      their names will appear in two different source streams which may not be
      allocated in the same relative positions in memory.  But I was unable to create
      a test that caused a problem.  Using a direct comparison of the content of the
      name of the symbol in the "<" operator has problems.  Symbols in enclosing or
      parallel scopes can have the same name.  Also using the location of the symbol
      in the cooked character stream has the advantage that it preserves the the
      order of the symbols in a structure constructor constant, which makes matching
      the values with the symbols relatively easy.
      
      This patch supersedes D97749.
      
      Differential Revision: https://reviews.llvm.org/D97774
      16005fd9
    • Nico Weber's avatar
      hack to unbreak check-llvm on win after https://reviews.llvm.org/D97335 · 900f0761
      Nico Weber authored
      fix attempt http://reviews.llvm.org/rGbbdb4c8c9bcef0e didn't work
      
      The problem is that the test tries to look up
      llvm_orc_registerJITLoaderGDBWrapper from the llvm-jitlink.exe
      executable, but the symbol wasn't exported. Just manually export it
      for now. There's a FIXME with a suggestion for a real fix.
      900f0761
    • Kamlesh Kumar's avatar
      [libunwind] [risc-v] This patch is for fixing · 5c3fc509
      Kamlesh Kumar authored
      immediate build failure when Cross Unwinding enabled.
      Follow up patch will cleanup some Macros handling.
      
      Differential Revision: https://reviews.llvm.org/D97762
      5c3fc509
    • Hansang Bae's avatar
      [OpenMP] Add allocator support for target memory · b6c2f538
      Hansang Bae authored
      This is a preview of allocator support for target memory that depends on the
      offload runtime API which allocates memory as described below.
      
      llvm_omp_target_alloc_host(size_t size, int device_num);
      -- Returns non-migratable memory owned by host.
      -- Memory is accessible by host and device(s).
      
      llvm_omp_target_alloc_shared(size_t size, int device_num);
      -- Returns migratable memory owned by host and device.
      -- Memory is accessible by host and device.
      
      llvm_omp_target_alloc_device(size_t size, int device_num);
      -- Returns memory owned by device.
      -- Memory is only accessible by device.
      
      New memory space and predefined allocator names are
      -- llvm_omp_target_host_mem_space
      -- llvm_omp_target_shared_mem_space
      -- llvm_omp_target_device_mem_space
      -- llvm_omp_target_host_mem_alloc
      -- llvm_omp_target_shared_mem_alloc
      -- llvm_omp_target_device_mem_alloc
      
      Differential Revision: https://reviews.llvm.org/D96669
      b6c2f538
    • Christopher Di Bella's avatar
      [libcxx] adds common_reference to <type_traits> · eadece33
      Christopher Di Bella authored
      Implements part of P0898R3 Standard Library Concepts
      
      Reworks D74351 to use requires-clauses over SFINAE and so that it more
      closely follows the wording.
      
      Co-authored by: Michael Schellenberger Costa <mschellenbergercosta@googlemail.com>
      
      (Michael did all the heavy lifting and I came in to polish it for
       submission, since Michael is focussing on `std::format` now.)
      
      Reviewed By: ldionne, #libc
      
      Differential Revision: https://reviews.llvm.org/D96657
      eadece33
    • Matt Arsenault's avatar
      GlobalISel: Merge and cleanup more AMDGPU call lowering code · fd82cbcf
      Matt Arsenault authored
      This merges more AMDGPU ABI lowering code into the generic call
      lowering. Start cleaning up by factoring away more of the pack/unpack
      logic into the buildCopy{To|From}Parts functions. These could use more
      improvement, and the SelectionDAG versions are significantly more
      complex, and we'll eventually have to emulate all of those cases too.
      
      This is mostly NFC, but does result in some minor instruction
      reordering. It also removes some of the limitations with mismatched
      sizes the old code had. However, similarly to the merge on the input,
      this is forcing gfx6/gfx7 to use the gfx8+ ABI (which is what we
      actually want, but SelectionDAG is stuck using the weird emergent
      ABI).
      
      This also changes the load/store size for stack passed EVTs for
      AArch64, which makes it consistent with the DAG behavior.
      fd82cbcf
    • Adrian Prantl's avatar
      Promote scalars to load addresses when dereferencing them. · 14ccba26
      Adrian Prantl authored
      This is a follow-up to 188b0747. This
      is a very narrow fix to a more general problem. LLDB should be better
      at distinguishing between implict and memory location descriptions.
      
      rdar://74902042
      14ccba26
    • Nikita Popov's avatar
      [AST] Remove unused Loop member (NFC) · 29034f38
      Nikita Popov authored
      To fix some build bots after D89264.
      29034f38
    • Sam McCall's avatar
      [clangd] Move DraftStore from ClangdLSPServer into ClangdServer. · bca3e241
      Sam McCall authored
      ClangdServer already gets notified of every change, so it makes sense for it to
      be the source of truth.
      This is a step towards having ClangdServer expose a FS that includes dirty
      buffers: D94554
      
      Related changes:
       - version is now optional for ClangdServer, to preserve our existing fuzziness
         in this area (missing version ==> autoincrement)
       - ClangdServer::format{File,Range} are now more regular ClangdServer functions
         that don't need the code passed in. While here, combine into one function.
       - incremental content update logic is moved from DraftStore to
         ClangdLSPServer, with most of the implementation in SourceCode.cpp.
         DraftStore is now fairly trivial, and will probably ultimately be
         *replaced* by the dirty FS stuff.
      
      Differential Revision: https://reviews.llvm.org/D97738
      bca3e241
    • Nathan James's avatar
      [cte][NFC] Remove all references to stdlib stream headers. · 00c7d669
      Nathan James authored
      Inclusion of iostream is frobidden and using other stream classes from standard library is discouraged as per https://llvm.org/docs/CodingStandards.html#include-iostream-is-forbidden
      
      Reviewed By: sammccall
      
      Differential Revision: https://reviews.llvm.org/D97771
      00c7d669
    • Markus Böck's avatar
      [PR48898][CMake] Support MinGW Toolchain tool sin llvm_ExternalProject_Add · a7cad668
      Markus Böck authored
      Windows is in the unique position of having two drivers, clang-cl and normal GNU clang, depending on whether a GNU or MSVC target is used. The current implementation with the USE_TOOLCHAIN argument assumes that when CMAKE_SYSTEM_NAME is set to Windows that clang-cl should be used, which is the incorrect choice when targeting a GNU environment.
      
      This patch solves this problem by adding an optional TARGET_TRIPLE argument to llvm_ExternalProject_Add, which sets the various CMAKE_<LANG>_COMPILER_TARGET variables. Additionally, if the triple is detected as an MSVC environment, clang-cl and similar MSVC specific tools will be used instead of the GNU tools.
      a7cad668
    • Heejin Ahn's avatar
      [WebAssembly] Fix more ExceptionInfo grouping bugs · 4a58116b
      Heejin Ahn authored
      This fixes two bugs in `WebAssemblyExceptionInfo` grouping, created by
      D97247. These two bugs are not easy to split into two different CLs,
      because tests that fail for one also tend to fail for the other.
      
      - In D97247, when fixing `ExceptionInfo` grouping by taking out
        the unwind destination' exception from the unwind src's exception, we
        just iterated the BBs in the function order, but this was incorrect;
        this changes it to dominator tree preorder. Please refer to the
        comments in the code for the reason and an example.
      
      - After this subexception-taking-out fix, there still can be remaining
        BBs we have to take out. When Exception B is taken out of Exception A
        (because EHPad B is the unwind destination of EHPad A), there can
        still be BBs within Exception A that are reachable from Exception B,
        which also should be taken out. Please refer to the comments in the
        code for more detailed explanation on why this can happen. To make
        this possible, this splits `WebAssemblyException::addBlock` into two
        parts: adding to a set and adding to a vector. We need to iterate on
        BBs within a `WebAssemblyException` to fix this, so we add BBs to sets
        first. But we add BBs to vectors later after we fix all incorrectness
        because deleting BBs from vectors is expensive. I considered removing
        the vector from `WebAssemblyException`, but it was not easy because
        this class has to maintain a similar interface with `MachineLoop` to
        be wrapped into a single interface `SortRegion`, which is used in
        CFGSort.
      
      Other misc. drive-by fixes:
      - Make `WebAssemblyExceptionInfo` do not even run when wasm EH is not
        used or the function doesn't have any EH pads, not to waste time
      - Add `LLVM_DEBUG` lines for easy debugging
      - Fix `preds` comments in cfg-stackify-eh.ll
      - Fix `__cxa_throw`'s signature in cfg-stackify-eh.ll
      
      Fixes https://github.com/emscripten-core/emscripten/issues/13554.
      
      Reviewed By: dschuff, tlively
      
      Differential Revision: https://reviews.llvm.org/D97677
      4a58116b
    • Stephen Kelly's avatar
      [clang-tidy] Simplify unused RAII check · 7b6fc9a1
      Stephen Kelly authored
      Fix handling of default construction where the constructor has a default arg.
      
      Differential Revision: https://reviews.llvm.org/D97142
      7b6fc9a1
    • Nikita Popov's avatar
      [LICM] Make promotion faster · 3d8f8427
      Nikita Popov authored
      Even when MemorySSA-based LICM is used, an AST is still populated
      for scalar promotion. As the AST has quadratic complexity, a lot
      of time is spent in this step despite the existing access count
      limit. This patch optimizes the identification of promotable stores.
      
      The idea here is pretty simple: We're only interested in must-alias
      mod sets of loop invariant pointers. As such, only populate the AST
      with loop-invariant loads and stores (anything else is definitely
      not promotable) and then discard any sets which alias with any of
      the remaining, definitely non-promotable accesses.
      
      If we promoted something, check whether this has made some other
      accesses loop invariant and thus possible promotion candidates.
      
      This is much faster in practice, because we need to perform AA
      queries for O(NumPromotable^2 + NumPromotable*NumNonPromotable)
      instead of O(NumTotal^2), and NumPromotable tends to be small.
      Additionally, promotable accesses have loop invariant pointers,
      for which AA is cheaper.
      
      This has a signicant positive compile-time impact. We save ~1.8%
      geomean on CTMark at O3, with 6% on lencod in particular and 25%
      on individual files.
      
      Conceptually, this change is NFC, but may not be so in practice,
      because the AST is only an approximation, and can produce
      different results depending on the order in which accesses are
      added. However, there is at least no impact on the number of promotions
      (licm.NumPromoted) in test-suite O3 configuration with this change.
      
      Differential Revision: https://reviews.llvm.org/D89264
      3d8f8427
    • Yonghong Song's avatar
      BPF: Fix a bug in peephole TRUNC elimination optimization · 51cdb780
      Yonghong Song authored
      Andrei Matei reported a llvm11 core dump for his bpf program
         https://bugs.llvm.org/show_bug.cgi?id=48578
      The core dump happens in LiveVariables analysis phase.
        #4 0x00007fce54356bb0 __restore_rt
        #5 0x00007fce4d51785e llvm::LiveVariables::HandleVirtRegUse(unsigned int,
            llvm::MachineBasicBlock*, llvm::MachineInstr&)
        #6 0x00007fce4d519abe llvm::LiveVariables::runOnInstr(llvm::MachineInstr&,
            llvm::SmallVectorImpl<unsigned int>&)
        #7 0x00007fce4d519ec6 llvm::LiveVariables::runOnBlock(llvm::MachineBasicBlock*, unsigned int)
        #8 0x00007fce4d51a4bf llvm::LiveVariables::runOnMachineFunction(llvm::MachineFunction&)
      The bug can be reproduced with llvm12 and latest trunk as well.
      
      Futher analysis shows that there is a bug in BPF peephole
      TRUNC elimination optimization, which tries to remove
      unnecessary TRUNC operations (a <<= 32; a >>= 32).
      Specifically, the compiler did wrong transformation for the
      following patterns:
         %1 = LDW ...
         %2 = SLL_ri %1, 32
         %3 = SRL_ri %2, 32
         ... %3 ...
         %4 = SRA_ri %2, 32
         ... %4 ...
      
      The current transformation did not check how many uses of %2
      and did transformation like
         %1 = LDW ...
         ... %1 ...
         %4 = SRL_ri %2, 32
         ... %4 ...
      and pseudo register %2 is used by not defined and
      caused LiveVariables analysis core dump.
      
      To fix the issue, when traversing back from SRL_ri to SLL_ri,
      check to ensure SLL_ri has only one use. Otherwise, don't
      do transformation.
      
      Differential Revision: https://reviews.llvm.org/D97792
      51cdb780
    • Thomas Preud'homme's avatar
      Add __builtin_isnan(__fp16) testcase · e77b5c40
      Thomas Preud'homme authored
      Reviewed By: rjmccall
      
      Differential Revision: https://reviews.llvm.org/D97777
      e77b5c40
    • Greg McGary's avatar
      [lld-macho] Rework length check when opening input files · 4af1522a
      Greg McGary authored
      This reverts diff D97610 (commit 0223ab03) and adds a one-line fix to verify that a `MemoryBufferRef` has sufficient length before reading a 4-byte magic number.
      
      Differential Revision: https://reviews.llvm.org/D97757
      4af1522a
    • Amara Emerson's avatar
      [AArch64][GlobalISel] Enable use of the optsize predicate in the selector. · 8a316045
      Amara Emerson authored
      To do this while supporting the existing functionality in SelectionDAG of using
      PGO info, we add the ProfileSummaryInfo and LazyBlockFrequencyInfo analysis
      dependencies to the instruction selector pass.
      
      Then, use the predicate to generate constant pool loads for f32 materialization,
      if we're targeting optsize/minsize.
      
      Differential Revision: https://reviews.llvm.org/D97732
      8a316045