1. Jun 12, 2024
    • Louis Dionne's avatar
      [libc++] Simplify the definition of string::operator== (#95000) · 6faae130
      Louis Dionne authored
      Instead of hardcoding a loop for small strings, always call
      char_traits::compare which ends up desugaring to __builtin_memcmp.
      
      Note that the original code dates back 11 years, when we didn't lower to
      intrinsics in `char_traits::compare`.
      
      Fixes #94222
      6faae130
    • Louis Dionne's avatar
    • Louis Dionne's avatar
      [libc++] Tweak how we check constraints on shared_ptr(nullptr_t) (#94996) · 16f2aa1a
      Louis Dionne authored
      This avoids breaking code that should arguably be valid but technically
      isn't after enforcing the constraints on shared_ptr's constructors. A
      new LWG issue was filed to fix this in the Standard.
      
      This patch applies the expected resolution of this issue to avoid
      flip-flopping users whose code should always be considered valid.
      
      See #93071 for more context.
      16f2aa1a
    • Dave Lee's avatar
      [lldb] Fix declaration of thread argument in CommandObjectThreadStepWithTypeAndScope (#95146) · 982b4b6f
      Dave Lee authored
      `thread step-in` (and other step commands) take a `<thread-index>`, not a `<thread-id>`.
      982b4b6f
    • Vyacheslav Levytskyy's avatar
      [SPIR-V] Validate and fix bit width of scalar registers (#95147) · 163d036d
      Vyacheslav Levytskyy authored
      This PR improves legalization process of SPIR-V instructions. Namely, it
      introduces validation and fixing of bit width of scalar registers as a
      part of pre-legalizer. A test case is added that demonstrates ability to
      legalize instructions with non 8/16/32/64 bit width both with and
      without vendor-specific SPIR-V extension
      (SPV_INTEL_arbitrary_precision_integers). In the case of absence of the
      extension, a generated SPIR-V code will fallback to 8/16/32/64 bit width
      in OpTypeInt, but SPIR-V Backend still is able to legalize operations
      with original integer sizes.
      163d036d
    • Daniel Bertalan's avatar
      [lld-macho] Fix duplicate GOT entries for personality functions (#95054) · 6afbda71
      Daniel Bertalan authored
      As stated in `UnwindInfoSectionImpl::prepareRelocations`'s comments, the
      unwind info uses section+addend relocations for personality functions
      defined in the same file as the function itself. As personality
      functions are always accessed via the GOT, we need to resolve those to a
      symbol. Previously, we did this by keeping a map which resolves these to
      symbols, creating a synthetic symbol if we didn't find it in the map.
      
      This approach has an issue: if we process the object file containing the
      personality function before any external uses, the entry in the map
      remains unpopulated, so we create a synthetic symbol and a corresponding
      GOT entry. If we encounter a relocation to it in a later file which
      requires GOT (such as in `__eh_frame`), we add that symbol to the GOT,
      too, effectively creating two entries which point to the same piece of
      code.
      
      This commit fixes that by searching the personality function's section
      for a symbol at that offset which already has a GOT entry, and only
      creating a synthetic symbol if there is none. As all non-unwind sections
      are already processed by this point, it ensures no duplication.
      
      This should only really affect our tests (and make them clearer), as
      personality functions are usually defined in platform runtime libraries.
      Or even if they are local, they are likely not in the first object file
      to be linked.
      6afbda71
    • Vyacheslav Levytskyy's avatar
      [SPIR-V] Implement insertion of OpGenericCastToPtr using builtin functions (#95055) · 57520985
      Vyacheslav Levytskyy authored
      This PR implements insertion of OpGenericCastToPtr using builtin
      functions (both opencl `to_global|local|private` and `__spirv_`
      wrappers), and improves type inference.
      57520985
    • Vyacheslav Levytskyy's avatar
      [SPIR-V] Ensure that DuplicatesTracker is working with TypedPointers pointee types (#94952) · 65614605
      Vyacheslav Levytskyy authored
      This PR is a tweak to ensure that DuplicatesTracker is working with
      TypedPointers pointee types rather than with original llvm's untyped
      pointers. This enforces DuplicatesTracker promise to avoid emission of
      several identical OpTypePointer instructions.
      65614605
    • Peiming Liu's avatar
    • Kazu Hirata's avatar
      [ProfileData] Simplify InstrProfValueSiteRecord (NFC) (#95143) · 3af35251
      Kazu Hirata authored
      std::list default-constructs itself as an empty list, so we don't need
      to call ValueData.clear() in the constructor.
      3af35251
    • Ramkumar Ramachandra's avatar
      LAA: refactor analyzeLoop to return bool (NFC) (#93824) · 18a8983c
      Ramkumar Ramachandra authored
      Avoid wastefully setting CanVecMem in several places in analyzeLoop,
      complicating the logic, to get the function to return a bool, and set
      CanVecMem in the caller.
      18a8983c
    • Paschalis Mpeis's avatar
      [BOLT][AArch64] Implement PLTCall optimization (#93584) · a13bc971
      Paschalis Mpeis authored
      `convertCallToIndirectCall` applies the PLTCall optimization and returns
      an (updated if needed) iterator to the converted call instruction. Since
      AArch64 requires to inject additional instructions to implement this
      pass, the relevant BasicBlock and an iterator was passed to the
      `convertCallToIndirectCall`.
      
      `NumCallsOptimized` is updated only on successful application of the
      pass.
      
      Tests:
      - Inputs/plt-tailcall.c: an example of a tail call optimized PLT call.
      - AArch64/plt-call.test: it is the actual A64 test, that runs the
      PLTCall optimization on the above input file and verifies the
      application of the pass to the calls: 'printf' and 'puts'.
      a13bc971
    • Michal Paszkowski's avatar
      [SPIR-V] Don't change switch condition type in CodeGen opts (#94959) · ca638607
      Michal Paszkowski authored
      This change makes sure the preferred switch condition int type size
      remains the same throughout CodeGen optimizations.
      
      The change fixes running several OpenCL applications with -O2 or higher
      opt levels, and fixes Basic/stream/stream_max_stmt_exceed.cpp DPC++ E2E
      test with -O2.
      ca638607
    • Nico Weber's avatar
      [clang] Fix a few comment typos to cycle bots · 9b4f8acf
      Nico Weber authored
      9b4f8acf
    • Maksim Panchenko's avatar
      [BOLT] Add auto parsing for Linux kernel .altinstructions (#95068) · 540893e4
      Maksim Panchenko authored
      .altinstructions section contains a list of structures where fields can
      have different sizes while other fields could be present or not
      depending on the kernel version. Add automatic detection of such
      variations and use it by default. The user can still overwrite the
      automatic detection with `--alt-inst-has-padlen` and
      `--alt-inst-feature-size` options.
      540893e4
    • Pavel Labath's avatar
      [lldb/DWARF] Remove some dead code (#95127) · 56f668c1
      Pavel Labath authored
      `GetDeclContextDIEs` and `DIEDeclContextsMatch` are unused (possibly
      since we added support for simplified template names, but I haven't
      checked). `GetDeclContextDIEs` is also very similar (but subtly
      different) from `GetDeclContext` and `GetTypeLookupContext`.
      
      I am keeping `GetParentDeclContextDIE` as that one still has some
      callers, but I want to look into the possibility of merging it with at
      least one of the functions mentioned above.
      56f668c1
    • Sayhaan Siddiqui's avatar
      [BOLT][DWARF][NFC] Remove old GDB Index functions (#95019) · 727ecbee
      Sayhaan Siddiqui authored
      Remove old usages of GDB Index functions after replacing them with new
      ones.
      727ecbee
    • geza-herman's avatar
      [clangd] Make it possible to enable misc-const-correctness clang-tidy check (#94920) · 1c59362e
      geza-herman authored
      Before this PR, clangd forcefully disabled misc-const-correctness in
      disableUnusableChecks().
      
      Now we have a FastCheckFilter configuration whose default value
      (Strict) also disables it. This patch removes misc-const-correctness
      from disableUnusableChecks() so it's possible to enable by setting
      FastCheckFilter to None.
      
      Fixes https://github.com/llvm/llvm-project/issues/89758
      1c59362e
    • Valentin Clement (バレンタイン クレメン)'s avatar
      [flang] Fix character scalar result for REDUCE intrinsic call (#95076) · 27f3ac59
      The character reduce runtime functions expect a pointer to a scalar
      character of the correct length for the result of character reduce. A
      descriptor was passed so far. Fix the lowering so a proper temporary is
      created and passed to the runtime.
      27f3ac59
    • Tomas Matheson's avatar
      [Tablegen][NFC] Add a check for duplicate features (#94223) · 41f81ad7
      Tomas Matheson authored
      We hit this downstream and the only evidence of the mistake was that the
      results of `Find` on `SubtargetFeatureKV` were corrupted.
      41f81ad7
    • Arthur Eubanks's avatar
      [CGSCC] Fix compile time blowup with large RefSCCs (#94815) · 71497cc7
      Arthur Eubanks authored
      In some modules, e.g. Kotlin-generated IR, we end up with a huge RefSCC
      and the call graph updates done as a result of the inliner take a long
      time. This is due to RefSCC::removeInternalRefEdges() getting called
      many times, each time removing one function from the RefSCC, but each
      call to removeInternalRefEdges() is proportional to the size of the
      RefSCC.
      
      There are two places that call removeInternalRefEdges(), in
      updateCGAndAnalysisManagerForPass() and
      LazyCallGraph::removeDeadFunction().
      
      1) Since LazyCallGraph can deal with spurious (edges that exist in the
      graph but not in the IR) ref edges, we can simply not call
      removeInternalRefEdges() in updateCGAndAnalysisManagerForPass().
      
      2) LazyCallGraph::removeDeadFunction() still ends up taking the brunt of
      compile time with the above change for the original reason. So instead
      we batch all the dead function removals so we can call
      removeInternalRefEdges() just once. This requires some changes to
      callers of removeDeadFunction() to not actually erase the function from
      the module, but defer it to when we batch delete dead functions at the
      end of the CGSCC run, leaving the function body as "unreachable" in the
      meantime. We still need to ensure that call edges are accurate. I had
      also tried deleting dead functions after visiting a RefSCC, but deleting
      them all at once at the end was simpler.
      
      Many test changes are due to not performing unnecessary revisits of an
      SCC (the CGSCC infrastructure deems ref edge refinements as unimportant
      when it comes to revisiting SCCs, although that seems to not be
      consistently true given these changes) because we don't remove some ref
      edges. Specifically for devirt-invalidated.ll this seems to expose an
      inlining order issue with the inliner. Probably unimportant for this
      type of intentionally weird call graph.
      
      Compile time:
      https://llvm-compile-time-tracker.com/compare.php?from=6f2c61071c274a1b5e212e6ad4114641ec7c7fc3&to=b08c90d05e290dd065755ea776ceaf1420680224&stat=instructions:u
      71497cc7
    • David Parks's avatar
    • Jay Foad's avatar
      [test] Skip some tests on Windows only (#95095) · 5ccdce95
      Jay Foad authored
      These tests pass on Linux using lit's internal shell.
      5ccdce95
    • Felipe de Azevedo Piovezan's avatar
      [lldb] Skip TestAttachDenied under asan · 2e007b89
      Felipe de Azevedo Piovezan authored
      Like many other tests, this one times out when run under the address sanitizer.
      To reduce noise, this commit skips it in those builds.
      2e007b89
    • Fangrui Song's avatar
      [MC] Replace fragment ilist with singly-linked lists · de19f7b6
      Fangrui Song authored
      Fragments are allocated with `operator new` and stored in an ilist with
      Prev/Next/Parent pointers. A more efficient representation would be an
      array of fragments without the overhead of Prev/Next pointers.
      
      As the first step, replace ilist with singly-linked lists.
      
      * `getPrevNode` uses have been eliminated by previous changes.
      * The last use of the `Prev` pointer remains: for each subsection, there is an insertion point and
        the current insertion point is stored at `CurInsertionPoint`.
      * `HexagonAsmBackend::finishLayout` needs a backward iterator. Save all
        fragments within `Frags`. Hexagon programs are usually small, and the
        performance does not matter that much.
      
      To eliminate `Prev`, change the subsection representation to
      singly-linked lists for subsections and a pointer to the active
      singly-linked list. The fragments from all subsections will be chained
      together at layout time.
      
      Since fragment lists are disconnected before layout time, we can remove
      `MCFragment::SubsectionNumber` (https://reviews.llvm.org/D69411). The
      current implementation of `AttemptToFoldSymbolOffsetDifference` requires
      future improvement for robustness.
      
      Pull Request: https://github.com/llvm/llvm-project/pull/95077
      de19f7b6
    • Timm Bäder's avatar
      [clang][Interp] Fix visiting non-FieldDecl MemberExprs · 4cf607fa
      Timm Bäder authored
      Ignore the base and visit the Member decl like a regular DeclRefExpr.
      4cf607fa
    • Florian Mayer's avatar
      00c54749
  2. Jun 11, 2024