1. Dec 16, 2023
    • Arthur Eubanks's avatar
      [X86][test] Update tagged-globals*.ll tests · 809ee6cf
      Arthur Eubanks authored
      Use update_llc_test_checks.py.
      
      Split out jump table tests into separate file since we don't want to check the exact instruction sequence for it.
      809ee6cf
    • Florian Hahn's avatar
      [VPlan] Unswitch cond in replaceUsesWithIf in optimizeInductions (NFC) · cb56ba63
      Florian Hahn authored
      As suggested post-commit for a0022719, unswitch the condition in
      replaceUsesWithIf to simplify the check.
      cb56ba63
    • Shilei Tian's avatar
      [OpenMP] Use simple VLA implementation to replace uses of actual VLA · a4d1d5f5
      Shilei Tian authored
      Use of VLA can cause compile warning that was introduced in D156565. This patch
      implements a simple stack/heap-based VLA that can miminc the behavior of an
      actual VLA and prevent the warning. By default the stack accomodates the
      elements. If the number of emelements is greater than N, which by default is 8,
      a heap buffer will be allocated and used to acccomodate the elements.
      a4d1d5f5
    • dhruvachak's avatar
      [OpenMP] [OMPT] A pointer to HostOpId should be passed in EMI callbacks. (#75574) · e4de6a60
      dhruvachak authored
      With this change, TargetRegionOpId is no more used and hence deleted.
      e4de6a60
    • Jon Roelofs's avatar
      fixup! fixup! [GlobalISel] Always direct-call IFuncs and Aliases (#74902) · d6f77207
      Jon Roelofs authored
      Apparently some BOLT bots build with a pre-installed system clang, and others
      use the just-built one. These two clangs now behave slightly differently when
      it comes to ifunc codegen after https://github.com/llvm/llvm-project/pull/74902
      
      Change the test to accept both patterns.
      d6f77207
    • Joseph Huber's avatar
      [NVPTX] Add ELF flags for Nvidia cubin files (#75624) · 8c262ed2
      Joseph Huber authored
      Summary:
      Nvidia uses ELF as its file format for cubin files. This patch adds
      support to allow detecting the architecture using the ELF flags only.
      This will be used in the offloading runtime in the future.
      
      These values are completely undocumented. They were determined by
      manually modifying the ELF header of the cubin and checking the output
      of the `nvisasm` tool.
      8c262ed2
    • Teresa Johnson's avatar
      [MemProf][NFC] Clear each IndexedMemProfRecord after it is written (#75205) · 35a003c2
      Teresa Johnson authored
      The on-disk hash table for the memprof writer holds copies of all the
      memprof records to be written. These hold a lot of memory in aggregate,
      due to the lists of alloc sites (which each have a list of context
      frames) and call sites. Clear each one after emitting it.
      
      This drops the peak memory when writing a very large indexed memprof
      profile by about 2.5G.
      35a003c2
    • Teresa Johnson's avatar
      [MemProf][NFC] Free large data structures after last use (#75120) · 1a529949
      Teresa Johnson authored
      The MemProf InstrProfWriter uses a couple of MapVector for building the
      lists of records it needs to write. Once its entries are all added to
      the associated OnDiskChainedHashTableGenerator, it is no longer used.
      
      Clearing these MapVectors, which grow quite large for large profiles,
      saved 4G for a large memory profile.
      1a529949
    • Rob Suderman's avatar
      [mlir][math] Added `math.sinh` with expansions to `math.exp` (#75517) · aa165edc
      Rob Suderman authored
      Includes end-to-end tests for the cpu running, folders using `libm` and
      lowerings to the corresponding `libm` operations.
      aa165edc
    • vdonaldson's avatar
      [flang] legacy branch target (#75628) · d6a3607f
      vdonaldson authored
      Branching to an endif statement from outside of the if is nonconformant:
      
        subroutine jump(n)
          goto 6
          if (n == 3) then
            goto 7
        6 end if
          print *, 'pass'
          return
        7 print *, 'fail'
        end
      
      However, this branch was permitted up to f90. Account for this usage
      when rewriting if constructs and if statements by suppressing rewriting
      if the end statement is labeled.
      d6a3607f
    • Philip Reames's avatar
      [RISCV][InsertVSETVLI] Factor out isNonZeroLoadImmediate helper [nfc] · 4fa9697b
      Philip Reames authored
      Just reducing a bit of code duplication.
      4fa9697b
    • Jon Roelofs's avatar
      fixup! [GlobalISel] Always direct-call IFuncs and Aliases (#74902) · 3017adb3
      Jon Roelofs authored
      The codegen change broke one of the BOLT tests.
      3017adb3
    • Philip Reames's avatar
      Revert "[flang][nfc] Refactor linker invocation logic (#75534)" · 0b7dda3d
      Philip Reames authored
      This reverts commit 71bbfabd.  Breaks check-flang on x86_64 host.
      0b7dda3d
    • Ulrich Weigand's avatar
      [SystemZ] ABI support for single-element vector types · 59f7f35a
      Ulrich Weigand authored
      Support passing and returning values of single-element vector
      types (i.e. <1 x i128> and <1 x fp128>).
      
      Now that i128 is a legal type, supporting these types can be
      done simply by providing a getRegisterTypeForCallingConv
      implementation that handles them.
      
      Fixes https://github.com/llvm/llvm-project/issues/61291
      59f7f35a
    • Alex Langford's avatar
      7113c802
    • SingleAccretion's avatar
      [lld][WebAssembly] Add an `--initial-heap` option (#75594) · b2cdf3cc
      SingleAccretion authored
      It is beneficial to preallocate a certain number of pages in the linear
      memory (i. e. use the "minimum" field of WASM memories) so that fewer
      "memory.grow"s are needed at startup.
      
      So far, the way to do that has been to pass the "--initial-memory"
      option to the linker. It works, but has the very significant downside of
      requiring the user to know the size of static data beforehand, as it
      must not exceed the number of bytes passed-in as "--initial-memory".
      
      The new "--initial-heap" option avoids this downside by simply appending
      the specified number of pages to static data (and stack), regardless of
      how large they already are.
      
      Ref: https://github.com/emscripten-core/emscripten/issues/20888.
      b2cdf3cc
    • Martin Storsjö's avatar
      [llvm-windres] Resolve the --preprocessor executable in $PATH (#75390) · 1709e8c6
      Martin Storsjö authored
      The llvm::sys::ExecuteAndWait function doesn't resolve the file to be
      executed from $PATH - i.e. it is similar to execv(), not execvp().
      
      Due to this, specifying a --preprocessor argument to llvm-windres only
      worked if it specified an absolute path to the preprocessor executable.
      This was observed as one of the issues in
      https://github.com/msys2/MINGW-packages/pull/19157.
      
      Before d2fa6b69, this usage of
      --preprocessor seemed to work, because the first argument of Args[] was
      ignored and llvm-windres just executed the autodetected clang executable
      regardless.
      
      Also improve the error messages printed if preprocessing failed. (If the
      preprocessor executable was started but itself returned an error, we
      don't get any error string.)
      1709e8c6
    • Martin Storsjö's avatar
      [llvm-windres] Pass user preprocessor arguments before the input filename (#75389) · 10b78cc8
      Martin Storsjö authored
      If passing the windres option --preprocessor, the default arguments "-E
      -xc -DRC_INVOKED" aren't passed. If these are passed explicitly by the
      user via --preprocessor-arg instead, we need to make sure that "-xc" is
      passed before the input filename, as this compiler/preprocessor option
      only has an effect on input files that follow it.
      
      This fixes one of the issues with llvm-windres observed in
      https://github.com/msys2/MINGW-packages/pull/19157.
      10b78cc8
    • Martin Storsjö's avatar
      [LLD] [MinGW] Respect the -S/-s options when writing PDB files (#75181) · 7dcd8ef1
      Martin Storsjö authored
      This allows avoiding including some stray DWARF sections (e.g. from
      toolchain provided files), when writing a PDB file.
      
      While that probably could be considered reasonable default behaviour,
      PDB writing and including DWARF sections are two entirely orthogonal
      concepts, and GNU ld (which can generate PDB files these days) does
      include DWARF unless -S/-s is passed, when creating a PDB.
      7dcd8ef1
    • Martin Storsjö's avatar
      [LLD] [COFF] Add /debug: options nodwarf and nosymtab (#75180) · e36535d4
      Martin Storsjö authored
      These allow tweaking what gets implied by /debug and /debug:dwarf.
      e36535d4
    • Martin Storsjö's avatar
      [LLD] [COFF] Parse all /debug: options, like /opt: (#75178) · efe017f8
      Martin Storsjö authored
      Most option handling is like it was before; the last /debug: option
      takes effect.
      
      However, the options /debug:dwarf or /debug:symtab don't reset all flags
      into the specific behaviour they chose before - e.g. if an earlier
      option enables writing a PDB, a later /debug:dwarf or /debug:symtab
      doesn't disable that. This allows combining these options with options
      for controlling PDB writing, for finetuning what is done.
      efe017f8
    • Martin Storsjö's avatar
      [LLD] [COFF] Rewrite handling of the /debug: option. NFC. (#75175) · e6e615ca
      Martin Storsjö authored
      Don't treat the options as unique enum items, but more as flags that can
      be composed, like the /opt: options.
      
      This still only processes the last option on the command line though, so
      the behaviour should still remain exactly as it was, in all corner
      cases.
      e6e615ca
    • Martin Storsjö's avatar
      [LLD] [COFF] Rewrite the config flags for dwarf debug info or symtab. NFC. (#75172) · 23e6e881
      Martin Storsjö authored
      This shouldn't have any user visible effect, but makes the logic within
      the linker implementation more explicit.
      
      Note how DWARF debug info sections were retained even if enabling a link
      with PDB info only; that behaviour is preserved.
      23e6e881
    • Andrzej Warzyński's avatar
      [mlir][linalg] Use vector.shuffle to flatten conv filter (#75038) · f11bda78
      Andrzej Warzyński authored
      Updates the vectorisation of 1D depthwise convolution when flattening
      the channel dimension (introduced in #71918). In particular - how the
      convolution filter is "flattened". ATM, the vectoriser will use
      `vector.shape_cast`:
      
      ```mlir
        %b_filter = vector.broadcast %filter : vector<4xf32> to vector<3x2x4xf32>
        %sc_filter = vector.shape_cast %b_filter : vector<3x2x4xf32> to vector<3x8xf32>
      ```
      
      This lowering is not ideal - `vector.shape_cast` can be convenient when
      it's folded away, but that's not happening in this case. Instead, this
      patch updates the vectoriser to use `vector.shuffle` (the overall result
      is identical):
      
      ```mlir
        %sh_filter = vector.shuffle %filter, %filter
            [0, 1, 2, 3, 0, 1, 2, 3] : vector<4xf32>, vector<4xf32>
        %b_filter = vector.broadcast %sh_filter : vector<8xf32> to vector<3x8xf32>
      ```
      f11bda78
    • Arthur Eubanks's avatar
      [Instrumentation][X86] Limit setting large section flag to medium/large code models (#75542) · 0d948827
      Arthur Eubanks authored
      In #74514 and #74778 we marked various instrumentation-added sections as
      large. This causes an extra PT_LOAD segment if using the small code
      model. Since people using the small code model presumably aren't hitting
      relocation limits, disable this when using the small code model to avoid
      the extra segment.
      
      This uses Module::getCodeModel() which isn't necessarily reliable since
      it reads module metadata (which right now only the clang frontend sets),
      but it would be nice to get to a point where we reliably put this sort
      of information (e.g. PIC/code model/etc) in the IR. This requires
      duplicating the existing tests since opt/llc currently don't set these
      metadata. If we get to a point where they do set the code model metadata
      based on command line arguments then we can deduplicate these tests.
      0d948827
    • Valentin Clement (バレンタイン クレメン)'s avatar
      [flang][openacc/mp][NFC] Remove unused baseAddr argument (#75537) · 43cb8f00
      `baseAddr` is not used in `genBaseBoundsOps` just remove it.
      43cb8f00
    • Aiden Grossman's avatar
      [llvm-exegesis] Validate that address annotations are aligned (#75554) · ceb196d9
      Aiden Grossman authored
      This patch adds in validation at two different levels that address
      annotations are page aligned. This is necessary as otherwise the mmap
      calls will fail as MAP_FIXED/MAP_FIXED_NOREPLACE require page aligned
      addresses. This happens silently in the subprocess. This patch adds
      validation at snippet parsing time to give feedback to the user and also
      adds asserts at code generation/address usage time to ensure that other
      users of the Exegesis APIs conform to the same requirements.
      ceb196d9
    • Florian Hahn's avatar
      [VPlan] Remove stale comment from optimizeInductions (NFC). · 9277ef12
      Florian Hahn authored
      As suggested post-commit for a0022719, remove the stale comment,
      SetVector is no longer used here.
      9277ef12
    • Reid Kleckner's avatar
      [SLP] Fix OOB GEP index access for a no-op GEP · 3e16152e
      Reid Kleckner authored
      Issue is covered by existing test
      llvm/test/Transforms/SLPVectorizer/RISCV/phi-const.ll
      
      See issue #75632 for ideas for how we could catch these more easily in
      the future.
      3e16152e
    • Peiming Liu's avatar
      4a72a4ef
    • Philip Reames's avatar
      [RISCV] Prefer whole register loads and stores when VL=VLMAX (#75531) · e8a15eca
      Philip Reames authored
      If we're lowering a fixed length vector load or store which happens to
      exactly VLEN in size (when VLEN is exactly known), we can use a whole
      register load or store instead of the unit strided variants. This
      doesn't require a vsetvli in some cases, allows additional flexibility
      of vsetvli cases in others, and doesn't have a runtime dependency on the
      value of VL.
      e8a15eca
    • Youngsuk Kim's avatar
      [llvm] Remove no-op ptr-to-ptr casts (NFC) · 67aec2f5
      Youngsuk Kim authored
      Remove calls to CreatePointerCast which are just doing no-op ptr-to-ptr
      bitcasts.
      
      Opaque ptr cleanup effort (NFC).
      67aec2f5
    • Craig Topper's avatar
      [RISCV Add some vsetvli insertion test cases with vmv.s.x+reduction. NFC (#75544) · 93b14c3d
      Craig Topper authored
      These test cases where intended to get a single vsetvli by using the
      vmv.s.x intrinsic with the same LMUL as the reduction. This works for
      FP, but does not work for integer.
      
      I believe #71501 will break this for FP too. Hopefully the vsetvli pass
      can be taught to fix this.
      93b14c3d
    • Thomas Preud'homme's avatar
    • LLVM GN Syncbot's avatar
      [gn build] Port f7407411 · b0623fa1
      LLVM GN Syncbot authored
      b0623fa1
    • Reid Kleckner's avatar
      [IR] Fix UB on Op<2> in ShuffleVector predicates (#75549) · 04b8c830
      Reid Kleckner authored
      This Op<2> usage was missed in 1ee6ec2b, which replaced the third
      shuffle operand with a vector of integer mask constants.
      
      I noticed this when attempting to make changes to the layout of
      llvm::Value.
      04b8c830
    • Mariusz Sikora's avatar
    • Nikolas Klauser's avatar
      [libc++] Optimize std::find for segmented iterators (#67224) · f7407411
      Nikolas Klauser authored
      ```
      --------------------------------------------------------------------------
      Benchmark                                              old             new
      --------------------------------------------------------------------------
      bm_find<std::deque<char>>/1                        6.06 ns         10.6 ns
      bm_find<std::deque<char>>/2                        15.5 ns         10.6 ns
      bm_find<std::deque<char>>/3                        19.0 ns         10.6 ns
      bm_find<std::deque<char>>/4                        20.8 ns         10.6 ns
      bm_find<std::deque<char>>/5                        22.0 ns         10.6 ns
      bm_find<std::deque<char>>/6                        23.0 ns         10.5 ns
      bm_find<std::deque<char>>/7                        24.8 ns         10.7 ns
      bm_find<std::deque<char>>/8                        25.7 ns         10.6 ns
      bm_find<std::deque<char>>/16                       28.3 ns         10.6 ns
      bm_find<std::deque<char>>/64                       44.2 ns         27.0 ns
      bm_find<std::deque<char>>/512                       133 ns         37.6 ns
      bm_find<std::deque<char>>/4096                      867 ns         53.1 ns
      bm_find<std::deque<char>>/32768                    6838 ns          160 ns
      bm_find<std::deque<char>>/262144                  52897 ns         1495 ns
      bm_find<std::deque<char>>/1048576                215621 ns         6077 ns
      bm_find<std::deque<short>>/1                       6.03 ns         6.28 ns
      bm_find<std::deque<short>>/2                       15.8 ns         15.8 ns
      bm_find<std::deque<short>>/3                       20.5 ns         20.3 ns
      bm_find<std::deque<short>>/4                       21.0 ns         21.0 ns
      bm_find<std::deque<short>>/5                       23.0 ns         22.1 ns
      bm_find<std::deque<short>>/6                       22.6 ns         23.0 ns
      bm_find<std::deque<short>>/7                       23.4 ns         23.7 ns
      bm_find<std::deque<short>>/8                       24.4 ns         24.9 ns
      bm_find<std::deque<short>>/16                      26.6 ns         27.2 ns
      bm_find<std::deque<short>>/64                      43.2 ns         40.9 ns
      bm_find<std::deque<short>>/512                      124 ns         90.7 ns
      bm_find<std::deque<short>>/4096                     845 ns          525 ns
      bm_find<std::deque<short>>/32768                   7273 ns         3194 ns
      bm_find<std::deque<short>>/262144                 53710 ns        24385 ns
      bm_find<std::deque<short>>/1048576               216086 ns        96195 ns
      bm_find<std::deque<int>>/1                         6.03 ns         10.3 ns
      bm_find<std::deque<int>>/2                         15.6 ns         10.3 ns
      bm_find<std::deque<int>>/3                         19.1 ns         10.3 ns
      bm_find<std::deque<int>>/4                         22.3 ns         10.3 ns
      bm_find<std::deque<int>>/5                         23.5 ns         10.4 ns
      bm_find<std::deque<int>>/6                         23.1 ns         10.3 ns
      bm_find<std::deque<int>>/7                         23.7 ns         10.2 ns
      bm_find<std::deque<int>>/8                         24.5 ns         10.2 ns
      bm_find<std::deque<int>>/16                        27.9 ns         26.6 ns
      bm_find<std::deque<int>>/64                        42.6 ns         32.2 ns
      bm_find<std::deque<int>>/512                        123 ns         43.0 ns
      bm_find<std::deque<int>>/4096                       874 ns         93.5 ns
      bm_find<std::deque<int>>/32768                     7031 ns          751 ns
      bm_find<std::deque<int>>/262144                   57723 ns         6169 ns
      bm_find<std::deque<int>>/1048576                 230867 ns        35851 ns
      bm_ranges_find<std::deque<char>>/1                 5.97 ns         10.6 ns
      bm_ranges_find<std::deque<char>>/2                 16.0 ns         10.5 ns
      bm_ranges_find<std::deque<char>>/3                 19.5 ns         10.5 ns
      bm_ranges_find<std::deque<char>>/4                 21.1 ns         10.6 ns
      bm_ranges_find<std::deque<char>>/5                 22.8 ns         10.5 ns
      bm_ranges_find<std::deque<char>>/6                 22.8 ns         10.6 ns
      bm_ranges_find<std::deque<char>>/7                 23.4 ns         10.8 ns
      bm_ranges_find<std::deque<char>>/8                 24.1 ns         10.5 ns
      bm_ranges_find<std::deque<char>>/16                26.9 ns         10.6 ns
      bm_ranges_find<std::deque<char>>/64                50.2 ns         27.2 ns
      bm_ranges_find<std::deque<char>>/512                126 ns         38.3 ns
      bm_ranges_find<std::deque<char>>/4096               868 ns         53.8 ns
      bm_ranges_find<std::deque<char>>/32768             6695 ns          161 ns
      bm_ranges_find<std::deque<char>>/262144           54411 ns         1497 ns
      bm_ranges_find<std::deque<char>>/1048576         241699 ns         6042 ns
      bm_ranges_find<std::deque<short>>/1                6.39 ns         6.31 ns
      bm_ranges_find<std::deque<short>>/2                15.8 ns         15.9 ns
      bm_ranges_find<std::deque<short>>/3                19.0 ns         19.8 ns
      bm_ranges_find<std::deque<short>>/4                20.8 ns         20.9 ns
      bm_ranges_find<std::deque<short>>/5                21.8 ns         22.1 ns
      bm_ranges_find<std::deque<short>>/6                23.0 ns         23.0 ns
      bm_ranges_find<std::deque<short>>/7                23.2 ns         23.9 ns
      bm_ranges_find<std::deque<short>>/8                23.7 ns         24.4 ns
      bm_ranges_find<std::deque<short>>/16               26.6 ns         26.8 ns
      bm_ranges_find<std::deque<short>>/64               43.4 ns         39.7 ns
      bm_ranges_find<std::deque<short>>/512               131 ns         90.5 ns
      bm_ranges_find<std::deque<short>>/4096              851 ns          523 ns
      bm_ranges_find<std::deque<short>>/32768            7370 ns         3166 ns
      bm_ranges_find<std::deque<short>>/262144          60778 ns        24814 ns
      bm_ranges_find<std::deque<short>>/1048576        229288 ns        99273 ns
      bm_ranges_find<std::deque<int>>/1                  6.43 ns         10.2 ns
      bm_ranges_find<std::deque<int>>/2                  16.6 ns         10.2 ns
      bm_ranges_find<std::deque<int>>/3                  19.6 ns         10.2 ns
      bm_ranges_find<std::deque<int>>/4                  21.0 ns         10.2 ns
      bm_ranges_find<std::deque<int>>/5                  21.9 ns         10.4 ns
      bm_ranges_find<std::deque<int>>/6                  22.7 ns         10.2 ns
      bm_ranges_find<std::deque<int>>/7                  23.9 ns         10.2 ns
      bm_ranges_find<std::deque<int>>/8                  23.8 ns         10.2 ns
      bm_ranges_find<std::deque<int>>/16                 27.2 ns         27.1 ns
      bm_ranges_find<std::deque<int>>/64                 42.4 ns         32.4 ns
      bm_ranges_find<std::deque<int>>/512                 122 ns         43.0 ns
      bm_ranges_find<std::deque<int>>/4096                895 ns         93.7 ns
      bm_ranges_find<std::deque<int>>/32768              6890 ns          756 ns
      bm_ranges_find<std::deque<int>>/262144            54025 ns         6102 ns
      bm_ranges_find<std::deque<int>>/1048576          221558 ns        32783 ns
      ```
      f7407411
  2. Dec 15, 2023