1. May 25, 2024
    • Michael Kruse's avatar
    • David CARLIER's avatar
      9da81cee
    • Alexander Yermolovich's avatar
      [BOLT] Do not emit debug_names entry for DIEs with DW_AT_declaration (#93347) · 8c2da89e
      Alexander Yermolovich authored
      Previously BOLT was only doing it for DW_TAG_variables. It looks like
      other type of DIEs can have this. So making it global.
      8c2da89e
    • Alexandre Ganea's avatar
      [Support] Fix LEB128 test when building with MSVC (#93184) · 56d319e7
      Alexandre Ganea authored
      The VALUE expansion might be compiled in the different ways, because of
      string pooling which isn't always enabled/guaranteed. When building with
      MSVC, previously I was seeing for example empty strings `""` pointing to
      different addresses, thus the negative offsets below in the log.
      
      Previous test log:
      ```
      Note: Google Test filter = LEB128Test.DecodeInvalidULEB128
      [==========] Running 1 test from 1 test suite.
      [----------] Global test environment set-up.
      [----------] 1 test from LEB128Test
      [ RUN      ] LEB128Test.DecodeInvalidULEB128
      C:\src\git\llvm-project\llvm\unittests\Support\LEB128Test.cpp(167): error: Expected equality of these values:
        0u
          Which is: 0
        Value - reinterpret_cast<const uint8_t *>("")
          Which is: -5
      
      C:\src\git\llvm-project\llvm\unittests\Support\LEB128Test.cpp(168): error: Expected equality of these values:
        1u
          Which is: 1
        Value - reinterpret_cast<const uint8_t *>("\x80")
          Which is: -167
      
      C:\src\git\llvm-project\llvm\unittests\Support\LEB128Test.cpp(171): error: Expected equality of these values:
        9u
          Which is: 9
        Value - reinterpret_cast<const uint8_t *>("\x80\x80\x80\x80\x80\x80\x80\x80\x80\x02")
          Which is: -167
      
      C:\src\git\llvm-project\llvm\unittests\Support\LEB128Test.cpp(172): error: Expected equality of these values:
        10u
          Which is: 10
        Value - reinterpret_cast<const uint8_t *>("\x80\x80\x80\x80\x80\x80\x80\x80\x80\x80\x02")
          Which is: -166
      
      [  FAILED  ] LEB128Test.DecodeInvalidULEB128 (2 ms)
      [----------] 1 test from LEB128Test (2 ms total)
      
      [----------] Global test environment tear-down
      [==========] 1 test from 1 test suite ran. (4 ms total)
      [  PASSED  ] 0 tests.
      [  FAILED  ] 1 test, listed below:
      [  FAILED  ] LEB128Test.DecodeInvalidULEB128
      
       1 FAILED TEST
      ```
      56d319e7
    • Michael Kruse's avatar
      [llvm] Revise IDE folder structure (#89741) · 4ecbfacf
      Michael Kruse authored
      Update the folder titles for targets in the monorepository that have not
      seen taken care of for some time. These are the folders that targets are
      organized in Visual Studio and XCode
      (`set_property(TARGET <target> PROPERTY FOLDER "<title>")`)
      when using the respective CMake's IDE generator.
      
       * Ensure that every target is in a folder
       * Use a folder hierarchy with each LLVM subproject as a top-level folder
       * Use consistent folder names between subprojects
       * When using target-creating functions from AddLLVM.cmake, automatically
      deduce the folder. This reduces the number of
      `set_property`/`set_target_property`, but are still necessary when
      `add_custom_target`, `add_executable`, `add_library`, etc. are used. A
      LLVM_SUBPROJECT_TITLE definition is used for that in each subproject's
      root CMakeLists.txt.
      4ecbfacf
    • Florian Hahn's avatar
      [VPlan] Remove unused Range arg from createWidenInductionRecipe (NFC). · 83646590
      Florian Hahn authored
      The Range argument is not used by createWidenInductionRecipe; induction
      classification applies across the whole range of VFs. Remove the
      argument.
      83646590
    • Stephan T. Lavavej's avatar
    • Vladimir Vereschaka's avatar
      [CMake] Update CMake cache file for the Win-to-Arm cross toolchains. NFC. (#93363) · 7d29718f
      Vladimir Vereschaka authored
      * allow configuration for the target specific compiler flags.
      * allow lld linker for all linker outputs: shared, module and exe.
      * allow configuration of libc++ ABI version.
      * set MSVC runtime library to MultiThreadedDLL/MultiThreadedDebugDLL on
      Windows build hosts.
      * install UCRT libraries on Windows build hosts
      7d29718f
    • Brandon Wu's avatar
      [llvm] Include the GenVT.inc to getEnumName (#93198) · 85cf2e5e
      Brandon Wu authored
      This reduces the effort of adding MVT strings every time.
      85cf2e5e
    • Reagan's avatar
      [clang] Add /Zc:__STDC__ flag to clang-cl (#68690) · 778dbcbb
      Reagan authored
      This commit adds the /Zc:\_\_STDC\_\_ argument from MSVC, which defines
      \_\_STDC_\_.
      This means, alongside stronger feature parity with MSVC, that things
      that rely on \_\_STDC\_\_, such as autoconf, can work.
      Link to MSVC documentation of this flag:
      https://learn.microsoft.com/en-us/cpp/build/reference/zc-stdc?view=msvc-170
      778dbcbb
    • Qiongsi Wu's avatar
      Reland "[SimplifyCFG] `switch`: Do Not Transform the Default Case if the... · 7dc2f660
      Qiongsi Wu authored
      Reland "[SimplifyCFG] `switch`: Do Not Transform the Default Case if the Condition is Too Wide (#77831)"
      
      https://github.com/llvm/llvm-project/pull/76669 taught SimplifyCFG to
      handle switches when `default` has only one case. When the `switch`'s
      condition is wider than 64 bit, the current implementation can calculate
      the wrong default value. This PR skips cases where the condition is too
      wide.
      
      (cherry picked from commit 39bb790b)
      7dc2f660
    • DianQK's avatar
      Reland "[SimplifyCFG] When only one case value is missing, replace default with that case (#76669)" · 64ed699b
      DianQK authored
      When the default branch is the last case, we can transform that branch
      into a concrete branch with an unreachable default branch.
      
      ```llvm
      target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
      target triple = "x86_64-unknown-linux-gnu"
      
      define i64 @src(i64 %0) {
        %2 = urem i64 %0, 4
        switch i64 %2, label %5 [
          i64 1, label %3
          i64 2, label %3
          i64 3, label %4
        ]
      
      3:                                                ; preds = %1, %1
        br label %5
      
      4:                                                ; preds = %1
        br label %5
      
      5:                                                ; preds = %1, %4, %3
        %.0 = phi i64 [ 2, %4 ], [ 1, %3 ], [ 0, %1 ]
        ret i64 %.0
      }
      
      define i64 @tgt(i64 %0) {
        %2 = urem i64 %0, 4
        switch i64 %2, label %unreachable [
          i64 0, label %5
          i64 1, label %3
          i64 2, label %3
          i64 3, label %4
        ]
      
      unreachable:                              ; preds = %1
        unreachable
      
      3:                                                ; preds = %1, %1
        br label %5
      
      4:                                                ; preds = %1
        br label %5
      
      5:                                                ; preds = %1, %4, %3
        %.0 = phi i64 [ 2, %4 ], [ 1, %3 ], [ 0, %1 ]
        ret i64 %.0
      }
      ```
      
      Alive2: https://alive2.llvm.org/ce/z/Y-PGXv
      
      After transform to a lookup table, I believe `tgt` is better code.
      
      The final instructions are as follows:
      
      ```asm
      src:                                    # @src
              and     edi, 3
              lea     rax, [rdi - 1]
              cmp     rax, 2
              ja      .LBB0_1
              mov     rax, qword ptr [8*rdi + .Lswitch.table.src-8]
              ret
      .LBB0_1:
              xor     eax, eax
              ret
      tgt:                                    # @tgt
              and     edi, 3
              mov     rax, qword ptr [8*rdi + .Lswitch.table.tgt]
              ret
      .Lswitch.table.src:
              .quad   1                               # 0x1
              .quad   1                               # 0x1
              .quad   2                               # 0x2
      
      .Lswitch.table.tgt:
              .quad   0                               # 0x0
              .quad   1                               # 0x1
              .quad   1                               # 0x1
              .quad   2                               # 0x2
      ```
      
      Godbolt: https://llvm.godbolt.org/z/borME8znd
      
      Closes #73446.
      
      (cherry picked from commit 7d81e072)
      64ed699b
    • Ryosuke Niwa's avatar
    • Shih-Po Hung's avatar
      [LV, VPlan] Check if plan is compatible to EVL transform (#92092) · 0338c55e
      Shih-Po Hung authored
      The transform updates all users of inductions to work based on EVL,
      instead
      of the VF directly. At the moment, widened inductions cannot be updated,
      so
      bail out if the plan contains any.
      This patch introduces a check before applying EVL transform. If any
      recipes in loop rely on RuntimeVF, the plan is discarded.
      0338c55e
    • Joseph Huber's avatar
      Revert "[OpenMP][OMPX] Add shfl_down_sync (#93311)" · 9b31cc71
      Joseph Huber authored
      This reverts commit 098c6dfa.
      This reverts commit 8c718a3a.
      This reverts commit 4fb02de9.
      9b31cc71
    • Craig Topper's avatar
      b13f7996
    • Max Winkler's avatar
      [clang][Driver] Fix enabling strict alising by default when the environment is MSVC (#91689) · d6376471
      Max Winkler authored
      From looking at the rest of code and from my own understanding, the
      driver mode is supposed to be independent of MSVC compatibility when the
      target triple is `*-windows-msvc`.
      Therefore strict aliasing should be disabled by default when the target
      triple is `*-windows-msvc` so code assuming MSVC behaves as expected
      when compiled with Clang.
      d6376471
    • Amir Ayupov's avatar
    • Jacques Pienaar's avatar
      [mlir][drr] Allow variadic in rewrite side (#93340) · c26847dc
      Jacques Pienaar authored
      
      
      Enables writing patterns where one has op creation with variadic in
      result pattern more easily.
      
      Signed-off-by: default avatarJacques Pienaar <jpienaar@google.com>
      c26847dc
    • Amir Ayupov's avatar
      [BOLT][NFC] Define getExprValue helper (#91663) · f2394905
      Amir Ayupov authored
      Move out common code extracting the address of a MCExpr. To be reused in
      #91667.
      
      Test Plan: NFC
      f2394905
    • Jakub Kuderski's avatar
      [mlir][arith] Clean up select op implementation (#93351) · 8e3be5c3
      Jakub Kuderski authored
      Inline traits used by `arith.select` only into `ArithOps.td`. Trim
      trailing whitespace in op description.
      8e3be5c3
    • Amir Ayupov's avatar
      [BOLT][NFC] Simplify analyzeIndirectBranch (#91662) · be83f5c1
      Amir Ayupov authored
      Simplify mutually exclusive sanity checks in analyzeIndirectBranch,
      where an UNKNOWN IndirectBranchType is to be returned. Reduces confusion
      and code duplication when adding a new IndirectBranchType (to be added
      in #91667).
      
      Test Plan: NFC
      be83f5c1
    • GeorgeHuyubo's avatar
      Read and store gnu build id from loaded core file (#92492) · ccde823b
      GeorgeHuyubo authored
      As we have debuginfod as symbol locator available in lldb now, we want
      to make full use of it.
      In case of post mortem debugging, we don't always have the main
      executable available.
      However, the .note.gnu.build-id of the main executable(some other
      modules too), should be available in the core file, as those binaries
      are loaded in memory and dumped in the core file.
      
      We try to iterate through the NT_FILE entries, read and store the gnu
      build id if possible. This will be very useful as this id is the unique
      key which is needed for querying the debuginfod server.
      
      Test:
      Build and run lldb. Breakpoint set to
      https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/SymbolLocator/Debuginfod/SymbolLocatorDebuginfod.cpp#L147
      Verified after this commit, module_uuid is the correct gnu build id of
      the main executable which caused the crash(first in the NT_FILE entry)
      
      Previous PR: https://github.com/llvm/llvm-project/pull/92078 was
      mistakenly merged. This PR is re-opening the commit.
      ccde823b
    • Amir Ayupov's avatar
      [BOLT][NFC] Add isRIPRel and isIndexed helpers (#91661) · 46588039
      Amir Ayupov authored
      Move out common X86MemOperand checks into helper lambdas. To be reused
      in #91667.
      
      Test Plan: NFC
      46588039
    • Craig Topper's avatar
      [RISCV] PseudoMovImm is not a IsSignExtendingOpW instruction. · 9a038fce
      Craig Topper authored
      We only know it expands to a 2 instruction sequence, not necessarily
      a sign extended sequence.
      
      Happened to notice while I was looking at naming for the proposed
      rematerializable LUI+ADDI for addresses.
      9a038fce
    • Peter Klausler's avatar
      [flang] Fix bug introduced by PR#93106 (#93326) · 82bd7adb
      Peter Klausler authored
      https://github.com/llvm/llvm-project/pull/93106 introduced some
      necessary fixes to module file generation, but has also caused a
      regression. The module file output can include bogus attempts to
      USE-associate symbols local to derived type scopes, like components and
      bindings. Fix, and extend a test.
      82bd7adb
    • Alexandre Ganea's avatar
      [clang-scan-deps] Expand response files before the argument adjuster (#89950) · 90e33e20
      Alexandre Ganea authored
      Previously, since response (.rsp) files weren't expanded at the very
      beginning of clang-scan-deps, we only parsed the command-line as
      provided in the Clang .cdb file. Unfortunately, when using Unreal
      Engine, arguments are always generated in a .rsp file (ie.
      `/path/to/clang-cl.exe @/path/to/filename_args.rsp`).
      
      After this patch, `/Fo` can be parsed and added to the final
      command-line. Without this option, the make targets that are emitted are
      made up from the input file name alone. We have some cases where the
      same input in the project generates several output files, so we end up
      with duplicate make targets in the scan-deps emitted dependency file.
      90e33e20
    • Mingming Liu's avatar
    • Oleksandr "Alex" Zinenko's avatar
      [mlir] expose -debug-only equivalent to C and Python (#93175) · 8f21909c
      Oleksandr "Alex" Zinenko authored
      These are useful for finer-grain debugging and complement the already
      exposed global debug flag.
      8f21909c
    • Amir Ayupov's avatar
      [BOLT][NFC] Avoid computing BF hash twice in YAML reader (#75096) · 720cade2
      Amir Ayupov authored
      We compute BF hashes in `YAMLProfileReader::readProfile` when first
      matching profile functions with binary functions, and second time in
      `YAMLProfileReader::parseFunctionProfile` during the profile assignment
      (we need to do that to account for LTO private functions with
      mismatching suffix).
      
      Avoid recomputing the hash if it's been set.
      720cade2
    • Kiran Chandramohan's avatar
      [Flang][OpenMP] Remove the orphan section test (#93343) · 57be0d2c
      Kiran Chandramohan authored
      Remove this test since it is marked as XFAIL and has some
      non-deterministic behaviour which causes it to spuriously pass on
      out-of-tree builds.
      
      Capturing this in https://github.com/llvm/llvm-project/issues/93342 to
      make a proper fix and a test later.
      57be0d2c
    • rahulana-quic's avatar
      Reland "[polly] Port polly tests to use NPM" (#92918) · e1f056f6
      rahulana-quic authored
      Even as the NPM has been in use by Polly for a while now, the majority
      of the tests continue using the LPM passes. This patch ports the tests
      to use the NPM passes (for example, by replacing a flag such as
      -polly-detect with -passes=polly-detect following the NPM syntax for
      specifying passes) with some exceptions for some missing features in the
      new passes.
      
      Relanding #90632.
      e1f056f6
    • Arthur Eubanks's avatar
      [test][EntryExitInstrumenter] Update/add tests · 3ec57a7e
      Arthur Eubanks authored
      Use UTC. Add test coverage for AIX.
      3ec57a7e
    • Andrey Ali Khan Bolshakov's avatar
      [clang][c++20] Fix code coverage mapping crash with generalized NTTPs (#85837) · 6be1a153
      Andrey Ali Khan Bolshakov authored
      Introduced in #78041, originally reported as #79957 and fixed partially
      in #80050.
      
      `OpaqueValueExpr` used with `TemplateArgument::StructuralValue` has no
      corresponding source expression.
      
      A test case with subobject-referring NTTP added.
      6be1a153
    • Xing Xue's avatar
      [OpenMP][AIX] Extend LIT test timeout limit (#93319) · 2669ee11
      Xing Xue authored
      When buildbots are crowded, the libomp LIT tests may hit timeouts so
      extend the limit from 1800 to 3000 seconds.
      2669ee11
    • Dmitry Vasilyev's avatar
      [lldb] Fixed the TestDebuggerAPI test on x86_64 Windows host (#90580) · 77369a7f
      Dmitry Vasilyev authored
      Disable the TestDebuggerAPI test in case of the remote target and
      Windows host.
      77369a7f
    • Slava Zakharin's avatar
    • Lei Wang's avatar
      [llvm-profgen] Improve sample profile density (#92144) · b9d40a7a
      Lei Wang authored
      The profile density feature(the amount of samples in the profile
      relative to the program size) is used to identify insufficient sample
      issue and provide hints for user to increase sample count. A low-density
      profile can be inaccurate due to statistical noise, which can hurt FDO
      performance.
      
      This change introduces two improvements to the current density work. 
      1. The density calculation/definition is changed. Previously, the
      density of a profile was calculated as the minimum density for all warm
      functions (a function was considered warm if its total samples were
      within the top N percent of the profile). However, there is a problem
      that a high total sample profile can have a very low density, which
      makes the density value unstable.
      - Instead, we want to find a density number such that if a function's
      density is below this value, it is considered low-density function. We
      consider the whole profile is bad if a group of low-density functions
      have the sum of samples that exceeds N percent cut-off of the total
      samples.
      
      - In implementation, we sort the function profiles by density, iterate
      them in descending order and keep accumulating the body samples until
      the sum exceeds the (100% - N) percentage of the total_samples, the
      profile-density is the last(minimum) function-density of processed
      functions. We introduce the a flag(`--profile-density-threshold`) for
      this percentage threshold.
      
      2. The density is now calculated based on final(compiler used) profiles
      instead of merged context-less profiles.
      b9d40a7a
    • Michael Maitland's avatar
      [RISCV] Do not check PostRAScheduler in enablePostRAScheduler (#92781) · 66b5f16b
      Michael Maitland authored
      On RISC-V, there are a few ways to control whether the
      PostMachineScheduler is enabled. If `-enable-post-misched` is passed or
      passed with a value of true, then the PostMachineScheduler is enabled.
      If it is passed with a value of false then the PostMachineScheduler is
      disabled. If the option is not passed at all, then
      `RISCVSubtarget::enablePostRAMachineScheduler` decides whether the pass
      should be enabled or not. `TargetSubtargetInfo::enablePostRAScheduler`
      and `TargetSubtargetInfo::enablePostRAMachineScheduler` who check the
      SchedModel value are not called by RISC-V backend.
      
      `RISCVSubtarget::enablePostRAMachineScheduler` currently checks if the
      active scheduler model sets `PostRAScheduler`. If it is set to true by
      the scheduler model, then the pass is enabled. If it is not set to true
      by the scheduler model, then the value of `UsePostRAScheduler` subtarget
      feature is used.
      
      I argue that the RISC-V backend should not use `PostRAScheduler` field
      of the scheduler model to control whether the PostMachineScheduler is
      enabled for the following reasons:
      
      1. No other targets use this value to control whether
      PostMachineScheduler is enabled. They only use it to check whether the
      legacy PostRASchedulerList scheduler is enabled.
      
      2. We can add the `UsePostRAScheduler` feature to the processor
      definition in RISCVProcessors.td to tie a processor to whether the pass
      should be enabled by default. This makes the feature and the sched model
      field redundant.
      
      3. Since these options are redundant, we should prefer the feature,
      since we can set `+` and `-` on the feature, but the value of the
      scheduler cannot be controlled on the command line.
      
      4. Keeping both options allows us to set the feature and the scheduler
      model value to conflicting values. Although the scheduler model value
      will win out, it feels awkward to allow it.
      66b5f16b
    • Shilei Tian's avatar