1. Jan 14, 2021
    • Alexandre Ganea's avatar
      Revert "Fix llvm::Optional build breaks in MSVC using std::is_trivially_copyable" · 6abbba3f
      Alexandre Ganea authored
      This reverts commit 854f0984.
      
      This breaks compilation with clang-cl on Windows, while in a MSVC 16.8 cmd.exe.
      This also breaks PPC: http://lab.llvm.org:8011/#/builders/93/builds/1435
      And: https://reviews.llvm.org/D93510#2497737
      6abbba3f
    • Jan Svoboda's avatar
      [clang][cli] Port more CodeGenOptions to marshalling infrastructure · fa2fe960
      Jan Svoboda authored
      Leveraging the recently added TableGen constructs (ShouldParseIf and MarshallingInfoStringInt) to shift from manual command line parsing to automatic TableGen-driver marshalling.
      
      Reviewed By: dexonsmith
      
      Differential Revision: https://reviews.llvm.org/D94488
      fa2fe960
    • Jan Svoboda's avatar
      [clang][cli] NFC: Remove SSPBufferSize assignment · 3bccd87a
      Jan Svoboda authored
      This should've been part of D84669, but got overlooked. Removing the assignment is NFC, as it's also done by the marshalling infrastructure for the stack_protector_buffer_size option.
      
      Reviewed By: dexonsmith in D94488
      3bccd87a
    • Nigel Perks's avatar
    • Aleksandr Platonov's avatar
      [clangd] Add main file macros into the main-file index. · 2e25be0b
      Aleksandr Platonov authored
      This patch is a try to fix `WorkspaceSymbols.Macros` test after D93796.
      If a macro definition is in the preamble section, then it appears to be in the preamble (static) index and not in the main-file (dynamic) index.
      Thus, a such macro could not be found at a symbol search according to the logic that we skip symbols from the static index if the location of these symbols is inside the dynamic index files.
      To fix this behavior this patch adds main file macros into the main-file (dynamic) index.
      
      Reviewed By: sammccall
      
      Differential Revision: https://reviews.llvm.org/D94477
      2e25be0b
    • Simon Pilgrim's avatar
      [DAG] visitVECTOR_SHUFFLE - MergeInnerShuffle - reset shuffle ops and reorder... · 7c30c05f
      Simon Pilgrim authored
      [DAG] visitVECTOR_SHUFFLE - MergeInnerShuffle - reset shuffle ops and reorder early-out and second op matching. NFCI.
      
      I'm hoping to reuse MergeInnerShuffle in some other folds - so ensure the candidate ops/mask are reset at the start of each run.
      
      Also, move the second op matching before bailing to make it simpler to try to match other things afterward.
      7c30c05f
    • Pavel Labath's avatar
      [lldb/test] Ensure launched processes are ready to be attached · a997a1d7
      Pavel Labath authored
      Linux systems can be configured (and most of them are configured that
      way) to disable attaching to unrelated processes, /unless/ those
      processes explicitly allow that.
      
      Our test inferiors do that by explicitly calling prctl(PR_SET_PTRACER,
      PR_SET_PTRACER_ANY) (a.k.a., lldb_enable_attach). This requires
      additional synchronization to ensure that the test does not attempt
      attach before that statement is executed.
      
      This is working fine (albeit cumbersome) for most tests but
      TestGdbRemoteAttachWait is special in that it wants to start the
      inferior _after_ issuing the attach request. This means that the usual
      synchronization method does not work.
      
      This patch introduces a different solution -- enable attaching in the
      test harness, before the process is launched. Besides fixing this
      problem, this is also better because it avoids the need to add special
      code to each attach test (which is a common error).
      
      One gotcha here is that it won't work for remote test suites, as we
      don't control launching there. However, we could add a similar option to
      lldb-platform, or require that lldb-platform itself is started with
      attaching enabled. At that point we could delete all lldb_enable_attach
      logic.
      a997a1d7
    • Simon Pilgrim's avatar
      [X86] Improve sum-of-reductions v4f32 test coverage · 8f1d7f37
      Simon Pilgrim authored
      Ensure that the v4f32 reductions use a -0.0f start value and add fast-math test variant.
      8f1d7f37
    • Simon Pilgrim's avatar
      [DAG] visitVECTOR_SHUFFLE - pull out shuffle merging code into lambda helper. NFCI. · af8d27a7
      Simon Pilgrim authored
      Make it easier to reuse in a future patch.
      af8d27a7
    • Mikhail Maltsev's avatar
      [clang] Use SourceLocations in unions [NFCI] · 17f8c458
      Mikhail Maltsev authored
      Currently, there are many instances where `SourceLocation` objects are
      converted to raw representation to be stored in structs that are
      used as fields of tagged unions.
      
      This is done to make the corresponding structs trivial.
      Triviality allows avoiding undefined behavior when implicitly changing
      the active member of the union.
      
      However, in most cases, we can explicitly construct an active member
      using placement new. This patch adds the required active member
      selections and replaces `SourceLocation`-s represented as
      `unsigned int` with proper `SourceLocation`-s.
      
      One notable exception is `DeclarationNameLoc`: the objects of this class
      are often not properly initialized (so the code currently relies on
      its default constructor which uses memset). This class will be fixed
      in a separate patch.
      
      Reviewed By: dblaikie
      
      Differential Revision: https://reviews.llvm.org/D94237
      17f8c458
    • Bjorn Pettersson's avatar
      [SLP] Don't vectorize stores of non-packed types (like i1, i2) · d58512b2
      Bjorn Pettersson authored
      In the spirit of commit fc783e91 (llvm-svn: 248943) we
      shouldn't vectorize stores of non-packed types (i.e. types that
      has padding between consecutive variables in a scalar layout,
      but being packed in a vector layout).
      
      The problem was detected as a miscompile in a downstream test case.
      
      Reviewed By: anton-afanasyev
      
      Differential Revision: https://reviews.llvm.org/D94446
      d58512b2
    • Andy Wingo's avatar
      [lld][WebAssembly] Add support for handling table symbols · 53e3b81f
      Andy Wingo authored
      This commit adds table symbol support in a partial way, while still
      including some special cases for the __indirect_function_table symbol.
      No change in tests.
      
      Differential Revision: https://reviews.llvm.org/D94075
      53e3b81f
    • Florian Hahn's avatar
      [LTO] Expose opt() in LTOBackend (NFC). · 4bb11b3e
      Florian Hahn authored
      Exposing opt() which runs middle-end LTO optimzation allows re-using it
      in LTOCodeGenerator.
      
      Reviewed By: steven_wu
      
      Differential Revision: https://reviews.llvm.org/D94486
      4bb11b3e
    • Lucas Prates's avatar
      [AArch64] Adding ACLE intrinsics for the LS64 extension · 2b1e25be
      Lucas Prates authored
      This introduces the ARMv8.7-A LS64 extension's intrinsics for 64 bytes
      atomic loads and stores: `__arm_ld64b`, `__arm_st64b`, `__arm_st64bv`,
      and `__arm_st64bv0`. These are selected into the LS64 instructions
      LD64B, ST64B, ST64BV and ST64BV0, respectively.
      
      Based on patches written by Simon Tatham.
      
      Reviewed By: tmatheson
      
      Differential Revision: https://reviews.llvm.org/D93232
      2b1e25be
    • David Stuttard's avatar
      [NFC][AsmPrinter] Windows warning: Use explicit cast · 259936f4
      David Stuttard authored
      static_cast for uint64_t to unsigned gives a MS VC build warning
      for Windows:
      
      warning C4309: 'static_cast': truncation of constant value
      
      Use an explicit cast instead.
      
      Change-Id: I692d335b4913070686a102780c1fb05b893a2f69
      
      Differential Revision: https://reviews.llvm.org/D94592
      259936f4
    • Pavel Labath's avatar
      [lldb] Fix TestPlatformProcessConnect.py · 4b284b9c
      Pavel Labath authored
      The test was marked as remote-only, which means it was run ~never, and
      accumulated various problems. This commit modifies the test to run
      locally and includes a couple of other fixes necessary to make it run:
      - moves the "invoke" method into the "Base" test class
      - adds []'s around the IP address in a couple more places to make things
        work with IPv6
      
      The test is now marked as skipped when running the remote test suite. It
      would be possible to make it run both locally and remotely, but this
      would require writing a lot special logic for the remote case, and that
      is not worth it.
      4b284b9c
    • lewuathe's avatar
      [mlir] Update doc to omit the usage of LLVMIntegerType · ed205f63
      lewuathe authored
      Since [[ https://reviews.llvm.org/D94178 | the LLVMIntegerType was replaced with build-in integer type ]], the usage in the tutorial should be also updated accordingly.
      We need to update chapter 6 for Toy tutorial specifically.
      
      See: https://reviews.llvm.org/D94178
      
      Reviewed By: rriddle
      
      Differential Revision: https://reviews.llvm.org/D94651
      ed205f63
    • Augusto Noronha's avatar
      Implement vAttachWait in lldb-server · 2bbf724f
      Augusto Noronha authored
      This commit vAttachWait in lldb-server, so --waitfor can be used on
      Linux
      
      Reviewed By: labath, clayborg
      
      Differential Revision: https://reviews.llvm.org/D93895
      2bbf724f
    • Philip Pfaffe's avatar
      [lldb][wasm] Parse DWO section names · 7ad54d19
      Philip Pfaffe authored
      Mirror ELF section parsing to support DWARF section names for
      debug fission.
      
      Reviewed By: labath
      
      Differential Revision: https://reviews.llvm.org/D93621
      7ad54d19
    • Jason Molenda's avatar
      Add func call so we don't instruction-step into the builtin_trap · 885eae9d
      Jason Molenda authored
      The way this test is structured right now, I set a breakpoint on
      the instruction before the __builtin_trap.  It hits the breakpoint,
      disables the breakpoint, and instruction steps.  This hits the
      builtin_trap instruction which debugserver (on arm64) now advances
      to the next instruction and reports that address to lldb.  lldb
      doesn't recognize this as a proper response to the instruction
      step and continues executing until the next trap, and the test fails.
      885eae9d
    • Daniel Paoliello's avatar
      Fix unused variable in CoroFrame.cpp when building Release with GCC 10 · ff5e8964
      Daniel Paoliello authored
      When building with GCC 10, the following warning is reported:
      
      ```
      /llvm-project/llvm/lib/Transforms/Coroutines/CoroFrame.cpp:1527:28: warning: unused variable ‘CS’ [-Wunused-variable]
       1527 |       if (CatchSwitchInst *CS =
      ```
      
      This change adds a cast to `void` to avoid the warning.
      
      Reviewed By: lxfind
      
      Differential Revision: https://reviews.llvm.org/D94456
      ff5e8964
    • Duncan P. N. Exon Smith's avatar
    • Fangrui Song's avatar
      [Driver] -gsplit-dwarf: Produce .dwo regardless of -gN for -fthinlto-index= · 53b34601
      Fangrui Song authored
      -g is an IR generation option while -gsplit-dwarf is an object file generation option.
      For -gsplit-dwarf in the backend phase of a distributed ThinLTO (-fthinlto-index=) which does object file generation and no IR generation, -g should not be needed.
      
      This patch makes `-fthinlto-index= -gsplit-dwarf` emit .dwo even in the absence of -g.
      This should fix https://crbug.com/1158215 after D80391.
      
      ```
      // Distributed ThinLTO usage
      clang -g -O2 -c -flto=thin -fthin-link-bitcode=a.indexing.o a.c
      clang -g -O2 -c -flto=thin -fthin-link-bitcode=b.indexing.o b.c
      clang -fuse-ld=lld -Wl,--thinlto-index-only=a.rsp -Wl,--thinlto-prefix-replace=';lto/' -Wl,--thinlto-object-suffix-replace='.indexing.o;.o' a.indexing.o b.indexing.o
      clang -gsplit-dwarf -O2 -c -fthinlto-index=lto/a.o.thinlto.bc a.o -o lto/a.o
      clang -gsplit-dwarf -O2 -c -fthinlto-index=lto/b.o.thinlto.bc b.o -o lto/b.o
      clang -fuse-ld=lld @a.rsp -o exe
      ```
      
      Note: for implicit regular/Thin LTO, .dwo emission works without this patch:
      `clang -flto=thin -gsplit-dwarf a.o b.o` passes `-plugin-opt=dwo_dir=` to the linker.
      The linker forwards the option to LTO. LTOBackend.cpp emits `$dwo_dir/[01234].dwo`.
      
      Reviewed By: dblaikie
      
      Differential Revision: https://reviews.llvm.org/D94647
      53b34601
    • Duncan P. N. Exon Smith's avatar
    • Duncan P. N. Exon Smith's avatar
    • Duncan P. N. Exon Smith's avatar
      ADT: Fix reference invalidation in SmallVector::resize · 260a856c
      Duncan P. N. Exon Smith authored
      For small enough, trivially copyable `T`, take the parameter by-value in
      `SmallVector::resize`.  Otherwise, when growing, update the arugment
      appropriately.
      
      Differential Revision: https://reviews.llvm.org/D93781
      260a856c
    • Jordan Rupprecht's avatar
      [NFC] Fix -Wsometimes-uninitialized · 752fafda
      Jordan Rupprecht authored
      After 49142991, clang detects that MUL may be uninitialized. Set it to nullptr to suppress this check.
      
      Adding an assert to check that it is ultimately set fails two test cases. Since this is not a new issue, leave the assertion commented out until a code owner can fix the bug. The two failing test cases are noted in the assertion comment.
      752fafda
    • Duncan P. N. Exon Smith's avatar
      ADT: Fix reference invalidation in N-element SmallVector::append and insert · 3043e5a5
      Duncan P. N. Exon Smith authored
      For small enough, trivially copyable `T`, take the parameter by-value in
      `SmallVector::append` and `SmallVector::insert`.  Otherwise, when
      growing, update the arugment appropriately.
      
      Differential Revision: https://reviews.llvm.org/D93780
      3043e5a5
    • Duncan P. N. Exon Smith's avatar
      Reapply "ADT: Fix reference invalidation in SmallVector::push_back and single-element insert" · 49142991
      Duncan P. N. Exon Smith authored
      This reverts commit 56d1ffb9, reapplying
      9abac603, removing insert_one_maybe_copy
      and using a helper called forward_value_param instead. This avoids use
      of `std::is_same` (or any SFINAE), so I'm hoping it's more portable and
      MSVC will be happier.
      
      Original commit message follows:
      
      For small enough, trivially copyable `T`, take the argument by value in
      `SmallVector::push_back` and copy it when forwarding to
      `SmallVector::insert_one_impl`. Otherwise, when growing, update the
      argument appropriately.
      
      Differential Revision: https://reviews.llvm.org/D93779
      49142991
    • Kazu Hirata's avatar
      [llvm] Use std::any_of (NFC) · 4c1617da
      Kazu Hirata authored
      4c1617da
    • Kazu Hirata's avatar
      [llvm] Use llvm::stable_sort (NFC) · 125ea20d
      Kazu Hirata authored
      125ea20d
    • Kazu Hirata's avatar
      [llvm] Use *Set::contains (NFC) · 5c1c39e8
      Kazu Hirata authored
      5c1c39e8
    • Duncan P. N. Exon Smith's avatar
      Revert "ADT: Fix reference invalidation in SmallVector::push_back and single-element insert" · 56d1ffb9
      Duncan P. N. Exon Smith authored
      This reverts commit 9abac603 since there
      are some bot errors on Windows:
      http://lab.llvm.org:8011/#/builders/127/builds/4489
      
      ```
      FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/IntervalMap.cpp.obj
      C:\PROGRA~2\MIB055~1\2017\PROFES~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\cl.exe  /nologo /TP -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib\Support -IC:\b\slave\sanitizer-windows\llvm-project\llvm\lib\Support -Iinclude -IC:\b\slave\sanitizer-windows\llvm-project\llvm\include /DWIN32 /D_WINDOWS   /Zc:inline /Zc:__cplusplus /Zi /Zc:strictStrings /Oi /Zc:rvalueCast /bigobj /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd4324 -w14062 -we4238 /Gw /MD /O2 /Ob2 -UNDEBUG -std:c++14  /EHs-c- /GR- /showIncludes /Folib\Support\CMakeFiles\LLVMSupport.dir\IntervalMap.cpp.obj /Fdlib\Support\CMakeFiles\LLVMSupport.dir\LLVMSupport.pdb /FS -c C:\b\slave\sanitizer-windows\llvm-project\llvm\lib\Support\IntervalMap.cpp
      C:\b\slave\sanitizer-windows\llvm-project\llvm\include\llvm/ADT/SmallVector.h(746): error C2672: 'llvm::SmallVectorImpl<T>::insert_one_maybe_copy': no matching overloaded function found
              with
              [
                  T=llvm::IntervalMapImpl::Path::Entry
              ]
      C:\b\slave\sanitizer-windows\llvm-project\llvm\include\llvm/ADT/SmallVector.h(745): note: while compiling class template member function 'llvm::IntervalMapImpl::Path::Entry *llvm::SmallVectorImpl<T>::insert(llvm::IntervalMapImpl::Path::Entry *,T &&)'
              with
              [
                  T=llvm::IntervalMapImpl::Path::Entry
              ]
      C:\b\slave\sanitizer-windows\llvm-project\llvm\lib\Support\IntervalMap.cpp(22): note: see reference to function template instantiation 'llvm::IntervalMapImpl::Path::Entry *llvm::SmallVectorImpl<T>::insert(llvm::IntervalMapImpl::Path::Entry *,T &&)' being compiled
              with
              [
                  T=llvm::IntervalMapImpl::Path::Entry
              ]
      C:\b\slave\sanitizer-windows\llvm-project\llvm\include\llvm/ADT/SmallVector.h(1136): note: see reference to class template instantiation 'llvm::SmallVectorImpl<T>' being compiled
              with
              [
                  T=llvm::IntervalMapImpl::Path::Entry
              ]
      C:\b\slave\sanitizer-windows\llvm-project\llvm\include\llvm/ADT/IntervalMap.h(790): note: see reference to class template instantiation 'llvm::SmallVector<llvm::IntervalMapImpl::Path::Entry,4>' being compiled
      C:\b\slave\sanitizer-windows\llvm-project\llvm\include\llvm/ADT/SmallVector.h(746): error C2783: 'llvm::IntervalMapImpl::Path::Entry *llvm::SmallVectorImpl<T>::insert_one_maybe_copy(llvm::IntervalMapImpl::Path::Entry *,ArgType &&)': could not deduce template argument for '__formal'
              with
              [
                  T=llvm::IntervalMapImpl::Path::Entry
              ]
      C:\b\slave\sanitizer-windows\llvm-project\llvm\include\llvm/ADT/SmallVector.h(727): note: see declaration of 'llvm::SmallVectorImpl<T>::insert_one_maybe_copy'
              with
              [
                  T=llvm::IntervalMapImpl::Path::Entry
              ]
      ```
      56d1ffb9
    • Arthur Eubanks's avatar
      b196dc66
    • Duncan P. N. Exon Smith's avatar
      ADT: Fix reference invalidation in SmallVector::push_back and single-element insert · 9abac603
      Duncan P. N. Exon Smith authored
      For small enough, trivially copyable `T`, take the argument by value in
      `SmallVector::push_back` and copy it when forwarding to
      `SmallVector::insert_one_impl`. Otherwise, when growing, update the
      argument appropriately.
      
      Differential Revision: https://reviews.llvm.org/D93779
      9abac603
    • Alexandre Ganea's avatar
      eec85684
    • Esme-Yi's avatar
      [PowerPC] Try to fold sqrt/sdiv test results with the branch. · ff40fb07
      Esme-Yi authored
      Summary: The patch tries to fold sqrt/sdiv test node, i.g FTSQRT, XVTDIVDP, and the branch, i.e br_cc if they meet these patterns:
      (br_cc seteq, (truncateToi1 SWTestOp), 0) -> (BCC PRED_NU, SWTestOp)
      (br_cc seteq, (and SWTestOp, 2), 0) -> (BCC PRED_NE, SWTestOp)
      (br_cc seteq, (and SWTestOp, 4), 0) -> (BCC PRED_LE, SWTestOp)
      (br_cc seteq, (and SWTestOp, 8), 0) -> (BCC PRED_GE, SWTestOp)
      (br_cc setne, (truncateToi1 SWTestOp), 0) -> (BCC PRED_UN, SWTestOp)
      (br_cc setne, (and SWTestOp, 2), 0) -> (BCC PRED_EQ, SWTestOp)
      (br_cc setne, (and SWTestOp, 4), 0) -> (BCC PRED_GT, SWTestOp)
      (br_cc setne, (and SWTestOp, 8), 0) -> (BCC PRED_LT, SWTestOp)
      
      Reviewed By: steven.zhang
      
      Differential Revision: https://reviews.llvm.org/D94054
      ff40fb07
    • Alexandre Ganea's avatar
      [Support] On Windows, take the affinity mask into account · 336ab2d5
      Alexandre Ganea authored
      The number of hardware threads available to a ThreadPool can be limited if setting an affinity mask.
      For example:
      
      > start /B /AFFINITY 0xF lld-link.exe ...
      
      Would let LLD only use 4 hyper-threads.
      
      Previously, there was an outstanding issue on Windows Server 2019 on dual-CPU machines, which was preventing from using both CPU sockets. In normal conditions, when no affinity mask was set, ProcessorGroup::AllThreads was different from ProcessorGroup::UsableThreads. The previous code in llvm/lib/Support/Windows/Threading.inc L201 was improperly assuming those two values to be equal, and consequently was limiting the execution to only one CPU socket.
      
      Differential Revision: https://reviews.llvm.org/D92419
      336ab2d5
    • Richard Smith's avatar
    • Craig Topper's avatar
      [RISCV] Custom lower ISD::VSCALE. · dfc1901d
      Craig Topper authored
      This patch custom lowers ISD::VSCALE into a csrr vlenb followed
      by a shift right by 3 followed by a multiply by the scale amount.
      
      I've added computeKnownBits support to indicate that the csrr vlenb
      always produces 3 trailng bits of 0s so the shift right is "exact".
      This allows the shift and multiply sequence to be nicely optimized
      into a single shift or removed completely when the scale amount is
      a power of 2.
      
      The non power of 2 case multiplying by 24 is still producing
      suboptimal code. We could remove the right shift and use a
      multiply by 3. Hopefully we can improve DAG combine to fix that
      since it's not unique to this sequence.
      
      This replaces D94144.
      
      Reviewed By: HsiangKai
      
      Differential Revision: https://reviews.llvm.org/D94249
      dfc1901d