1. Oct 21, 2020
    • Fangrui Song's avatar
      [ELF] --gdb-index: support --icf={safe,all} · 38b632c1
      Fangrui Song authored
      The combination has not been tested before. In the case of ICF,
      `e.section->getVA(0)` equals the start address of the output section.
      
      This can cause incorrect overlapping with the actual function at the
      start of the output section and potentially trigger a GDB internal error
      in `dw2_find_pc_sect_compunit_symtab` (presumably because:
      if a short address range incorrectly starts at the start address of the
      output section, GDB may pick it instead of the correct longer address
      range. When mapping an address within the long address range but
      out of the scope of the short address range, the routine may find
      nothing - while the code asserts that it can find something).
      
      Note that in the case of ICF there may be duplicate address range entries,
      but GDB appears to be fine with them.
      
      Reviewed By: grimar
      
      Differential Revision: https://reviews.llvm.org/D89751
      38b632c1
    • Jianzhou Zhao's avatar
      Release pages to OS when setting 0 label · cc07fbe3
      Jianzhou Zhao authored
      This is a follow up patch of https://reviews.llvm.org/D88755.
      
      When set 0 label for an address range, we can release pages within the
      corresponding shadow address range to OS, and set only addresses outside
      the pages to be 0.
      
      Reviewed-by: morehouse, eugenis
      Differential Revision: https://reviews.llvm.org/D89199
      cc07fbe3
  2. Oct 20, 2020
    • Florian Hahn's avatar
      [DSE] Do not scan users of memory terminators for further reads. · 2e580102
      Florian Hahn authored
      isMemTerminator checks if the current def is a memory terminator that
      terminates the memory pointed to by DefLoc. We do not have to add any of
      their users to the worklist, because the follow-on users cannot read the
      memory in question.
      
      This leads to more stores eliminated in the presence of lifetime calls.
      Previously we added the users of those intrinsics to the worklist,
      limiting elimination.
      
      In terms of removed stores, this gives a nice boost on some benchmarks
      (MultiSource/SPEC2000/SPEC2006 on X86 with -flto -O3):
      
      Same hash: 205 (filtered out)
      Remaining: 32
      Metric: dse.NumFastStores
      
      Program                                          base   patch   diff
       test-suite...000/197.parser/197.parser.test     4.00    8.00  100.0%
       test-suite...rolangs-C++/family/family.test     4.00    7.00  75.0%
       test-suite...marks/7zip/7zip-benchmark.test   1722.00 2189.00 27.1%
       test-suite...CFP2000/177.mesa/177.mesa.test    30.00   38.00  26.7%
       test-suite :: External/Nurbs/nurbs.test        44.00   49.00  11.4%
       test-suite...lications/sqlite3/sqlite3.test   115.00  128.00  11.3%
       test-suite...006/447.dealII/447.dealII.test   2715.00 3013.00 11.0%
       test-suite...ProxyApps-C++/CLAMR/CLAMR.test   237.00  261.00  10.1%
       test-suite...tions/lambda-0.1.3/lambda.test    40.00   44.00  10.0%
       test-suite...3.xalancbmk/483.xalancbmk.test   1366.00 1475.00  8.0%
       test-suite...abench/jpeg/jpeg-6a/cjpeg.test    13.00   14.00   7.7%
       test-suite...oxyApps-C++/miniFE/miniFE.test    43.00   46.00   7.0%
       test-suite...lications/ClamAV/clamscan.test   230.00  246.00   7.0%
       test-suite...006/450.soplex/450.soplex.test   284.00  299.00   5.3%
       test-suite...nsumer-jpeg/consumer-jpeg.test    21.00   22.00   4.8%
      2e580102
    • Simon Pilgrim's avatar
    • Jay Foad's avatar
      [AMDGPU] Remove unused declaration. NFC. · 4913e362
      Jay Foad authored
      The implementation of this method was removed in D89706.
      4913e362
    • Simon Pilgrim's avatar
    • Mikhail Maltsev's avatar
      [clang] Use SourceLocation as key in hash maps, NFCI · 78194118
      Mikhail Maltsev authored
      The patch adjusts the existing `llvm::DenseMap<unsigned, T>` and
      `llvm::DenseSet<unsigned>` objects that store source locations, so
      that they use `SourceLocation` directly instead of `unsigned`.
      
      This patch relies on the `DenseMapInfo` trait added in D89719.
      
      It also replaces the construction of `SourceLocation` objects from
      the constants -1 and -2 with calls to the trait's methods `getEmptyKey`
      and `getTombstoneKey` where appropriate.
      
      Reviewed By: dexonsmith
      
      Differential Revision: https://reviews.llvm.org/D69840
      78194118
    • Hans Wennborg's avatar
      Explicitly initialize StreamingDiagnostic in derived class copy ctors · c76cdeac
      Hans Wennborg authored
      To pacify a GCC warning:
      
      [1/1] Building CXX object tools/clang/lib/Analysis/CMakeFiles/obj.clangAnalysis.dir/Dominators.cpp.o
      In file included from /work/llvm.monorepo/clang/include/clang/AST/NestedNameSpecifier.h:18:0,
                       from /work/llvm.monorepo/clang/include/clang/AST/Type.h:21,
                       from /work/llvm.monorepo/clang/include/clang/AST/DeclarationName.h:16,
                       from /work/llvm.monorepo/clang/include/clang/AST/DeclBase.h:18,
                       from /work/llvm.monorepo/clang/include/clang/Analysis/AnalysisDeclContext.h:20,
                       from /work/llvm.monorepo/clang/include/clang/Analysis/Analyses/Dominators.h:16,
                       from /work/llvm.monorepo/clang/lib/Analysis/Dominators.cpp:9:
      /work/llvm.monorepo/clang/include/clang/Basic/Diagnostic.h:
      In copy constructor ‘clang::DiagnosticBuilder::DiagnosticBuilder(const clang::DiagnosticBuilder&)’:
      /work/llvm.monorepo/clang/include/clang/Basic/Diagnostic.h:1287:3:
      warning: base class ‘class clang::StreamingDiagnostic’ should be explicitly initialized in the copy constructor [-Wextra]
         DiagnosticBuilder(const DiagnosticBuilder &D) {
         ^
      In file included from /work/llvm.monorepo/clang/include/clang/AST/Type.h:29:0,
                       from /work/llvm.monorepo/clang/include/clang/AST/DeclarationName.h:16,
                       from /work/llvm.monorepo/clang/include/clang/AST/DeclBase.h:18,
                       from /work/llvm.monorepo/clang/include/clang/Analysis/AnalysisDeclContext.h:20,
                       from /work/llvm.monorepo/clang/include/clang/Analysis/Analyses/Dominators.h:16,
                       from /work/llvm.monorepo/clang/lib/Analysis/Dominators.cpp:9:
      /work/llvm.monorepo/clang/include/clang/Basic/PartialDiagnostic.h:
      In copy constructor ‘clang::PartialDiagnostic::PartialDiagnostic(const clang::PartialDiagnostic&)’:
      /work/llvm.monorepo/clang/include/clang/Basic/PartialDiagnostic.h:52:3:
      warning: base class ‘class clang::StreamingDiagnostic’ should be explicitly initialized in the copy constructor [-Wextra]
         PartialDiagnostic(const PartialDiagnostic &Other) : DiagID(Other.DiagID) {
         ^
      c76cdeac
    • Hans Wennborg's avatar
      Try to make GCC5 happy about the CfgTraits thing · 03a5f7ce
      Hans Wennborg authored
      It was failing with:
      
      In file included from /work/llvm.monorepo/clang/lib/Analysis/Dominators.cpp:9:0:
      /work/llvm.monorepo/clang/include/clang/Analysis/Analyses/Dominators.h: At global scope:
      /work/llvm.monorepo/clang/include/clang/Analysis/Analyses/Dominators.h:111:26:
      error: specialization of ‘template<class CfgRelatedTypeT> struct llvm::CfgTraitsFor’ in different namespace [-fpermissive]
       template <> struct llvm::CfgTraitsFor<clang::CFGBlock> {
                                ^
      In file included from /work/llvm.monorepo/clang/include/clang/Analysis/Analyses/Dominators.h:21:0,
                       from /work/llvm.monorepo/clang/lib/Analysis/Dominators.cpp:9:
      /work/llvm.monorepo/llvm/include/llvm/Support/CfgTraits.h:294:44:
      error:   from definition of ‘template<class CfgRelatedTypeT> struct llvm::CfgTraitsFor’ [-fpermissive]
       template <typename CfgRelatedTypeT> struct CfgTraitsFor;
                                                  ^
      03a5f7ce
    • Mikhail Maltsev's avatar
      [clang][Basic] Make SourceLocation usable as key in hash maps, NFCI · 234c47ae
      Mikhail Maltsev authored
      This change creates a `DenseMapInfo` trait specialization for the
      SourceLocation class. The empty key, the tombstone key, and the hash
      function are identical to `DenseMapInfo<unsigned>`, because we already
      have hash maps that use raw the representation of `SourceLocation` as
      a key.
      
      The update of existing `DenseMap`s containing raw representation of
      `SourceLocation`s will be done in a follow-up patch. As an example
      the patch makes use of the new trait in one instance:
      clang-tidy/google/UpgradeGoogletestCaseCheck.{h,cpp}
      
      Reviewed By: dexonsmith
      
      Differential Revision: https://reviews.llvm.org/D89719
      234c47ae
    • Louis Dionne's avatar
      [libc++] Explicitly request new/delete in libc++ for Win to ARM Linux builds · eaa928b7
      Louis Dionne authored
      Since 9b40ee8e, new/delete must be requested explicitly during the
      CMake configuration if one wants these definitions to appear in libc++.
      
      Differential Revision: https://reviews.llvm.org/D89793
      eaa928b7
    • Akira Hatanaka's avatar
      Add a C++ test case for https://reviews.llvm.org/D86854 · b78045c2
      Akira Hatanaka authored
      The test case was part of https://reviews.llvm.org/D82999, which was
      abandoned after https://reviews.llvm.org/D86854 fixed the bug.
      b78045c2
    • Michael Liao's avatar
    • Nico Weber's avatar
      853553f8
    • Nico Weber's avatar
      [gn build] belatedly port 3ddac7e5 · f67edf56
      Nico Weber authored
      f67edf56
    • Nico Weber's avatar
      [gn build] port a2214757 more · abef77c3
      Nico Weber authored
      abef77c3
    • Simon Pilgrim's avatar
      [InstCombine] Add (icmp ult (X + CA), C1) | (icmp eq X, C2) -> (icmp ule (X +... · bf540a64
      Simon Pilgrim authored
      [InstCombine] Add (icmp ult (X + CA), C1) | (icmp eq X, C2) -> (icmp ule (X + CA), C1) test coverage
      
      Add both commuted variants and vector uniform/nonuniform examples
      bf540a64
    • Michael Liao's avatar
    • Michael Liao's avatar
      [amdgpu] Enhance AMDGPU AA. · 2a0e4d1c
      Michael Liao authored
      - In general, a generic point may alias to pointers in all other address
        spaces. However, for certain cases enforced by the programming model,
        we may found a generic point won't alias to pointers to local objects.
        * When a generic pointer is loaded from the constant address space, it
          could only be a pointer to the GLOBAL or CONSTANT address space.
          Thus, it won't alias to pointers to the PRIVATE or LOCAL address
          space.
        * When a generic pointer is passed as a kernel argument, it also could
          only be a pointer to the GLOBAL or CONSTANT address space. Thus, it
          also won't alias to pointers to the PRIVATE or LOCAL address space.
      
      Differential Revision: https://reviews.llvm.org/D89525
      2a0e4d1c
    • Florian Hahn's avatar
      [DSE] Bail out from getLocForWriteEx if call is not argmemonly/inacc_mem. · 6439fde6
      Florian Hahn authored
      This change should currently not have any impact, but guard against
      further inconsistencies between MemoryLocation and function attributes.
      6439fde6
    • Georgii Rymar's avatar
      Reland "[yaml2obj][ELF] - Simplify the code that performs sections validation." · 6487ffaf
      Georgii Rymar authored
      This reverts commit 1b589f4d and relands the D89463
      with the fix: update `MappingTraits<FileFilter>::validate()` in ClangTidyOptions.cpp to
      match the new signature (change the return type to "std::string" from "StringRef").
      
      Original commit message:
      
      This:
      
      Changes the return type of MappingTraits<T>>::validate to std::string
      instead of StringRef. It allows to create more complex error messages.
      
      It introduces std::vector<std::pair<StringRef, bool>> getEntries():
      a new virtual method of Section, which is the base class for all sections.
      It returns names of special section specific keys (e.g. "Entries") and flags that says if them exist in a YAML.
      The code in validate() uses this list of entries descriptions to generalize validation.
      This approach was discussed in the D89039 thread.
      
      Differential revision: https://reviews.llvm.org/D89463
      6487ffaf
    • Sanjay Patel's avatar
      7c516504
    • Sanjay Patel's avatar
      [InstSimplify] add vector icmp tests; NFC · b11588b1
      Sanjay Patel authored
      b11588b1
    • LLVM GN Syncbot's avatar
      [gn build] Port c0cdd22c · 672652e8
      LLVM GN Syncbot authored
      672652e8
    • LLVM GN Syncbot's avatar
      [gn build] Port a2214757 · e572c9ce
      LLVM GN Syncbot authored
      e572c9ce
    • Florian Hahn's avatar
      [DSE] Add test to make sure memccpy does not kill stores. · f5582569
      Florian Hahn authored
      It is not known how many bytes are written by memccpy, so it cannot kill
      any stores.
      f5582569
    • Simon Pilgrim's avatar
      [InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3))... · e372a5f8
      Simon Pilgrim authored
      [InstCombine] Add or((icmp ult/ule (A + C1), C3), (icmp ult/ule (A + C2), C3)) uniform vector support
      
      Reapplied rGa704d823 with a check for integer/integervector types to prevent matching with pointer types
      e372a5f8
    • Nico Weber's avatar
      Revert "Revert "[gn build] (manually) port d09b0891"" · db915f29
      Nico Weber authored
      This reverts commit 6ca3dd97.
      d09b0891 relanded in 53065c54.
      db915f29
    • Eric Fiselier's avatar
      [libc++] Make __shared_weak_count vtable consistent across all build configurations · 229db364
      Eric Fiselier authored
      This patch ensures that __shared_weak_count provides a consistent vtable
      regardless of if RTTI is enabled or if we are targeting a static or shared
      libc++ build.
      
      This patch is technically ABI breaking, but only for a very specific
      configuration that no vendor should be shipping.
      
      Note that _LIBCPP_BUILD_STATIC is not normally defined when building
      libc++.a, but instead it must be manually provided by the user or the
      __config_site.
      
      Differential Revision: https://reviews.llvm.org/D32838
      229db364
    • Georgii Rymar's avatar
      1b589f4d
    • Jean Perier's avatar
      [flang] Document and use intrinsic subroutine argument intents · 29d1a494
      Jean Perier authored
      Check INTENT(OUT)/INTENT(INOUT) constraints for actual argument
      of intrinsic procedure calls.
      - Adding a common::Intent field to the IntrinsicDummyArgument
      in the intrinsic table.
      - Propagating it to the DummyDataObject intent field so that it can
      later be used in CheckExplicitDataArg semantic checks.
      - Add related tests.
      - Fix regression (C846 false error), C846 INTENT(OUT) rule does
        not apply to intrinsic call. Propagate the information that we
        are in an intrinsic call up to CheckExplicitDataArg (that is
        doing this check). Still enforce C846 on intrinsics other than MOVE_ALLOC (for which
        allocatable coarrays are explicitly allowed) since it's not clear it is allowed in all
        intrinsics and allowing this would lead to runtime penalties in the intrinsic runtime.
      
      Differential Revision: https://reviews.llvm.org/D89473
      29d1a494
    • Nicolai Hähnle's avatar
      Introduce CfgTraits abstraction · c0cdd22c
      Nicolai Hähnle authored
      The CfgTraits abstraction simplfies writing algorithms that are
      generic over the type of CFG, and enables writing such algorithms
      as regular non-template code that operates on opaque references
      to CFG blocks and values.
      
      Implementations of CfgTraits provide operations on the concrete
      CFG types, e.g. `IrCfgTraits::BlockRef` is `BasicBlock *`.
      
      CfgInterface is an abstract base class which provides operations
      on opaque types CfgBlockRef and CfgValueRef. Those opaque types
      encapsulate a `void *`, but the meaning depends on the concrete
      CFG type. For example, MachineCfgTraits -- for use with MachineIR
      in SSA form -- encodes a Register inside CfgValueRef. Converting
      between concrete references and opaque/generic ones is done by
      CfgTraits::{fromGeneric,toGeneric}. Convenience methods
      CfgTraits::{un}wrap{Iterator,Range} are available as well.
      
      Writing algorithms in terms of CfgInterface adds some overhead
      (virtual method calls, plus in same cases it removes the
      opportunity to inline iterators), but can be much more convenient
      since generic algorithms can be written as non-templates.
      
      This patch adds implementations of CfgTraits for all CFGs on
      which dominator trees are calculated, so that the dominator
      tree can be ported to this machinery. Only IrCfgTraits (LLVM IR)
      and MachineCfgTraits (Machine IR in SSA form) are complete, the
      other implementations are limited to the absolute minimum
      required to make the upcoming dominator tree changes work.
      
      v5:
      - fix MachineCfgTraits::blockdef_iterator and allow it to iterate over
        the instructions in a bundle
      - use MachineBasicBlock::printName
      
      v6:
      - implement predecessors/successors for all CfgTraits implementations
      - fix error in unwrapRange
      - rename toGeneric/fromGeneric into wrapRef/unwrapRef to have naming
        that is consistent with {wrap,unwrap}{Iterator,Range}
      - use getVRegDef instead of getUniqueVRegDef
      
      v7:
      - std::forward fix in wrapping_iterator
      - fix typos
      
      v8:
      - cleanup operators on CfgOpaqueType
      - address other review comments
      
      Change-Id: Ia75f4f268fded33fca11218a7d578c9aec1f3f4d
      
      Differential Revision: https://reviews.llvm.org/D83088
      c0cdd22c
    • Haojian Wu's avatar
      [format] foo.<name>.h should be the main-header for foo.<name>.cc · 84048e23
      Haojian Wu authored
      This fixes a regression introduced in https://reviews.llvm.org/D88640.
      
      Differential Revision: https://reviews.llvm.org/D89783
      84048e23
    • Roman Lebedev's avatar
    • Simon Pilgrim's avatar
    • Luís Marques's avatar
      [compiler-rt][builtins] Add tests for atomic builtins support functions · fc3f9dfa
      Luís Marques authored
      Adds some simple sanity checks that the support functions for the atomic
      builtins do the right thing. This doesn't test concurrency and memory model
      issues.
      
      Differential Revision: https://reviews.llvm.org/D86278
      fc3f9dfa
    • Konrad Kleine's avatar
      [doc] Apply buildbot worker terminology change: slave->worker · f0f76aea
      Konrad Kleine authored
      Recently [1], there was an upgrade to the version of buildbot being
      deployed. The new setup will still work with old buildslaves but I
      thought it might be a good idea to update the documentation to reflect,
      that you now can use a newer buildbot version to when setting up your
      worker (formely known as slave).
      
      The upgrade from buildbot 0.8.5 to 2.8.5 went a long with a transition
      to a new "worker" terminology [2] which is also reflected by this
      change.
      
      [1]: http://lists.llvm.org/pipermail/llvm-dev/2020-October/145629.html
      [2]: http://docs.buildbot.net/0.9.12/manual/worker-transition.html
      
      Reviewed By: gkistanova
      
      Differential Revision: https://reviews.llvm.org/D89230
      f0f76aea
    • Pushpinder Singh's avatar
      [libomptarget][AMDGPU][NFC] Split atmi_memcpy for h2d and d2h · aa616efb
      Pushpinder Singh authored
      The calls to atmi_memcpy presently determine the direction of copy (host to
      device or device to host) by storing pointers in a map during malloc and
      looking up the pointers during memcpy. As each call site already knows the
      direction, this stash+lookup can be eliminated.
      
      This NFC will be followed by a functional one that deletes those map lookups.
      
      Reviewed By: JonChesterfield
      
      Differential Revision: https://reviews.llvm.org/D89776
      
      Change-Id: I1d9089bc1e56b3a9a30e334735fa07dee1f84990
      aa616efb
    • Carl Ritson's avatar
      [AMDGPU] Remove fix up operand from SI_ELSE · be2afbd0
      Carl Ritson authored
      Remove immediate operand from SI_ELSE which indicates if EXEC has
      been modified.  Instead always emit code that handles EXEC and
      remove unnecessary instructions during pre-RA optimisation.
      
      This facilitates passes (i.e. SIWholeQuadMode) adding exec mask
      manipulation post control flow lowering, and pre control flow
      lower passes do not need to be aware of SI_ELSE handling.
      
      Reviewed By: nhaehnle
      
      Differential Revision: https://reviews.llvm.org/D89644
      be2afbd0
    • Aleksandr Platonov's avatar
      [clangd][remote] Add Windows paths support · d99b2a97
      Aleksandr Platonov authored
      Without this patch 6 marshalling tests fail on Windows.
      This patch contains the following changes:
      - Allow paths with Windows slashes (convert to the POSIX style instead of assertion)
      - Add support for URI with Windows path.
      - Change the value of the second parameter of several `llvm::sys::path::convert_to_slash()` calls: we should use `windows` instead of `posix` to ensure UNIX slashes in the path.
      - Port `RemoteMarshallingTest::IncludeHeaderURI` test to Windows.
      
      Reviewed By: kbobyrev
      
      Differential Revision: https://reviews.llvm.org/D89529
      d99b2a97