1. May 12, 2022
  2. May 11, 2022
    • Matthias Braun's avatar
      Fix endless loop in optimizePhiConst with integer constant switch condition · de9ad98d
      Matthias Braun authored
      Avoid endless loop in degenerate case with an integer constant as switch
      condition as reported in https://reviews.llvm.org/D124552
      de9ad98d
    • Alban Bridonneau's avatar
      e6635377
    • python3kgae's avatar
      [DirectX backend] Add pass to emit dxil metadata. · 0c7f7f1b
      python3kgae authored
      A new pass DxilEmitMetadata is added to translate information saved in llvm ir into metadata to match DXIL spec.
      
      Only generate DXIL validator version in this PR.
      
      In llvm ir, validator version is saved in ModuleFlag with "dx.valver" as Key.
      
        !llvm.module.flags = !{!0, !1}
        !1 = !{i32 6, !"dx.valver", !2}
        !2 = !{i32 1, i32 1}
      
      DXIL validator version has major and minor versions that are specified as named metadata:
      
        !dx.valver = !{!2}
        !2 = !{i32 1, i32 7}
      
      Reviewed By: kuhar, beanz
      
      Differential Revision: https://reviews.llvm.org/D125158
      0c7f7f1b
    • Joe Nash's avatar
      [AMDGPU] gfx11 Decode wider instructions. NFC · a0a406b2
      Joe Nash authored
      Refactor to pass a templatized size parameter to the decoder to allow wider than
      64bit decodes in a later patch.
      
      Contributors:
      Jay Foad <jay.foad@amd.com>
      
      Depends on D125261
      
      Patch 5/N for upstreaming of AMDGPU gfx11 architecture.
      
      Reviewed By: dp
      
      Differential Revision: https://reviews.llvm.org/D125316
      a0a406b2
    • Florian Hahn's avatar
      [ConstraintElimination] Add test where ssub result is not used. · 301fe084
      Florian Hahn authored
      Extra tests for D125264.
      301fe084
    • Joe Nash's avatar
      [AMDGPU] gfx11 subtarget features & early tests · 18ed279a
      Joe Nash authored
      Tablegen definitions for subtarget features and cpp predicate functions to
      access the features.
      New Sub-TargetProcessors and common latencies.
      Simple changes to MIR codegen tests which pass on gfx11 because they have the
      same output as previous subtargets or operate on pseudo instructions which
      are reused from previous subtargets.
      
      Contributors:
      Jay Foad <jay.foad@amd.com>
      Petar Avramovic <Petar.Avramovic@amd.com>
      
      Patch 4/N for upstreaming of AMDGPU gfx11 architecture
      
      Depends on D124538
      
      Reviewed By: Petar.Avramovic, foad
      
      Differential Revision: https://reviews.llvm.org/D125261
      18ed279a
    • Shao-Ce SUN's avatar
      [RISCV] Remove some TODOs in tests · b049eb1f
      Shao-Ce SUN authored
      Reviewed By: asb
      
      Differential Revision: https://reviews.llvm.org/D125289
      b049eb1f
    • Nikita Popov's avatar
      [InstCombine] Freeze other uses of frozen value · 6001bfce
      Nikita Popov authored
      If there is a freeze %x, we currently replace all other uses of %x
      with freeze %x -- as long as they are dominated by the freeze
      instruction. This patch extends this behavior to cases where we
      did not originally dominate the use by moving the freeze
      instruction directly after the definition of the frozen value.
      
      The motivation can be seen in test @combine_and_after_freezing_uses:
      Canonicalizing everything to freeze %x allows folds that are based
      on value identity (i.e. same operand occurring in two places) to
      trigger. This also covers the case from D125248.
      
      Differential Revision: https://reviews.llvm.org/D125321
      6001bfce
    • Philip Reames's avatar
      [riscv] Prefer to use previous VL for scalar move instructionsK · cc0283a6
      Philip Reames authored
      This patch is an alternative to a piece of D125270. Its direct motivation is to fix a wrong code bug (described below), but somewhat unexpectedly, it also results in a significant code quality improvement for idiomatic fixed length vector patterns.
      
      The existing transform is simply wrong in its current location. We are correct about the fact that the scalar move itself can use the previous vsetvli, but we loose track of the fact that later instructions might depend on the state change represented. That is, the actual value of VL in the register is different than the abstract state thinks it is. Not simply due to precision of modeling, but e.g. the VL register could contain 3 when the abstract state says it is 1. This is annoying hard to demonstrate in practice due to differences in policy flags on the intrinsics, but this is at least a latent wrong code bug.
      
      The code quality benefit comes from the fact we don't need to tie this to explicit vsetvli instructions at all. We can propagate the abstract state, and reduce a) the number of transitions, or b) the cost of those transitions. It turns out we have a bunch of cases - in tests at least - where fixed length AVLs are known non-zero, and we can leave VL unchanged while changing VTYPE.
      
      Differential Revision: https://reviews.llvm.org/D125337
      cc0283a6
    • Matthias Springer's avatar
      [mlir][bufferize][NFC] Move helper functions to BufferizationOptions · 248e113e
      Matthias Springer authored
      Move helper functions for creating allocs/deallocs/memcpys to BufferizationOptions.
      
      Differential Revision: https://reviews.llvm.org/D125375
      248e113e
    • Louis Dionne's avatar
      [runtimes] Print the testing configuration in use in libunwind and libc++abi · c631e33f
      Louis Dionne authored
      We do it for libc++, and it's rather useful for debugging e.g. CI.
      c631e33f
    • Nico Weber's avatar
    • Joseph Huber's avatar
      [Clang] Introduce clang-offload-packager tool to bundle device files · 26eb0426
      Joseph Huber authored
      In order to do offloading compilation we need to embed files into the
      host and create fatbainaries. Clang uses a special binary format to
      bundle several files along with their metadata into a single binary
      image. This is currently performed using the `-fembed-offload-binary`
      option. However this is not very extensibile since it requires changing
      the command flag every time we want to add something and makes optional
      arguments difficult. This patch introduces a new tool called
      `clang-offload-packager` that behaves similarly to CUDA's `fatbinary`.
      This tool takes several input files with metadata and embeds it into a
      single image that can then be embedded in the host.
      
      Reviewed By: tra
      
      Differential Revision: https://reviews.llvm.org/D125165
      26eb0426
    • Matt Devereau's avatar
      [AArch64][SVE] Add aarch64_sve_pcs attribute to Clang · 75bb8152
      Matt Devereau authored
      Enable function attribute aarch64_sve_pcs at the C level, which correspondes to
      aarch64_sve_vector_pcs at the LLVM IR level.
      
      This requirement was created by this addition to the ARM C Language Extension:
      https://github.com/ARM-software/acle/pull/194
      
      Differential Revision: https://reviews.llvm.org/D124998
      75bb8152
    • Alexey Bataev's avatar
      [SLP]Further improvement of the cost model for scalars used in buildvectors. · f5d45d70
      Alexey Bataev authored
      Further improvement of the cost model for the scalars used in
      buildvectors sequences. The main functionality is outlined into
      a separate function.
      The cost is calculated in the following way:
      1. If the Base vector is not undef vector, resizing the very first mask to
      have common VF and perform action for 2 input vectors (including non-undef
      Base). Other shuffle masks are combined with the resulting after the 1 stage and processed as a shuffle of 2 elements.
      2. If the Base is undef vector and have only 1 shuffle mask, perform the
      action only for 1 vector with the given mask, if it is not the identity
      mask.
      3. If > 2 masks are used, perform serie of shuffle actions for 2 vectors,
      combing the masks properly between the steps.
      
      The original implementation misses the very first analysis for the Base
      vector, so the cost might too optimistic in some cases. But it improves
      the cost for the insertelements which are part of the current SLP graph.
      
      Part of D107966.
      
      Differential Revision: https://reviews.llvm.org/D115750
      f5d45d70
    • Sanjay Patel's avatar
      [InstCombine] improve auto-generated test checks by matching function signature; NFC · 400587ba
      Sanjay Patel authored
      Without this, miscompiles go undetected here as shown in D125352.
      400587ba
    • Whisperity's avatar
    • Sergey Semushin's avatar
      [clang-format] fix nested angle brackets parse inside concept definition · dab5e10e
      Sergey Semushin authored
      Due to how parseBracedList always stopped on the first closing angle
      bracket and was used in parsing angle bracketed expression inside concept
      definition, nested brackets inside concepts were parsed incorrectly.
      
      nextToken() call before calling parseBracedList is required because
      we were processing opening angle bracket inside parseBracedList second
      time leading to incorrect logic after my fix.
      
      Fixes https://github.com/llvm/llvm-project/issues/54943
      Fixes https://github.com/llvm/llvm-project/issues/54837
      
      Reviewed By: HazardyKnusperkeks, curdeius
      
      Differential Revision: https://reviews.llvm.org/D123896
      dab5e10e
    • Fraser Cormack's avatar
      27c7e922
    • Fraser Cormack's avatar
      874b802a
    • Joseph Huber's avatar
      [CUDA] Add wrapper code generation for registering CUDA images · f49d576a
      Joseph Huber authored
      This patch adds the necessary code generation to create the wrapper code
      that registers all the globals in CUDA. We create the necessary
      functions and iterate through the list of
      `__start_cuda_offloading_entries` to find which globals must be
      registered. This is very similar to the code generation done currently
      in Clang for non-rdc builds, but here we are registering a fully linked
      fatbinary and finding the globals via the above sections.
      
      With this we should be able to fully support basic RDC / LTO building of CUDA
      code.
      
      It's also worth noting that this does not include the necessary PTX to JIT the
      image, so to use this support the offloading architecture must match the
      system's architecture.
      
      Depends on D123810
      
      Reviewed By: tra
      
      Differential Revision: https://reviews.llvm.org/D123812
      f49d576a
    • Joseph Huber's avatar
      [Cuda] Add initial support for wrapping CUDA images in the new driver. · e7858a9f
      Joseph Huber authored
      This patch adds the initial support for wrapping CUDA images. This
      requires changing some of the logic for how we bundle images. We now
      need to copy the image for all kinds that are active for the
      architecture. Then we need to run a separate wrapping job if the Kind is
      Cuda. For cuda wrapping we need to use the `fatbinary` program from the
      CUDA SDK to bundle all the binaries together. This is then passed to a
      new function to perfom the actual module code generation that will be
      implemented in a later patch.
      
      Depends on D120273 D123471
      
      Reviewed By: tra
      
      Differential Revision: https://reviews.llvm.org/D123810
      e7858a9f
    • Joseph Huber's avatar
      [CUDA] Create offloading entries when using the new driver · 0035f715
      Joseph Huber authored
      The changes made in D123460 generalized the code generation for OpenMP's
      offloading entries. We can use the same scheme to register globals for
      CUDA code. This patch adds the code generation to create these
      offloading entries when compiling using the new offloading driver mode.
      The offloading entries are simple structs that contain the information
      necessary to register the global. The struct used is as follows:
      
      ```
      Type struct __tgt_offload_entry {
        void    *addr;      // Pointer to the offload entry info.
                            // (function or global)
        char    *name;      // Name of the function or global.
        size_t  size;       // Size of the entry info (0 if it a function).
        int32_t flags;
        int32_t reserved;
      };
      ```
      
      Currently CUDA handles RDC code generation by deferring the registration
      of globals in the current TU to a callback function containing the
      modules ID. Later all the module IDs will be used to register all of the
      globals at once. Rather than mimic this, offloading entries allow us to
      mimic the way OpenMP registers globals. That is, we create a simple
      global struct for each device global to be registered. These are placed
      at a special section `cuda_offloading_entires`. Because this section is
      a valid C-identifier, the linker will profide a `__start` and `__stop`
      pointer that we can use to iterate and register all globals at runtime.
      
      the registration requires a flag variable to indicate which registration
      function to use. I have assigned the flags somewhat arbitrarily, but
      these use the following values.
      
      Kernel: 0
      Variable: 0
      Managed: 1
      Surface: 2
      Texture: 3
      
      Depends on D120272
      
      Reviewed By: tra
      
      Differential Revision: https://reviews.llvm.org/D123471
      0035f715
    • Aaron Ballman's avatar
    • Ken Matsui's avatar
      Add extension diagnostic for linemarker directives · 786c721c
      Ken Matsui authored
      This adds the -Wgnu-line-marker diagnostic flag, grouped under -Wgnu,
      to warn about use of the GNU linemarker preprocessor extension.
      
      Fixes #55067
      
      Differential Revision: https://reviews.llvm.org/D124534
      786c721c
    • Amir Ayupov's avatar
      [BOLT][TEST] Remove -gdwarf-4 override from %cflags · 4a58eb9e
      Amir Ayupov authored
      As BOLT support for monolithic and split DWARF5 is added, remove DWARF version
      override for BOLT tests.
      
      Reviewed By: ayermolo
      
      Differential Revision: https://reviews.llvm.org/D125366
      4a58eb9e