1. Jun 22, 2023
    • Vitaly Buka's avatar
      [NFC][sanitizer] Add OnMapSecondary callback · 38dfcf96
      Vitaly Buka authored
      Now it implemented as OnMap everywhere, but in follow up patches
      we can optimize Asan handler.
      38dfcf96
    • Florian Hahn's avatar
      [PhaseOrdering] Add test showing mis-compile caused by 17fdaccc. · 04a7c672
      Florian Hahn authored
      The test shows a mis-compile where @test gets incorrectly simplified to
      unreachable. The test case is reduced from a ThinLTO build of Clang,
      with only the relevant pass sequence included.
      04a7c672
    • Vitaly Buka's avatar
      [NFC][sanitizer] Remove MapUnmapCallback from sanitizer_flat_map.h · 42adbb1b
      Vitaly Buka authored
      It's used by test only to test "test-only" code.
      42adbb1b
    • Shubham Sandeep Rastogi's avatar
      Emit DW_LLE_base_address + DW_LLE_offset_pair for DWARF v5 · e734a12b
      Shubham Sandeep Rastogi authored
      This patch tries to reduce the size of the debug_loclist section by
      replacing the DW_LLE_start_length opcodes currently emitted by dsymutil
      in favor of using DW_LLE_base_address + DW_LLE_offset_pair instead.
      
      The DW_LLE_start_length is one AddressSize followed by a ULEB per entry,
      whereas, the DW_LLE_base_address + DW_LLE_offset_pair will use one
      AddressSize for the base address, and then the DW_LLE_offset_pair is a
      pair of ULEBs. This will be more efficient where a loclist fragment has
      many entries.
      
      Differential Revision: https://reviews.llvm.org/D153080
      e734a12b
    • Guozhi Wei's avatar
      [MBP] Enable duplicating return block to remove jump to return · 1bcb6a3d
      Guozhi Wei authored
      Sometimes LLVM generates branch to return instruction, like PR63227.
      
      It is because in function MachineBlockPlacement::canTailDuplicateUnplacedPreds
      we avoid duplicating a BB into another already placed BB to prevent destroying
      computed layout. But if the successor BB is a return block, duplicating it will
      only reduce taken branches without hurt to any other branches.
      
      Differential Revision: https://reviews.llvm.org/D153093
      1bcb6a3d
    • Vitaly Buka's avatar
      [NFC][asan] Move AsanStats update · c1722104
      Vitaly Buka authored
      Deallocate is a more appropiate place to update free count.
      c1722104
    • LLVM GN Syncbot's avatar
      [gn build] Port 1ee4d880 · d036bf07
      LLVM GN Syncbot authored
      d036bf07
    • Tim Besard's avatar
      NVPTX: Lower unreachable to exit to allow ptxas to accurately reconstruct the CFG. · 1ee4d880
      Tim Besard authored
      PTX does not have a notion of `unreachable`, which results in emitted basic
      blocks having an edge to the next block:
      
      ```
      block1:
        call @does_not_return();
        // unreachable
      block2:
        // ptxas will create a CFG edge from block1 to block2
      ```
      
      This may result in significant changes to the control flow graph, e.g., when
      LLVM moves unreachable blocks to the end of the function. That's a problem
      in the context of divergent control flow, as `ptxas` uses the CFG to determine
      divergent regions, while some intructions may not be executed divergently.
      
      For example, `bar.sync` is not allowed to be executed divergently on Pascal
      or earlier. If we start with the following:
      
      ```
      entry:
        // start of divergent region
        @%p0 bra cont;
        @%p1 bra unlikely;
        ...
        bra.uni cont;
      unlikely:
        ...
        // unreachable
      cont:
        // end of divergent region
        bar.sync 0;
        bra.uni exit;
      exit:
        ret;
      ```
      
      it is transformed by the branch-folder and block-placement passes to:
      
      ```
      entry:
        // start of divergent region
        @%p0 bra cont;
        @%p1 bra unlikely;
        ...
        bra.uni cont;
      cont:
        bar.sync 0;
        bra.uni exit;
      unlikely:
        ...
        // unreachable
      exit:
        // end of divergent region
        ret;
      ```
      
      After moving the `unlikely` block to the end of the function, it has an edge
      to the `exit` block, which widens the divergent region and makes the `bar.sync`
      instruction happen divergently. That causes wrong computations, as we've been
      running into for years with Julia code (which emits a lot of `trap` +
      `unreachable` code all over the place).
      
      To work around this, add an `exit` instruction before every `unreachable`,
      as `ptxas` understands that exit terminates the CFG. Note that `trap` is not
      equivalent, and only future versions of `ptxas` will model it like `exit`.
      Another alternative would be to emit a branch to the block itself, but emitting
      `exit` seems like a cleaner solution to represent `unreachable` to me.
      
      Also note that this may not be sufficient, as it's possible that the block
      with unreachable control flow is branched to from different divergent regions,
      e.g. after block merging, in which case it may still be the case that `ptxas`
      could reconstruct a CFG where divergent regions are merged (I haven't confirmed
      this, but also haven't encountered this pattern in the wild yet):
      
      ```
      entry:
        // start of divergent region 1
        @%p0 bra cont1;
        @%p1 bra unlikely;
        bra.uni cont1;
      cont1:
        // intended end of divergent region 1
        bar.sync 0;
        // start of divergent region 2
        @%p2 bra cont2;
        @%p3 bra unlikely;
        bra.uni cont2;
      cont2:
        // intended end of divergent region 2
        bra.uni exit;
      unlikely:
        ...
        exit;
      exit:
        // possible end of merged divergent region?
      ```
      
      I originally tried to avoid the above by cloning paths towards `unreachable` and
      splitting the outgoing edges, but that quickly became too complicated. I propose
      we go with the simple solution first, also because modern GPUs with more flexible
      hardware thread schedulers don't even suffer from this issue.
      
      Finally, although I expect this to fix most of
      https://bugs.llvm.org/show_bug.cgi?id=27738, I do still encounter
      miscompilations with Julia's unreachable-heavy code when targeting these
      older GPUs using an older `ptxas` version (specifically, from CUDA 11.4 or
      below). This is likely due to related bugs in `ptxas` which have been fixed
      since, as I have filed several reproducers with NVIDIA over the past couple of
      years. I'm not inclined to look into fixing those issues over here, and will
      instead be recommending our users to upgrade CUDA to 11.5+ when using these GPUs.
      
      Also see:
      - https://github.com/JuliaGPU/CUDAnative.jl/issues/4
      - https://github.com/JuliaGPU/CUDA.jl/issues/1746
      - https://discourse.llvm.org/t/llvm-reordering-blocks-breaks-ptxas-divergence-analysis/71126
      
      Reviewed By: jdoerfert, tra
      
      Differential Revision: https://reviews.llvm.org/D152789
      1ee4d880
    • Med Ismail Bennani's avatar
      [lldb] Fix failure in TestStackCoreScriptedProcess on x86_64 · 0c5b6320
      Med Ismail Bennani authored
      This patch should address the failure of TestStackCoreScriptedProcess
      that is happening specifically on x86_64.
      
      It turns out that in 1370a1cb, I changed the way we extract integers
      from a `StructuredData::Dictionary` and in order to get a stop info from
      the scripted process, we call a method that returns a `SBStructuredData`
      containing the stop reason data.
      
      TestStackCoreScriptedProcess` was failing specifically on x86_64 because
      the stop info dictionary contains the signal number, that the `Scripted
      Thread` was trying to extract as a signed integer where it was actually
      parsed as an unsigned integer. That caused `GetValueForKeyAsInteger` to
      return the default value parameter, `LLDB_INVALID_SIGNAL_NUMBER`.
      
      This patch address the issue by extracting the signal number with the
      appropriate type and re-enables the test.
      
      Differential Revision: https://reviews.llvm.org/D152848
      
      
      
      Signed-off-by: default avatarMed Ismail Bennani <ismail@bennani.ma>
      0c5b6320
    • cynecx's avatar
      [MC] Add .pushsection/.popsection support to COFFAsmParser · 63538a08
      cynecx authored
      The COFFAsmParser (to my surprise) didn't support the .pushsection and
      .popsection directives. These directives aren't directly useful, however for
      frontends that have inline asm support this is really useful. Rust in
      particular, has support for inline asm, which can be used together with these
      directives to "emulate" features like static generics. This patch adds support
      for the two mentioned directives.
      
      Reviewed By: MaskRay
      
      Differential Revision: https://reviews.llvm.org/D152085
      63538a08
    • Felipe de Azevedo Piovezan's avatar
      [lldb][MachO] Fix section type recognition for new DWARF 5 sections · 1704c8d1
      Felipe de Azevedo Piovezan authored
      When LLDB needs to access a debug section, it generally calls
      SectionList::FindSectionByType with the corresponding type (we have one type for
      each DWARF section). However, the missing entries made some sections be
      classified as "eSectionTypeOther", which makes all calls to `FindSectionByType`
      fail.
      
      With this patch, a check-lldb build with
      `-DLLDB_TEST_USER_ARGS=--dwarf-version=5` reports a much lower number of
      failures:
      
        Unsupported      :  327
        Passed           : 2423
        Expectedly Failed:   16
        Unresolved       :    2
        Failed           :   52
      
      This is down from previously 400~ failures.
      
      Differential Revision: https://reviews.llvm.org/D153433
      1704c8d1
    • Stella Laurenzo's avatar
      Revert "Define/guard MLIR_STANDALONE_BUILD LLVM_LIBRARY_OUTPUT_INTDIR var." · 54db1624
      Stella Laurenzo authored
      This reverts commit f55fd19b.
      
      As noted on the original thread, other uses of LLVM_LIBRARY_OUTPUT_INTDIR are optional. Will make a separate patch that makes this use optional as well.
      54db1624
    • Alex Langford's avatar
      [lldb][NFCI] Remove ConstString from GDBRemoteCommunicationClient::ConfigureRemoteStructuredData · b4827a3c
      Alex Langford authored
      ConstString's benefits are not being utilized here, StringRef is
      sufficient.
      
      Differential Revision: https://reviews.llvm.org/D153177
      b4827a3c
    • Tom Eccles's avatar
      [flang][hlfir] fix missing conversion in transpose simplification · 74adc3e0
      Tom Eccles authored
      It seems just replacing the operation was not replacing all of the uses
      when the types of the expression before and after this pass differ (due
      to differing shape information). Now the shape information is always
      kept the same.
      
      This fixes https://github.com/llvm/llvm-project/issues/63399
      
      Differential Revision: https://reviews.llvm.org/D153333
      74adc3e0
    • Lorenzo Chelini's avatar
      [MLIR][Linalg] Rename `tile-to-foreach-thread.mlir` (NFC) · 9d796d05
      Lorenzo Chelini authored
      `ForeachThreadOp` was renamed to `ForallOp`, update the filename to
      avoid confusion.
      
      See: https://reviews.llvm.org/D144242
      9d796d05
    • Adam Paszke's avatar
      Fix a memory leak in the Python implementation of bytecode writer · 9816cc91
      Adam Paszke authored
      The bytecode writer config was heap-allocated, but was never freed, causing ASAN errors.
      
      Reviewed By: jpienaar
      
      Differential Revision: https://reviews.llvm.org/D153440
      9816cc91
    • Joseph Huber's avatar
      [libc] Rename and install the RPC server interface · e0b487bf
      Joseph Huber authored
      This patch prepares the RPC interface to be installed. We place this in
      the existing `llvm-gpu-none` directory as it will also give us access to
      the generated `libc` headers for the opcodes.
      
      Reviewed By: JonChesterfield
      
      Differential Revision: https://reviews.llvm.org/D153040
      e0b487bf
    • Luke Lau's avatar
      [RISCV] Custom lower fixed vector undef to scalable undef · 485d2500
      Luke Lau authored
      This avoids undefs from being expanded to a build vector of zeroes.
      As noted by @craig.topper in D153399
      
      Reviewed By: craig.topper
      
      Differential Revision: https://reviews.llvm.org/D153411
      485d2500
    • Joseph Huber's avatar
      [libc][NFC] Cleanup the RPC server implementation prior to installing · 4272d091
      Joseph Huber authored
      This does some simple cleanup prior to landing the patch to install
      these.
      
      Differential Revision: https://reviews.llvm.org/D153439
      4272d091
    • Petr Hosek's avatar
      [libcxx] Include <sys/time.h> in posix_compat.h · 037952f6
      Petr Hosek authored
      posix_compat.h uses struct timeval which is defined in <sys/time.h>
      but it doesn't include it. On most POSIX platforms like Linux or macOS,
      that headers is transitively included by other headers like <sys/stat.h>,
      but there are other platforms where this is not the case.
      
      Differential Revision: https://reviews.llvm.org/D153384
      037952f6
  2. Jun 21, 2023