1. Feb 23, 2024
    • Jie Fu's avatar
      [mlir][test] Fix -Wunused-variable in PassBuilderCallbacksTest.cpp (NFC) · 4ebee956
      Jie Fu authored
      llvm-project/llvm/unittests/MIR/PassBuilderCallbacksTest.cpp:333:10:
      error: unused variable 'Ret' [-Werror,-Wunused-variable]
          bool Ret = MIR->parseMachineFunctions(*Mod, MMI);
               ^
      1 error generated.
      4ebee956
    • Joseph Huber's avatar
      [LinkerWrapper] Fix test after permitting NVPTX linker arguments · e3cab8fe
      Joseph Huber authored
      Summary:
      Forgot to change this after a previous patch altered its behaviour.
      e3cab8fe
    • Joseph Huber's avatar
      [Libomptarget][NFC] Remove concept of optional plugin functions (#82681) · 87b41082
      Joseph Huber authored
      Summary:
      Ever since the introduction of the new plugins we haven't exercised the
      concept of "optional" plugin functions. This is done in perparation for
      making the plugins use a static interface as it will greatly simplify
      the implementation if we assert that every function has the entrypoints.
      Currently some unsupported functions will just return failure or some
      other default value, so this shouldn't change anything.
      87b41082
    • Michael Liao's avatar
      bc5aba9d
    • Joseph Huber's avatar
      [Flang] Fix the test ordering of the GPU libraries · 018c9928
      Joseph Huber authored
      Summary:
      Turns out these are out of order
      018c9928
    • Joseph Huber's avatar
      [Clang][NVPTX] Allow passing arguments to the linker while standalone (#73030) · d5a15f31
      Joseph Huber authored
      Summary:
      We support standalone compilation for the NVPTX architecture using
      'nvlink' as our linker. Because of the special handling required to
      transform input files to cubins, as nvlink expects for some reason, we
      didn't use the standard AddLinkerInput method. However, this also meant
      that we weren't forwarding options passed with -Wl to the linker. Add
      this support in for the standalone toolchain path.
      
      Revived from https://reviews.llvm.org/D149978
      d5a15f31
    • Paul Kirth's avatar
      [clang][driver] Allow unaligned access on ARMv7 and higher by default (#82400) · e314622f
      Paul Kirth authored
      ARM's Clang and GCC embedded compilers default to allowing unaligned
      access for ARMv7+. This patch changes the Clang driver default to match.
      Users can opt out with `-mno-unaligned-access`.
      
      Fixes #59560
      e314622f
    • Mehdi Amini's avatar
      [MLIR] Fix LLVM dialect specification to use AnySignlessInteger instead of AnyInteger (#82694) · e2f08268
      Mehdi Amini authored
      LLVM IR does not support signed integer, the LLVM dialect was
      underspecified (likely unintentionally) and the AnyInteger constraint
      was overly lax.
      
      The arithmetic dialect is already consistently using AnySignlessInteger.
      e2f08268
    • Diego Caballero's avatar
      ae3e1427
    • Wentao Zhang's avatar
      [clang][CodeGen] Keep processing the rest of AST after encountering... · d4bfca3b
      Wentao Zhang authored
      [clang][CodeGen] Keep processing the rest of AST after encountering unsupported MC/DC expressions (#82464)
      
      Currently, upon seeing unsupported decisions (more than 6 conditions, or
      split nesting), the post-visitor hook dataTraverseStmtPost() returns a
      false. As a result, in the rest of tree even supported decisions will
      be skipped as well. Like in the below code:
      
      { // CompoundStmt
        a && b;           // 1: BinaryOperator (supported)
        a && foo(b && c); // 2: BinaryOperator (not yet supported due to split
                          //                    nesting)
        a && b;           // 3: BinaryOperator (supported)
      }
      
      Decision 3 will not be processed at all. And only one "Decision" region
      will be emitted. Compiler explorer example:
      https://godbolt.org/z/Px61sesoo
      
      We hope to process such cases and emit two "Decision" regions (1 and 3)
      in the above example.
      d4bfca3b
    • Nikita Popov's avatar
      [LSR] Clear SCEVExpander before calling DeleteDeadPHIs · 72763521
      Nikita Popov authored
      To avoid an assertion failure when an AssertingVH is removed,
      as reported in:
      https://github.com/llvm/llvm-project/pull/82362#issuecomment-1960067147
      
      Also remove an unnecessary use of SCEVExpanderCleaner.
      72763521
    • Joseph Huber's avatar
      [Flang] Fix test not updated after 'clang' case change · 3ed4b95b
      Joseph Huber authored
      Summary:
      The shared 'clang' code changed this slightly but did not update the
      flang test.
      3ed4b95b
    • Joseph Huber's avatar
      [libc] Rework the GPU build to be a regular target (#81921) · 47b7c91a
      Joseph Huber authored
      Summary:
      This is a massive patch because it reworks the entire build and
      everything that depends on it. This is not split up because various bots
      would fail otherwise. I will attempt to describe the necessary changes
      here.
      
      This patch completely reworks how the GPU build is built and targeted.
      Previously, we used a standard runtimes build and handled both NVPTX and
      AMDGPU in a single build via multi-targeting. This added a lot of
      divergence in the build system and prevented us from doing various
      things like building for the CPU / GPU at the same time, or exporting
      the startup libraries or running tests without a full rebuild.
      
      The new appraoch is to handle the GPU builds as strict cross-compiling
      runtimes. The first step required
      https://github.com/llvm/llvm-project/pull/81557 to allow the `LIBC`
      target to build for the GPU without touching the other targets. This
      means that the GPU uses all the same handling as the other builds in
      `libc`.
      
      The new expected way to build the GPU libc is with
      `LLVM_LIBC_RUNTIME_TARGETS=amdgcn-amd-amdhsa;nvptx64-nvidia-cuda`.
      
      The second step was reworking how we generated the embedded GPU library
      by moving it into the library install step. Where we previously had one
      `libcgpu.a` we now have `libcgpu-amdgpu.a` and `libcgpu-nvptx.a`. This
      patch includes the necessary clang / OpenMP changes to make that not
      break the bots when this lands.
      
      We unfortunately still require that the NVPTX target has an `internal`
      target for tests. This is because the NVPTX target needs to do LTO for
      the provided version (The offloading toolchain can handle it) but cannot
      use it for the native toolchain which is used for making tests.
      
      This approach is vastly superior in every way, allowing us to treat the
      GPU as a standard cross-compiling target. We can now install the GPU
      utilities to do things like use the offload tests and other fun things.
      
      Some certain utilities need to be built with 
      `--target=${LLVM_HOST_TRIPLE}` as well. I think this is a fine
      workaround as we
      will always assume that the GPU `libc` is a cross-build with a
      functioning host.
      
      Depends on https://github.com/llvm/llvm-project/pull/81557
      47b7c91a
    • Daniel Martinez's avatar
      Fix build on musl by including stdint.h (#81434) · 45fe67dd
      Daniel Martinez authored
      
      
      openmp fails to build on musl since it lacks the defines for int32_t
      
      Co-authored-by: default avatarDaniel Martinez <danielmartinez@cock.li>
      45fe67dd
    • LLVM GN Syncbot's avatar
      [gn build] Port df6f756a · 0eb64eeb
      LLVM GN Syncbot authored
      0eb64eeb
    • Zequan Wu's avatar
      Re-land [lldb-dap] Add support for data breakpoint. (#81909) · df6f756a
      Zequan Wu authored
      This implements functionality to handle DataBreakpointInfo request and
      SetDataBreakpoints request.
      
      Previous commit
      https://github.com/llvm/llvm-project/commit/8c56e78ec531f0e2460213c20fff869b6b7add99
      was reverted because setting 1 byte watchpoint failed in the new test on
      ARM64. So, I changed the test to setting 4 byte watchpoint instead, and
      hope this won't break it again. It also adds the fixes from
      https://github.com/llvm/llvm-project/pull/81680.
      df6f756a
    • Thomas Preud'homme's avatar
      Extend GCC workaround to GCC < 8.4 for llvm::iterator_range ctor (#82643) · 7f71fa90
      Thomas Preud'homme authored
      GCC SFINAE error with decltype was fixed in commit
      ac5e28911abdfb8d9bf6bea980223e199bbcf28d which made it into GCC 8.4.
      Therefore adjust GCC version test accordingly.
      7f71fa90
    • Arthur Eubanks's avatar
      [NewPM/CodeGen] Rewrite pass manager nesting (#81068) · 91e9e317
      Arthur Eubanks authored
      Currently the new PM infra for codegen puts everything into a
      MachineFunctionPassManager. The MachineFunctionPassManager owns both
      Module passes and MachineFunction passes, and batches adjacent
      MachineFunction passes like a typical PassManager.
      
      The current MachineFunctionAnalysisManager also directly references a
      module and function analysis manager to get results.
      
      The initial argument was that the codegen pipeline is relatively "flat",
      meaning it's mostly machine function passes with a couple of module
      passes here and there. However, there are a couple of issues with this
      as compared to a more structured nesting more like the optimization
      pipeline. For example, it doesn't allow running function passes then
      machine function passes on a function and its machine function all at
      once. It also currently requires the caller to split out the IR passes
      into one pass manager and the MIR passes into another pass manager.
      
      This patch rewrites the new pass manager infra for the codegen pipeline
      to be more similar to the nesting in the optimization pipeline.
      Basically, a Function contains a MachineFunction. So we can have Module
      -> Function -> MachineFunction adaptors. It also rewrites the analysis
      managers to have inner/outer proxies like the ones in the optimization
      pipeline. The new pass managers/adaptors/analysis managers can be seen
      in use in PassManagerTest.cpp.
      
      This allows us to consolidate to just having to add to one
      ModulePassManager when using the codegen pipeline.
      
      I haven't added the Function -> MachineFunction adaptor in this patch,
      but it should be added when we merge AddIRPass/AddMachinePass so that we
      can run IR and MIR passes on a function before proceeding to the next
      function.
      
      The MachineFunctionProperties infra for MIR verification is still WIP.
      91e9e317
    • Diego Caballero's avatar
      [mlir][Vector] Fix bug in vector xfer op flattening transformation (#81964) · 847048f4
      Diego Caballero authored
      It looks like the affine map generated to compute the indices of the
      collapsed dimensions used the wrong dim size. For indices `[idx0][idx1]`
      we computed the collapsed index as `idx0*size0 + idx1` instead of
      `idx0*size1 + idx1`. This led to correctness issues in convolution tests
      when enabling this transformation internally.
      847048f4
    • Chris B's avatar
      [HLSL][Doc] Add doc about expected differences (#82395) · 66f6929f
      Chris B authored
      
      
      This document covers expected differences between Clang and the HLSL
      reference compiler implementations (FXC & DXC). The document is not
      intended to be exhaustive, but it should be a best effort to cover known
      cases.
      
      This document should document both the behavioral difference and the
      explanation of why Clang differs.
      
      The initail document covers known overload resolution differences.
      
      ---------
      
      Co-authored-by: default avatarS. Bharadwaj Yadavalli <Bharadwaj.Yadavalli@microsoft.com>
      66f6929f
    • Matthias Gehre's avatar
      [TOSA] TosaToLinalg: fix int64_t min/max lowering of clamp (#82641) · c1e9883a
      Matthias Gehre authored
      
      
      tosa.clamp takes `min`/`max` attributes as i64, so ensure that the
      lowering to linalg works for the whole range.
      
      Co-authored-by: default avatarTiago Trevisan Jost <tiago.trevisanjost@amd.com>
      c1e9883a
    • Ramkumar Ramachandra's avatar
      LoopVectorize/test: guard pr72969 with asserts (#82653) · f5c8e9e5
      Ramkumar Ramachandra authored
      Follow up on 695a9d84 (LoopVectorize: add test for crash in #72969) to
      guard pr72969.ll with REQUIRES: asserts, in order to be reasonably
      confident that it will crash reliably.
      f5c8e9e5
    • Jorge Gorbe Moya's avatar
      [bazel] add missing dep after 5b079af1 · 3b20fb33
      Jorge Gorbe Moya authored
      3b20fb33
    • Yingwei Zheng's avatar
      [InstCombine] Add support for cast instructions in `getFreelyInvertedImpl` (#82451) · e88c2553
      Yingwei Zheng authored
      This patch adds support for cast instructions in `getFreelyInvertedImpl`
      to enable more optimizations.
      Alive2: https://alive2.llvm.org/ce/z/F6maEE
      e88c2553
    • Jordan Rupprecht's avatar
    • Alexey Bataev's avatar
      [SLP]Improve findReusedOrderedScalars and graph rotation. · 32994cc0
      Alexey Bataev authored
      Patch syncs the code in findReusedOrderedScalars with cost
      estimation/codegen. It tries to use similar logic to better determine
      best order.
      Before, it just tried to find previously vectorized node without
      checking if it is possible to use the vectorized value in the shuffle.
      Now it relies on the more generalized version. If it determines, that
      a single vector must be reordered (using same mechanism, as codegen and
      cost estimation), it generates better order.
      
      The comparison between new/ref ordering:
      
      Metric: SLP.NumVectorInstructions
      
      Program                                                                                                                                                SLP.NumVectorInstructions
                                                                                                                                                             results                   results0 diff
                                                                                                     test-suite :: MultiSource/Benchmarks/nbench/nbench.test   139.00                    140.00   0.7%
                                                                                   test-suite :: MultiSource/Benchmarks/DOE-ProxyApps-C++/miniFE/miniFE.test   344.00                    346.00   0.6%
                                                                                              test-suite :: MultiSource/Benchmarks/FreeBench/pifft/pifft.test  1293.00                   1292.00  -0.1%
                                                                                      test-suite :: External/SPEC/CFP2017rate/511.povray_r/511.povray_r.test  5176.00                   5170.00  -0.1%
                                                                                              test-suite :: External/SPEC/CFP2006/453.povray/453.povray.test  5173.00                   5167.00  -0.1%
                                                                                      test-suite :: External/SPEC/CFP2017rate/510.parest_r/510.parest_r.test 11692.00                  11660.00  -0.3%
                                                                                           test-suite :: External/SPEC/CINT2006/464.h264ref/464.h264ref.test  1621.00                   1615.00  -0.4%
                                                                                                   test-suite :: External/SPEC/CINT2006/403.gcc/403.gcc.test   795.00                    792.00  -0.4%
                                                                                    test-suite :: External/SPEC/CFP2017rate/526.blender_r/526.blender_r.test 26499.00                  26338.00  -0.6%
                                                                                                     test-suite :: MultiSource/Benchmarks/Bullet/bullet.test  7343.00                   7281.00  -0.8%
                                                                                                test-suite :: MultiSource/Applications/JM/ldecod/ldecod.test  1104.00                   1094.00  -0.9%
                                                                                                test-suite :: MultiSource/Applications/JM/lencod/lencod.test  2216.00                   2180.00  -1.6%
                                                                                                  test-suite :: External/SPEC/CFP2006/433.milc/433.milc.test   787.00                    637.00 -19.1%
      
      Less 0% is better.
      Most of the benchmarks see more vectorized code. The first ones just
      have shuffles removed.
      
      The ordering analysis still may require some improvements (e.g. for
      alternate nodes), but this one should be produce better results.
      
      Reviewers: RKSimon
      
      Reviewed By: RKSimon
      
      Pull Request: https://github.com/llvm/llvm-project/pull/77529
      32994cc0
    • Benjamin Kramer's avatar
      3168af56
    • Benjamin Kramer's avatar
    • Florian Mayer's avatar
      [scudo] increase frames per stack to 16 for stack depot (#82427) · 6ddb25ed
      Florian Mayer authored
      8 was very low and it is likely that in real workloads we have more than
      an average of 8 frames per stack given on Android we have 3 at the
      bottom: __start_main, __libc_init, main, and three at the top: malloc,
      scudo_malloc and Allocator::allocate. That leaves 2 frames for
      application code, which is clearly unreasonable.
      6ddb25ed
    • Nashe Mncube's avatar
      [AArch64][CodeGen] Fix crash when fptrunc returns fp16 with +nofp attr (#81724) · 744c0057
      Nashe Mncube authored
      When performing lowering of the fptrunc opcode returning fp16 with the
      +nofp flag enabled we could trigger a compiler crash. This is because we
      had no custom lowering implemented. This patch 
      the case in which we need to promote an fp16 return type
      for fptrunc when the +nofp attr is enabled.
      744c0057
    • Boian Petkantchin's avatar
      [mlir][mesh] add support in spmdization for incomplete sharding annotations (#82442) · 4f7ab789
      Boian Petkantchin authored
      Don't require that `mesh.shard` operations come in pairs. If there is
      only a single `mesh.shard` operation we assume that the producer result
      and consumer operand have the same sharding.
      4f7ab789
    • Alexander Shaposhnikov's avatar
      Enable JumpTableToSwitch pass by default (#82546) · 1069823c
      Alexander Shaposhnikov authored
      Enable JumpTableToSwitch pass by default.
      
      Test plan: ninja check-all
      1069823c
    • Yaxun (Sam) Liu's avatar
      [HIP] Allow partial linking for `-fgpu-rdc` (#81700) · 33a6ce18
      Yaxun (Sam) Liu authored
      `-fgpu-rdc` mode allows device functions call device functions in
      different TU. However, currently all device objects have to be linked
      together since only one fat binary is supported. This is time consuming
      for AMDGPU backend since it only supports LTO.
      
      There are use cases that objects can be divided into groups in which
      device functions are self-contained but host functions are not. It is
      desirable to link/optimize/codegen the device code and generate a fatbin
      for each group, whereas partially link the host code with `ld -r` or
      generate a static library by using the `--emit-static-lib` option of
      clang. This avoids linking all device code together, therefore decreases
      the linking time for `-fgpu-rdc`.
      
      Previously, clang emits an external symbol `__hip_fatbin` for all
      objects for `-fgpu-rdc`. With this patch, clang emits an unique external
      symbol `__hip_fatbin_{cuid}` for the fat binary for each object. When a
      group of objects are linked together to generate a fatbin, the symbols
      are merged by alias and point to the same fat binary. Each group has its
      own fat binary. One executable or shared library can have multiple fat
      binaries. Device linking is done for undefined fab binary symbols only
      to avoid repeated linking. `__hip_gpubin_handle` is also uniquefied and
      merged to avoid repeated registering. Symbol `__hip_cuid_{cuid}` is
      introduced to facilitate debugging and tooling.
      
      Fixes: https://github.com/llvm/llvm-project/issues/77018
      33a6ce18
    • Yingwei Zheng's avatar
      [CVP] Canonicalize signed minmax into unsigned (#82478) · cc839275
      Yingwei Zheng authored
      This patch turns signed minmax to unsigned to match the behavior for
      signed icmps.
      Alive2: https://alive2.llvm.org/ce/z/UAAM42
      cc839275
    • Vlad Serebrennikov's avatar
      [clang] Implement CWG2759 "`[[no_unique_address]` and common initial sequence" (#82607) · 5c24c316
      Vlad Serebrennikov authored
      This patch implements said defect report resolution by adding additional
      check to common initial sequence evaluation. Consequently, this fixes
      CWG2759.
      5c24c316
    • Kevin Frei's avatar
      GSym aggregated output to JSON file (#81763) · da1880cc
      Kevin Frei authored
      In order to make tooling around dwarf health easier, I've added an
      `--json-summary-file` option to `llvm-gsymutil` that will spit out error
      summary data with counts to a JSON file.
      
      I've added the same capability to `llvm-dwarfdump` in a [different
      PR.](https://github.com/llvm/llvm-project/pull/81762
      
      )
      
      The format of the json is:
      ```JSON
      { 
        "error-categories": { 
          "<first category description>": {"count": 1234},
          "<next category description>": {"count":4321}
        },
        "error-count": 5555
      }
      ```
      for a clean run:
      ```JSON
      { 
        "error-categories": {},
        "error-count": 0
      }
      ```
      
      ---------
      
      Co-authored-by: default avatarKevin Frei <freik@meta.com>
      da1880cc
    • Greg Clayton's avatar
      [lldb][llvm] Return an error instead of crashing when parsing a line table prologue. (#80769) · a23d4ceb
      Greg Clayton authored
      We recently ran into some bad DWARF where the `DW_AT_stmt_list` of many
      compile units was randomly set to invalid values and was causing LLDB to
      crash due to an assertion about address sizes not matching. Instead of
      asserting, we should return an appropriate recoverable `llvm::Error`.
      a23d4ceb
    • Emilia Kond's avatar
      [clang-format] Fix crash in TokenAnnotator (#82349) · 2e7cacfc
      Emilia Kond authored
      The while loop on line 3814 can cause a segmentation fault getting the
      Next field on a nullptr. This is because further down, on line 3823,
      there is another for loop, which assigns Tok to Tok->Next in its
      initializer. This for loop has a condition to check if the result of
      that isn't null. If it is, the loop is skipped and we drop back out to
      the outer loop, except, now Tok is null, and we try to dereference it
      without checking first.
      
      This patch adds a defensive check that returns if Tok->Next is null
      before we make it to the second for loop.
      
      Fixes https://github.com/llvm/llvm-project/issues/82328
      
      
      
      ---------
      
      Co-authored-by: default avatarOwen Pan <owenpiano@gmail.com>
      2e7cacfc
    • S. Bharadwaj Yadavalli's avatar
      [DirectX][NFC] Use LLVM Types in DXIL Operation specifications in DXIL.td (#81692) · 54a6cf15
      S. Bharadwaj Yadavalli authored
      This change uniformly uses LLVM Types in the specification of parameter
      types and overload types of DXIL operation.
      
      Updated (a) parameter types accordingly in the specification of existing
      DXILOperations and (b) DXILEmitter.
      54a6cf15
    • Igor Kudrin's avatar
      [LTO] Remove Config.UseDefaultPipeline (#82587) · ec24094b
      Igor Kudrin authored
      This option is not used. It was added in
      [D122133](https://reviews.llvm.org/D122133), 5856f30b, with the only
      usage in `ClangLinkerWrapper.cpp`, which was later updated in a1d57fc2,
      and then finally removed in [D142650](https://reviews.llvm.org/D142650),
      6185246f.
      ec24094b