1. Apr 27, 2021
    • Lang Hames's avatar
      [ORC] C API updates. · c8fc5e3b
      Lang Hames authored
      Adds support for creating custom MaterializationUnits in the C API with the new
      LLVMOrcCreateCustomMaterializationUnit function.
      
      Modifies ownership rules for LLVMOrcAbsoluteSymbols to make it consistent with
      LLVMOrcCreateCustomMaterializationUnit. This is an ABI breaking change for any
      clients of the LLVMOrcAbsoluteSymbols API.
      
      Adds LLVMOrcLLJITGetObjLinkingLayer and LLVMOrcObjectLayerEmit functions to
      allow clients to get a reference to an LLJIT instance's linking layer, then
      emit an object file using it. This can be used to support construction of
      custom materialization units in the common case where those units will
      generate an object file that needs to be emitted to complete the
      materialization.
      c8fc5e3b
    • Lang Hames's avatar
      [ORC] Fix type name. · 8d718a0b
      Lang Hames authored
      Rename JITTargetSymbolFlags to JITSymbolTargetFlags. This matches the convention
      used for JITSymbolGenericFlags.
      8d718a0b
    • Fangrui Song's avatar
      [ADT] Remove StatisticBase and make NoopStatistic empty · b5403117
      Fangrui Song authored
      In LLVM_ENABLE_STATS=0 builds, `llvm::Statistic` maps to `llvm::NoopStatistic`
      but has 3 unused pointers. GlobalOpt considers that the pointers can potentially
      retain allocated objects, so GlobalOpt cannot optimize out the `NoopStatistic`
      variables (see D69428 for more context), wasting 23KiB for stage 2 clang.
      
      This patch makes `NoopStatistic` empty and thus reclaims the wasted space.  The
      clang size is even smaller than applying D69428 (slightly smaller in both .bss and
      .text).
      ```
      # This means the D69428 optimization on clang is mostly nullified by this patch.
      HEAD+D69428: size(.bss) = 0x0725a8
      HEAD+D101211: size(.bss) = 0x072238
      
      # bloaty - HEAD+D69428 vs HEAD+D101211
      # With D101211, we also save a lot of string table space (.rodata).
          FILE SIZE        VM SIZE
       --------------  --------------
        -0.0%     -32  -0.0%     -24    .eh_frame
        -0.0%    -336  [ = ]       0    .symtab
        -0.0%    -360  [ = ]       0    .strtab
        [ = ]       0  -0.2%    -880    .bss
        -0.0% -2.11Ki  -0.0% -2.11Ki    .rodata
        -0.0% -2.89Ki  -0.0% -2.89Ki    .text
        -0.0% -5.71Ki  -0.0% -5.88Ki    TOTAL
      ```
      
      Note: LoopFuse is a disabled pass. This patch adds `#if LLVM_ENABLE_STATS` so
      `OptimizationRemarkMissed` is skipped in LLVM_ENABLE_STATS==0 builds.  If these
      `OptimizationRemarkMissed` are useful and not noisy, we can replace
      `llvm::Statistic` with `llvm::TrackingStatistic` in the future.
      
      Reviewed By: lattner
      
      Differential Revision: https://reviews.llvm.org/D101211
      b5403117
    • Craig Topper's avatar
      [RISCV] Match splatted load to scalar load + splat. Form strided load during isel. · e2cd92cb
      Craig Topper authored
      This modifies my previous patch to push the strided load formation
      to isel. This gives us opportunity to fold the splat into a .vx
      operation first. Using a scalar register and a .vx operation reduces
      vector register pressure which can be important for larger LMULs.
      
      If we can't fold the splat into a .vx operation, then it can make
      sense to use a strided load to free up the vector arithmetic
      ALU to do actual arithmetic rather than tying it up with vmv.v.x.
      
      Reviewed By: khchen
      
      Differential Revision: https://reviews.llvm.org/D101138
      e2cd92cb
    • Fangrui Song's avatar
      Add LLVM_ATTRIBUTE_USED to fix problems which could be exposed by aggressive... · b81244fa
      Fangrui Song authored
      Add LLVM_ATTRIBUTE_USED to fix problems which could be exposed by aggressive global pointer variable removal
      
      Note to BuryPointer.cpp:GraveYard. 'unused' cannot prevent (1) dead store
      elimination and (2) removal of the global pointer variable (D69428) but 'used' can.
      
      Discovered when comparing link maps between HEAD+D69428 and HEAD.
      
      Reviewed By: lattner
      
      Differential Revision: https://reviews.llvm.org/D101217
      b81244fa
    • Fangrui Song's avatar
      [gcov] Set nounwind and respect module flags metadata "frame-pointer" &... · 614de225
      Fangrui Song authored
      [gcov] Set nounwind and respect module flags metadata "frame-pointer" & "uwtable" for synthesized functions
      
      This applies the D100251 mechanism to the gcov instrumentation pass.
      
      With this patch, `-fno-omit-frame-pointer` in
      `clang -fprofile-arcs -O1 -fno-omit-frame-pointer` will be respected for synthesized
      `__llvm_gcov_writeout,__llvm_gcov_reset,__llvm_gcov_init` functions: the frame pointer
      will be kept (note: on many targets -O1 eliminates the frame pointer by default).
      
      `clang -fno-exceptions -fno-asynchronous-unwind-tables -g -fprofile-arcs` will
      produce .debug_frame instead of .eh_frame.
      
      Fix: https://github.com/ClangBuiltLinux/linux/issues/955
      
      Reviewed By: nickdesaulniers
      
      Differential Revision: https://reviews.llvm.org/D101129
      614de225
    • Leonard Chan's avatar
      [compiler-rt][hwasan] Add definition for Symbolizer::SymbolizeFrame · a786f2ba
      Leonard Chan authored
      This is undefined if SANITIZER_SYMBOLIZER_MARKUP is 1, which is the case for
      Fuchsia, and will result in a undefined symbol error. This function is needed
      by hwasan for online symbolization, but is not needed for us since we do
      offline symbolization.
      
      Differential Revision: https://reviews.llvm.org/D99386
      a786f2ba
    • Arthur O'Dwyer's avatar
      [libc++] [test] Fix a Python warning. · 0fcb898f
      Arthur O'Dwyer authored
      params.py:106: SyntaxWarning: "is" with a literal. Did you mean "=="?
      0fcb898f
    • Arthur O'Dwyer's avatar
      [libc++] [test] Improve test_exceptions() in each string.modifiers test. · 036b80fc
      Arthur O'Dwyer authored
      When checking the strong exception guarantee, also check that
      iterators haven't been invalidated.
      
      Reviewed as part of https://reviews.llvm.org/D98573
      036b80fc
    • Arthur O'Dwyer's avatar
      [libc++] Remove the special logic for "noexcept iterators" in basic_string. · e87479b0
      Arthur O'Dwyer authored
      This reverts a large chunk of http://reviews.llvm.org/D15862 ,
      and also fixes bugs in `insert`, `append`, and `assign`, which are now regression-tested.
      (Thanks to Tim Song for pointing out the bug in `append`!)
      
      Before this patch, we did a special dance in `append`, `assign`, and `insert`
      (but not `replace`). All of these require the strong exception guarantee,
      even when the user-provided InputIterator might have throwing operations.
      
      The naive way to accomplish this is to construct a temporary string and
      then append/assign/insert from the temporary; i.e., finish all the potentially
      throwing and self-inspecting InputIterator operations *before* starting to
      modify self. But this is slow, so we'd like to skip it when possible.
      
      The old code (D15682) attempted to check that specific iterator operations
      were nothrow: it assumed that if the iterator operations didn't throw, then
      it was safe to iterate the input range multiple times and therefore it was
      safe to use the fast-path non-naive version. This was wrong for two reasons:
      (1) the old code checked the wrong operations (e.g. checked noexceptness of `==`,
      but the code that ran used `!=`), and (2) the conversion of value_type to char
      could still throw, or inspect the contents of self.
      
      The new code is much simpler, although still much more complicated than it
      really could be. We'll likely revisit this codepath at some point, but for now
      this patch suffices to get it passing all the new regression tests.
      
      The added tests all fail before this patch, and succeed afterward.
      See https://quuxplusone.github.io/blog/2021/04/17/pathological-string-appends/
      
      Differential Revision: https://reviews.llvm.org/D98573
      e87479b0
    • Arthur O'Dwyer's avatar
      [libc++] __bit_iterator mustn't rely on deprecated SMF generation. · 70d94c3f
      Arthur O'Dwyer authored
      This allows us to turn -Wdeprecated-copy back on. We turned it off
      in 3b71de41 because Clang's implementation became more stringent
      and started diagnosing the old code here.
      
      Differential Revision: https://reviews.llvm.org/D101183
      70d94c3f
    • Nico Weber's avatar
      [gn build] reformat all gn files · 5529878f
      Nico Weber authored
      $ git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
      5529878f
    • Nico Weber's avatar
      [gn build] (manually) port f8de9aae · 7673bd56
      Nico Weber authored
      7673bd56
    • Siva Chandra Reddy's avatar
      [libc] Add differential quality and perf analysis targets for sinf and cosf. · c6aa206b
      Siva Chandra Reddy authored
       Infrastructure needed for setting up the diff binaries has been added.
       Along the way, an exhaustive test for sinf and cosf have also been added.
      
      Reviewed By: lntue
      
      Differential Revision: https://reviews.llvm.org/D101276
      c6aa206b
    • Ali Tamur's avatar
      Support DW_FORM_strx* in llvm-dwp. · 51b46107
      Ali Tamur authored
      Currently llvm-dwp only handled DW_FORM_string and DW_FORM_GNU_str_index; with this patch it also starts to handle DW_FORM_strx[1-4]?
      
      Reviewed By: dblaikie
      
      Differential Revision: https://reviews.llvm.org/D75485
      51b46107
    • Guillaume Chatelet's avatar
      [libc] Use different alignment for memcpy between ARM and x86. · b5f04d81
      Guillaume Chatelet authored
      Aligned copy used to be 'destination aligned' for x86 but this decision was reverted in D93457 where we noticed that it was better for ARM to be 'source aligned'.
      More benchmarking confirmed that it can be up to 30% faster to align copy to destination for x86. This Patch offers both implementations and switches x86 back to destination aligned.
      It also fixes alignment to 32 byte on x86.
      
      Differential Revision: https://reviews.llvm.org/D101296
      b5f04d81
    • Martin Storsjö's avatar
      [llvm-rc] Add a GNU windres-like frontend to llvm-rc · f8de9aae
      Martin Storsjö authored
      This primarily parses a different set of options and invokes the same
      resource compiler as llvm-rc normally. Additionally, it can convert
      directly to an object file (which in MSVC style setups is done with the
      separate cvtres tool, or by the linker).
      
      (GNU windres also supports other conversions; from coff object file back
      to .res, and from .res or object file back to .rc form; that's not yet
      implemented.)
      
      The other bigger complication lies in being able to imply or pass the
      intended target triple, to let clang find the corresponding mingw sysroot
      for finding include files, and for specifying the default output object
      machine format.
      
      It can be implied from the tool triple prefix, like
      `<triple>-[llvm-]windres` or picked up from the windres option e.g.
      `-F pe-x86-64`. In GNU windres, that option takes BFD style format names
      such as pe-i386 or pe-x86-64. As libbfd in binutils doesn't support
      Windows on ARM, there's no such canonical name for the ARM tar...
      f8de9aae
    • Chris Lattner's avatar
      [Verifier] Tidy up the code a bit, NFC. · f0c22c3d
      Chris Lattner authored
      This tidies up the code a bit:
       * Eliminate the ctx member, which doesn't need to be stored.
       * Rename verify(Operation) to make it more clear that it is
         doing more than verifyOperation and that the dominance check
         isn't being done multiple times.
       * Rename mayNotHaveTerminator which was confusing about whether
         it wasn't known whether it had a terminator, when it is really
         about whether it is legal to have a terminator.
       * Some minor optimizations: don't check for RegionKindInterface
         if there are no regions.  Don't do two passes over the
         operations in a block in OperationVerifier::verifyDominance when
         one will do.
      
      The optimizations are actually a measurable (but minor) win in some
      CIRCT cases.
      
      Differential Revision: https://reviews.llvm.org/D101267
      f0c22c3d
    • Chris Lattner's avatar
    • Alex Lorenz's avatar
      [clang][driver] Use the provided arch name for a Darwin target triple · 6cc62043
      Alex Lorenz authored
      This ensures that the Darwin driver uses a consistent target triple
      representation when the triple is printed out to the user.
      
      Differential Revision: https://reviews.llvm.org/D100807
      6cc62043
    • Joseph Huber's avatar
      [OpenMP][Documentation] Add FAQ entry for dynamically linked libraries · 077fe0f7
      Joseph Huber authored
      Summary:
      Add an FAW entry detailing the support for using dynamically linked libraries
      with OpenMP Offloading
      077fe0f7
    • Tim Renouf's avatar
      [AMDGPU][llvm-objdump] Fix memory leak in recent commit · 1128311a
      Tim Renouf authored
      Hopefully stops sanitizer fail in AMDGPU llvm-objdump test.
      
      Change-Id: I7331151d1cb65292bd06b6ae283349fe7231cf6b
      1128311a
    • Stephen Kelly's avatar
      [AST] Fix DeclarationNameInfo introspection · 50b523cb
      Stephen Kelly authored
      Some AST classes return `const DeclarationNameInfo &` instead of
      returning by value (eg CXXDependentScopeMemberExpr).
      50b523cb
    • Moritz Sichert's avatar
      10038d0b
    • Jin Lin's avatar
      Preserve the lexical order for global variables during llvm-link merge · cedfa38f
      Jin Lin authored
      The order of global variables is generated in the order of recursively materializing variables if the global variable has the attribute of hasLocalLinkage or hasLinkOnceLinkage during the module merging. In practice, it is often the exact reverse of source order. This new order may cause performance regression.
      
      The change is to preserve the original lexical order for global variables.
      
      Reviewed By: jdoerfert, dexonsmith
      
      Differential Revision: https://reviews.llvm.org/D94202
      cedfa38f
    • Sebastian Neubauer's avatar
      [AMDGPU] Fix autogenerated wwm-reserved-spill.ll · 9579af2b
      Sebastian Neubauer authored
      Due to a bug in update_llc_test_checks.py, the test is wrongly
      coalesced between run lines. Remove common check prefix to fix that.
      NFC.
      9579af2b
    • Wael Yehia's avatar
      XFAIL thinlto testcases on AIX · 91db11c9
      Wael Yehia authored
      In D100350, we switched off thinLTO on the AIX OS. So, XFAIL tests that
      invoke clang with -flto=thin on AIX.
      91db11c9
    • Raphael Isemann's avatar
      [lldb] Skip TestPointerToMemberTypeDependingOnParentSize on Windows and GCC · a0c735e2
      Raphael Isemann authored
      The test added in D100977 is failing to compile on these platforms. This seems
      to be caused by GCC, MSVC and Clang@Windows rejecting the code because
      `ToLayout` isn't complete when pointer_to_member_member is declared (even though
      that seems to be valid code).
      
      This also reverts the test changes in the lazy-loading test from D100977 as
      that failed for the same reason.
      a0c735e2
    • William S. Moses's avatar
      [Lexer] Allow LLLexer to be used as an API · 494e7713
      William S. Moses authored
      Explose LLVM Lexer for usage externally as an API
      
      Differential Revision: https://reviews.llvm.org/D100920
      494e7713
    • Frederik Gossen's avatar
    • Jonas Devlieghere's avatar
      [lldb] Don't use ::fork or ::vfork on watchOS or tvOS · 7d850db6
      Jonas Devlieghere authored
      Update lldb-server to not use fork or vfork on watchOS and tvOS as these
      functions are explicitly marked unavailable there.
      
      llvm-project/lldb/test/API/tools/lldb-server/main.cpp:304:11:
      error: 'fork' is unavailable: not available on watchOS
            if (fork() == 0)
                ^
      WatchSimulator6.2.sdk/usr/include/unistd.h:447:8: note: 'fork' has been
      explicitly marked unavailable here
      pid_t    fork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
               ^
      llvm-project/lldb/test/API/tools/lldb-server/main.cpp:307:11:
      error: 'vfork' is unavailable: not available on watchOS
            if (vfork() == 0)
                ^
      WatchSimulator6.2.sdk/usr/include/unistd.h:602:8: note: 'vfork' has been
      explicitly marked unavailable here
      pid_t    vfork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED;
               ^
      7d850db6
    • Peter Steinfeld's avatar
      [flang] Check for attributes specific to dummy arguments · f9c0859e
      Peter Steinfeld authored
      We were not checking that attributes that are supposed to be specific to
      dummy arguments were not being used for local entities.  I added the checks
      along with tests for them.
      
      After implementing these new checks, I found that one of the tests in
      separate-mp02.f90 was erroneous, and I fixed it.
      
      Differential Revision: https://reviews.llvm.org/D101126
      f9c0859e
  2. Apr 26, 2021
  3. Apr 27, 2021
  4. Apr 26, 2021