1. Jan 19, 2021
    • Faris Rehman's avatar
      [flang][driver] Add support for `-I` in the new driver · 87dfd5e0
      Faris Rehman authored
      Add support for option -I in the new Flang driver. This will allow for
      included headers and module files in other directories, as the default
      search path is currently the working folder. The behaviour of this is
      consistent with the current f18 driver, where the current folder (i.e.
      ".") has the highest priority followed by the order of '-I's taking
      priority from first to last.
      
      Summary of changes:
      - Add SearchDirectoriesFromDashI to PreprocessorOptions, to be forwarded
        into the parser's searchDirectories
      - Add header files and non-functional module files to be used in
        regression tests. The module files are just text files and are used to
        demonstrated that paths specified with `-I` are taken into account when
        searching for .mod files.
      
      Differential Revision: https://reviews.llvm.org/D93453
      87dfd5e0
    • Alexander Belyaev's avatar
    • Simon Pilgrim's avatar
      [X86][SSE] combineVectorSignBitsTruncation - fold trunc(srl(x,c)) -> packss(sra(x,c)) · 5626adcd
      Simon Pilgrim authored
      If a srl doesn't introduce any sign bits into the truncated result, then replace with a sra to let us use a PACKSS truncation - fixes a regression noticed in D56387 on pre-SSE41 targets that don't have PACKUSDW.
      5626adcd
    • Hans Wennborg's avatar
      Revert 5238e7b3 "[InstCombine] Replace one-use select operand based on condition" · 58bdfcfa
      Hans Wennborg authored
      This caused a miscompile in Chromium, see comments on the codereview for
      discussion and pointer to a reproducer.
      
      > InstCombine already performs a fold where X == Y ? f(X) : Z is
      > transformed to X == Y ? f(Y) : Z if f(Y) simplifies. However,
      > if f(X) only has one use, then we can always directly replace the
      > use inside the instruction. To actually be profitable, limit it to
      > the case where Y is a non-expr constant.
      >
      > This could be further extended to replace uses further up a one-use
      > instruction chain, but for now this only looks one level up.
      >
      > Among other things, this also subsumes D94860.
      >
      > Differential Revision: https://reviews.llvm.org/D94862
      
      This also reverts the follow-up
      a003f265:
      
      > [llvm] Prevent infinite loop in InstCombine of select statements
      >
      > This fixes an issue where the RHS and LHS the comparison operation
      > creating the predicate were swapped back and forth forever.
      >
      > Differential Revision: https://reviews.llvm.org/D94934
      58bdfcfa
    • Jay Foad's avatar
      [AMDGPU] Simplify AMDGPUInstPrinter::printExpSrcN. NFC. · 49dce855
      Jay Foad authored
      Change-Id: Idd7f47647bc0faa3ad6f61f44728c0f20540ec00
      49dce855
    • Florian Hahn's avatar
      [LoopRotate] Add PrepareForLTO stage, avoid rotating with inline cands. · 83daa497
      Florian Hahn authored
      D84108 exposed a bad interaction between inlining and loop-rotation
      during regular LTO, which is causing notable regressions in at least
      CINT2006/473.astar.
      
      The problem boils down to: we now rotate a loop just before the vectorizer
      which requires duplicating a function call in the preheader when compiling
      the individual files ('prepare for LTO'). But this then prevents further
      inlining of the function during LTO.
      
      This patch tries to resolve this issue by making LoopRotate more
      conservative with respect to rotating loops that have inline-able calls
      during the 'prepare for LTO' stage.
      
      I think this change intuitively improves the current situation in
      general. Loop-rotate tries hard to avoid creating headers that are 'too
      big'. At the moment, it assumes all inlining already happened and the
      cost of duplicating a call is equal to just doing the call. But with LTO,
      inlining also happens during full LTO and it is possible that a previously
      duplicated call is actually a huge function which gets inlined
      during LTO.
      
      From the perspective of LV, not much should change overall. Most loops
      calling user-provided functions won't get vectorized to start with
      (unless we can infer that the function does not touch memory, has no
      other side effects). If we do not inline the 'inline-able' call during
      the LTO stage, we merely delayed loop-rotation & vectorization. If we
      inline during LTO, chances should be very high that the inlined code is
      itself vectorizable or the user call was not vectorizable to start with.
      
      There could of course be scenarios where we inline a sufficiently large
      function with code not profitable to vectorize, which would have be
      vectorized earlier (by scalarzing the call). But even in that case,
      there probably is no big performance impact, because it should be mostly
      down to the cost-model to reject vectorization in that case. And then
      the version with scalarized calls should also not be beneficial. In a way,
      LV should have strictly more information after inlining and make more
      accurate decisions (barring cost-model issues).
      
      There is of course plenty of room for things to go wrong unexpectedly,
      so we need to keep a close look at actual performance and address any
      follow-up issues.
      
      I took a look at the impact on statistics for
      MultiSource/SPEC2000/SPEC2006. There are a few benchmarks with fewer
      loops rotated, but no change to the number of loops vectorized.
      
      Reviewed By: sanwou01
      
      Differential Revision: https://reviews.llvm.org/D94232
      83daa497
    • Muhammad Omair Javaid's avatar
      [LLDB] Test SVE dynamic resize with multiple threads · 4d308133
      Muhammad Omair Javaid authored
      This patch adds a new test case which depends on AArch64 SVE support and
      dynamic resize capability enabled. It created two seperate threads which
      have different values of sve registers and SVE vector granule at various
      points during execution.
      
      We test that LLDB is doing the size and offset updates properly for all
      of the threads including the main thread and when we VG is updated using
      prctl call or by 'register write vg' command the appropriate changes are
      also update in register infos.
      
      Reviewed By: labath
      
      Differential Revision: https://reviews.llvm.org/D82866
      4d308133
    • Muhammad Omair Javaid's avatar
      [LLDB] Add support to resize SVE registers at run-time · e448ad78
      Muhammad Omair Javaid authored
      This patch builds on previously submitted SVE patches regarding expedited
      register set and per thread register infos. (D82853 D82855 and D82857)
      
      We need to resize SVE register based on value received in expedited list.
      Also we need to resize SVE registers when we write vg register using
      register write vg command. The resize will result in a updated offset
      for all of fpr and sve register set. This offset will be configured
      in native register context by RegisterInfoInterface and will also be
      be updated on client side in GDBRemoteRegisterContext.
      
      A follow up patch will provide a API test to verify this change.
      
      Reviewed By: labath
      
      Differential Revision: https://reviews.llvm.org/D82863
      e448ad78
    • Pavel Labath's avatar
      [lldb] Re-enable TestPlatformProcessConnect on macos · 079e6646
      Pavel Labath authored
      The test couldn't find lldb-server as it's path was being overridden by
      LLDB_DEBUGSERVER_PATH environment variable (pointing to debugserver).
      This test should always use lldb-server, as it tests its platform
      capabilities.
      
      There's no need for the environment override, as lldb-server tests
      should test the executable they just built, so I just remote the
      override capability.
      079e6646
    • Yvan Roux's avatar
      [ARM][MachineOutliner] Add stack fixup feature · 244ad228
      Yvan Roux authored
      This patch handles cases where we have to save/restore the link register
      into the stack and and load/store instruction which use the stack are
      part of the outlined region. It checks that there will be no overflow
      introduced by the new offset and fixup these instructions accordingly.
      
      Differential Revision: https://reviews.llvm.org/D92934
      244ad228
    • David Spickett's avatar
      [lldb] Fix crash in "help memory read" · 9a7672ac
      David Spickett authored
      When a command option does not have a short version
      (e.g. -f for --file), we use an arbitrary value in the
      short_option field to mark it as invalid.
      (though this value is unqiue to be used later for other
      things)
      
      We check that this short option is valid to print using
      llvm::isPrint. This implicitly casts our int to char,
      meaning we check the last char of any short_option value.
      
      Since the arbitrary value we chose for these options is
      some shortened hex version of the name, this returned true
      even for invalid values.
      
      Since llvm::isPrint returns true we later call std::islower
      and/or std::isupper on the short_option value. (the int)
      
      Calling these functions with something that cannot be validly
      converted to unsigned char is undefined. Somehow we got/get
      away with this but for me compiling with g++-9 I got a crash
      for "help memory read".
      
      The other command that uses this is "target variable" but that
      didn't crash for unknown reasons.
      
      Checking that short_option can fit into an unsigned char before
      we call llvm::isPrint means we will not attempt to call islower/upper
      on these options since we have no reason to print them.
      
      This also fixes bogus short options being shown for "memory read"
      and target variable.
      
      For "target variable", before:
             -e <filename> ( --file <filename> )
             -b <filename> ( --shlib <filename> )
      After:
             --file <filename>
             --shlib <filename>
      
      (note that the bogus short options are just the bottom byte of our
      arbitrary short_option value)
      
      Reviewed By: labath
      
      Differential Revision: https://reviews.llvm.org/D94917
      9a7672ac
    • Fraser Cormack's avatar
      [RISCV] Add scalable-vector integer extension patterns · c81ea942
      Fraser Cormack authored
      Reviewed By: craig.topper
      
      Differential Revision: https://reviews.llvm.org/D94694
      c81ea942
    • Tres Popp's avatar
      [llvm] Prevent infinite loop in InstCombine of select statements · a003f265
      Tres Popp authored
      This fixes an issue where the RHS and LHS the comparison operation
      creating the predicate were swapped back and forth forever.
      
      Differential Revision: https://reviews.llvm.org/D94934
      a003f265
    • serge-sans-paille's avatar
      [lit] Harmonize lit and llvm versionning · fb5b12e4
      serge-sans-paille authored
      In addition to consistency, we'll hit a wall when 11.1.0 gets released, because
      we cannot represent it with lit versioning scheme.
      
      Differential Revision: https://reviews.llvm.org/D94157
      fb5b12e4
    • Lang Hames's avatar
      [ORC] Move LookupRequest from OrcShared to Orc. · 95b63c7b
      Lang Hames authored
      It depends on Orc types (SymbolLookupSet), so can't be part of OrcShared.
      95b63c7b
    • Tres Popp's avatar
      [llvm][nvptx] add atomicity to counter in ISelLowering · 170199f5
      Tres Popp authored
      Previously uniqueCallSite could have race conditions between different
      threads. Now it is accessed with an atomic RMW and will be unique
      between different threads.
      
      Differential Revision: https://reviews.llvm.org/D94784
      170199f5
    • David Sherwood's avatar
      [NFC] Make remaining cost functions in LoopVectorize.cpp use InstructionCost · c3ce2627
      David Sherwood authored
      A previous patch has already changed getInstructionCost to return
      an InstructionCost type. This patch changes the other various
      getXXXCost functions to return an InstructionCost too. This is a
      non-functional change - I've added a few asserts that the costs
      are valid in places where we're selecting between vector call
      and intrinsic costs. However, since we don't yet return invalid
      costs from any of the TTI implementations these asserts should
      not fire.
      
      See this patch for the introduction of the type: https://reviews.llvm.org/D91174
      See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
      
      Differential Revision: https://reviews.llvm.org/D94065
      c3ce2627
    • Luo, Yuanke's avatar
      [X86][AMX] Fix the typo. · 7e1d2224
      Luo, Yuanke authored
      The dpbsud should be dpbssd.
      
      Differential Revision: https://reviews.llvm.org/D94943
      7e1d2224
    • Jan Svoboda's avatar
      [clang][cli] Parse Lang and CodeGen options separately · 39a2a233
      Jan Svoboda authored
      This patch moves the parsing of `{Lang,CodeGen}Options` from `parseSimpleArgs` to the original `Parse{Lang,CodeGen}Args` functions.
      
      This ensures all marshalled `LangOptions` are being parsed **after** the call `setLangDefaults`, which in turn enables us to marshall `LangOptions` that somehow depend on the defaults. (In a future patch.)
      
      Now, `CodeGenOptions` need to be parsed **after** `LangOptions`, because `-cl-mad-enable` (a `CodeGenOpt`) depends on the value of `-cl-fast-relaxed-math` and `-cl-unsafe-math-optimizations` (`LangOpts`).
      
      Unfortunately, this removes the nice property that marshalled options get parsed in the exact order they appear in the `.td` file. Now we cannot be sure that a TableGen record referenced in `ImpliedByAnyOf` has already been parsed. This might cause an ordering issues (i.e. reading value of uninitialized variable). I plan to mitigate this by moving each `XxxOpt` group from `parseSimpleArgs` back to their original parsing function. With this setup, if an option from group `A` references option from group `B` in TableGen, the compiler will require us to make the `CompilerInvocation` member for `B` visible in the parsing function for `A`. That's where we notice that `B` didn't get parsed yet.
      
      Reviewed By: Bigcheese
      
      Differential Revision: https://reviews.llvm.org/D94682
      39a2a233
    • Andy Wingo's avatar
      [WebAssembly] Change prefix on data segment flags to WASM_DATA_SEGMENT · 831a143e
      Andy Wingo authored
      Element sections will also need flags, so we shouldn't squat the
      WASM_SEGMENT namespace.
      
      Depends on D90948.
      
      Differential Revision: https://reviews.llvm.org/D92315
      831a143e
    • Andy Wingo's avatar
      [WebAssembly] call_indirect issues table number relocs · 418df4a6
      Andy Wingo authored
      This patch changes to make call_indirect explicitly refer to the
      corresponding function table, residualizing TABLE_NUMBER relocs against
      it.
      
      With this change, wasm-ld now sees all references to tables, and can
      link multiple tables.
      
      Differential Revision: https://reviews.llvm.org/D90948
      418df4a6
    • Timm Bäder's avatar
      [clang][driver][NFC][obvious] Remove obsolete unistd.h include · b86e7ae6
      Timm Bäder authored
      getuid() is not being called in this file anymore.
      b86e7ae6
    • Guillaume Chatelet's avatar
      [libc][NFC] remove dependency on non standard ssize_t · e517dff5
      Guillaume Chatelet authored
      `ssize_t` is from POSIX and is not standard unfortunately.
      Rewritting the code so it doesn't depend on it.
      
      Differential Revision: https://reviews.llvm.org/D94760
      e517dff5
    • Guillaume Chatelet's avatar
      [libc][NFC] Remove dead code · d4bb3ef5
      Guillaume Chatelet authored
      d4bb3ef5
    • Marek Kurdej's avatar
      [libc++] [P0935] [C++20] Eradicating unnecessarily explicit default... · a11f8b1a
      Marek Kurdej authored
      [libc++] [P0935] [C++20] Eradicating unnecessarily explicit default constructors from the standard library.
      
      http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0935r0.html
      
      Reviewed By: ldionne, #libc
      
      Differential Revision: https://reviews.llvm.org/D91292
      a11f8b1a
    • ShihPo Hung's avatar
      [RISCV] Add intrinsics for vector AMO operations · 9cf511aa
      ShihPo Hung authored
      Add vamoswap, vamoadd, vamoxor, vamoand, vamoor,
          vamomin, vamomax, vamominu, vamomaxu intrinsics.
      
      Reviewed By: craig.topper, khchen
      
      Differential Revision: https://reviews.llvm.org/D94589
      9cf511aa
    • Yang Fan's avatar
      [NFC][AIX][XCOFF] Fix compile warning on strncpy · 9a0900dc
      Yang Fan authored
      GCC warning:
      ```
      In file included from /usr/include/string.h:495,
                       from /usr/include/c++/9/cstring:42,
                       from /llvm-project/llvm/include/llvm/ADT/Hashing.h:53,
                       from /llvm-project/llvm/include/llvm/ADT/ArrayRef.h:12,
                       from /llvm-project/llvm/include/llvm/MC/MCAsmBackend.h:12,
                       from /llvm-project/llvm/lib/MC/XCOFFObjectWriter.cpp:14:
      In function ‘char* strncpy(char*, const char*, size_t)’,
          inlined from ‘{anonymous}::Section::Section(const char*, llvm::XCOFF::SectionTypeFlags, bool, {anonymous}::CsectGroups)’ at /llvm-project/llvm/lib/MC/XCOFFObjectWriter.cpp:146:12:
      /usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:34: warning: ‘char* __builtin_strncpy(char*, const char*, long unsigned int)’ specified bound 8 equals destination size [-Wstringop-truncation]
        106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
            |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
               ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ```
      
      Reviewed By: hubert.reinterpretcast
      
      Differential Revision: https://reviews.llvm.org/D94872
      9a0900dc
    • Siva Chandra's avatar
      [libc][NFC][Obvious] Add a missing dep. · ffb25497
      Siva Chandra authored
      ffb25497
    • Mehdi Amini's avatar
      Fix a few GCC compiler warnings (NFC) · 7dadcd02
      Mehdi Amini authored
      7dadcd02
    • Siva Chandra Reddy's avatar
    • Lang Hames's avatar
      [ORC] Move OrcError.h to include/llvm/ExecutionEngine/Orc/Shared. · 24672dde
      Lang Hames authored
      OrcShared is the correct home for this header since Orc was split in
      1d0676b5. (It should have been moved in that commit, but was overlooked).
      24672dde
    • Richard Smith's avatar
      [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. · 4b574008
      Richard Smith authored
      Previously committed as 9e08e51a, and
      reverted because a dependency commit was reverted. This incorporates the
      following follow-on commits that were also reverted:
      
      7e84aa1b by Simon Pilgrim
      ed13d8c6 by me
      95c7b6ca by Sam McCall
      430d5d84 by Dave Zarzycki
      4b574008
    • Richard Smith's avatar
      Following up on PR48517, fix handling of template arguments that refer · 5a391d38
      Richard Smith authored
      to dependent declarations.
      
      Treat an id-expression that names a local variable in a templated
      function as being instantiation-dependent.
      
      This addresses a language defect whereby a reference to a dependent
      declaration can be formed without any construct being value-dependent.
      Fixing that through value-dependence turns out to be problematic, so
      instead this patch takes the approach (proposed on the core reflector)
      of allowing the use of pointers or references to (but not values of)
      dependent declarations inside value-dependent expressions, and instead
      treating template arguments as dependent if they evaluate to a constant
      involving such dependent declarations.
      
      This ends up affecting a bunch of OpenMP tests, due to OpenMP
      imprecisely handling instantiation-dependent constructs, bailing out
      early instead of processing dependent constructs to the extent possible
      when handling the template.
      
      Previously committed as 8c1f2d15, and
      reverted because a dependency commit was reverted.
      5a391d38
    • Richard Smith's avatar
      PR24076, PR33655, C++ CWG 1558: Consider the instantiation-dependence of · fbb83f18
      Richard Smith authored
      the nested-name-specifier when determining whether a qualified type is
      instantiation-dependent.
      
      Previously reverted in 25a02c3d due to
      causing us to reject some code. It turns out that the rejected code was
      ill-formed (no diagnostic required).
      fbb83f18
    • Richard Smith's avatar
      DR2064: decltype(E) is only a dependent type if E is type-dependent, not · e3065ce2
      Richard Smith authored
      if E is merely instantiation-dependent.
      
      Previously reverted in 34e72a14;
      re-committed with a fix to an issue that caused name mangling to assert.
      e3065ce2
    • Luo, Yuanke's avatar
      [X86][AMX] Clear AMX lit test case. · e147ecca
      Luo, Yuanke authored
      Add nounwind attribute to avoid generating cfi instructions. Also make
      global buffer 64 bytes align in lit test case.
      
      Differential Revision: https://reviews.llvm.org/D94910
      e147ecca
    • Nemanja Ivanovic's avatar
      [PowerPC] Sign extend comparison operand for signed atomic comparisons · 61f69153
      Nemanja Ivanovic authored
      As of 8dacca94, we sign extend the atomic loaded
      operand for signed subword comparisons. However, the assumption that the other
      operand is correctly sign extended doesn't always hold. This patch sign extends
      the other operand if it needs to be sign extended.
      
      This is a second fix for https://bugs.llvm.org/show_bug.cgi?id=30451
      
      Differential revision: https://reviews.llvm.org/D94058
      61f69153
    • Richard Smith's avatar
      PR48763: Better handling for classes that inherit a default constructor. · bc713f6a
      Richard Smith authored
      The C++ standard wording doesn't appear to properly handle the case
      where a class inherits a default constructor from a base class. Various
      properties of classes are defined in terms of the corresponding property
      of the default constructor, and in this case, the class does not have a
      default constructor despite being default-constructible, which the
      wording doesn't handle properly.
      
      This change implements a tentative fix for these problems, which has
      also been proposed to the C++ committee: if a class would inherit a
      default constructor, and does not explicitly declare one, then one is
      implicitly declared.
      bc713f6a
    • Luo, Yuanke's avatar
      [X86] Fix tile spill merge issue. · c535a7fd
      Luo, Yuanke authored
      This is a additional bug fix for c5be0e0c. The distance for
      the spill instructions is wrong in previous patch.
      
      Differential Revision: https://reviews.llvm.org/D94772
      c535a7fd
    • Chen Zheng's avatar
      Revert "[NFC] [TargetRegisterInfo] add one use check to lookThruCopyLike." · a9b3303a
      Chen Zheng authored
      This reverts commit 3bdf4507.
      
      Post commit comments need to be addressed first.
      a9b3303a