1. Feb 15, 2024
    • Cullen Rhodes's avatar
      [mlir][ArmSME][nfc] Add integration test for i8 to i32 matmul (#81607) · 97c19a46
      Cullen Rhodes authored
      Currently marked as XFAIL due to bug in QEMU. See test for details.
      97c19a46
    • Vyacheslav Levytskyy's avatar
      add support for the SPV_KHR_linkonce_odr extension (#81512) · 9552a396
      Vyacheslav Levytskyy authored
      This PR adds support for the SPV_KHR_linkonce_odr extension and modifies
      existing negative test with a positive check for the extension and
      proper linkage type in case when the extension is enabled.
      
      SPV_KHR_linkonce_odr adds a "LinkOnceODR" linkage type, allowing proper
      translation of, for example, C++ templates classes merging during
      linking from different modules and supporting any other cases when a
      global variable/function must be merged with equivalent global
      variable(s)/function(s) from other modules during the linking process.
      9552a396
    • Vyacheslav Levytskyy's avatar
      let a user select preferred/unpreferred capabilities in a list of enabling capabilities (#81476) · dfb9bf35
      Vyacheslav Levytskyy authored
      By SPIR-V specification: "If an instruction, enumerant, or other feature
      specifies multiple enabling capabilities, only one such
      capability needs to be declared to use the feature."
      
      However, one capability may be preferred over another. One important
      case is Shader capability that may not be supported by a backend, but
      always is inserted if "OpDecorate SpecId" is found, because Enabling
      Capabilities for the latter is the list of Shader and Kernel, where
      Shader is coming first and thus always selected as the first available
      option.
      
      In this PR we address the problem by keeping current behaviour of
      selecting the first option among enabling capabilities as is, but giving
      a user a way to filter capabilities during the selection process via a
      newly introduced "--avoid-spirv-capabilities" command line option. This
      option is to avoid selection of certain capabilities if there are other
      available enabling capabilities.
      
      This PR is changing also existing pruneCapabilities() function. It
      doesn't remove capability from module requirement anymore, but only adds
      implicitly required capabilities recursively, so its name is changed
      accordingly. This change fixes the present bug in collecting required by
      a module capabilities. Before the change, introduced by this PR,
      pruneCapabilities() function has been removing, for example, Kernel
      capability from required by a module, because Kernel is initially
      required and the second time it was needed pruneCapabilities() removed
      it by mistake.
      dfb9bf35
    • David Spickett's avatar
      [clang][flang][driver] Correct program names in option group descriptions (#81726) · 09b80e61
      David Spickett authored
      Currently https://flang.llvm.org/docs/FlangCommandLineReference.html
      refers to "Clang" in several of the group descriptions for example:
      ```
      Compilation options
      
      Flags controlling the behavior of Clang during compilation...
      ```
      
      This is pretty confusing. I'm fixing this by making use of `Program`
      from the existing GlobalDocumentation object to substitute in the
      program name to these descriptions.
      
      This `Program` has been changed to a proper noun given that it's easier
      to lower case a string than capitalise one character (syntax wise). The
      tablegen backend has been changed to lower it so that links in the
      RST/HTML remain the same as they were before.
      
      To make sure the file is valid when not generating docs, I'm checking a
      #define and providing a default GlobalDocumentation if it's not defined.
      (I looked for a way to check if a def exists, but tablegen doesn't seem
      to have one)
      
      This means that if the DocBrief are used outside of documentation,
      they'll say "Clang", which is the same as it always was.
      
      This change does not aim fix option descriptions that refer to clang.
      Though we can use parts of this for that, there is only one driver
      library so it needs a different approach.
      
      This change also fixes the warning:
      ```
      /home/buildbot/as-worker-4/publish-sphinx-docs/build/tools/flang/docs/Source/FlangCommandLineReference.rst:194: WARNING: unknown document: 'DiagnosticsReference'
      ```
      Which is due to flang docs trying to link to clang docs. Now it will
      just tell the reader to go to Clang's page, which is not ideal but it is
      easy to find with Google at least.
      09b80e61
    • chuongg3's avatar
      [AArch64][GlobalISel] Refactor Combine G_CONCAT_VECTOR (#80866) · f6f8e202
      chuongg3 authored
      The combine now works using tablegen and checks if new instruction is
      legal before creating it.
      f6f8e202
    • Stanislav Mekhanoshin's avatar
      [AMDGPU] Add 256-bit vdst and 96-bit src to profile switches. NFC. (#81801) · c6a7c4d7
      Stanislav Mekhanoshin authored
      I need these operands for a future patch. Also simplify conditions
      there. If nothing using !cond instead of nesting !if's does not need to
      realign code every time a new type is added.
      c6a7c4d7
    • Paul Semel's avatar
    • Mikael Holmen's avatar
      [clang] Fix two gcc warnings about unused variables [NFC] · 4a32a414
      Mikael Holmen authored
      Without the fix gcc warns like
       ../../clang/lib/Sema/SemaDecl.cpp:2963:24: warning: unused variable 'SupA' [-Wunused-variable]
        2963 |   else if (const auto *SupA = dyn_cast<SuppressAttr>(Attr))
             |                        ^~~~
      and
       ../../clang/lib/Driver/Driver.cpp:4192:17: warning: unused variable 'IAA' [-Wunused-variable]
        4192 |       if (auto *IAA = dyn_cast<InstallAPIJobAction>(Current)) {
             |                 ^~~
      
      Remove the unused variables and change the "dyn_cast"s into "isa"s.
      4a32a414
    • Luke Lau's avatar
      [RISCV] Use $noreg in vsetvli-insert.mir test. NFC · cd55e230
      Luke Lau authored
      This reflects what actually comes out of SelectionDAG after the noreg passthru
      peephole added in a63bd7e9.
      cd55e230
    • jeanPerier's avatar
      [flang] prevent legacy lowering from being called in pointer assignment (#81750) · e769fb86
      jeanPerier authored
      When doing a pointer assignment with an RHS that is an array section,
      the code fell in the legacy lowering code even with HLFIR enabled.
      Escape this old code when HLFIR is on.
      
      Should fix #80884.
      e769fb86
    • jeanPerier's avatar
      [flang] Deep copy nested allocatable components in transformational (#81736) · 0d0bd3ef
      jeanPerier authored
      Spread, reshape, pack, and other transformational intrinsic runtimes are
      using `CopyElement` utility to copy elements. This utility was dealing
      with deep copies, but only when the allocatable components where
      "immediate" components of the type being copied. If the allocatable
      components were nested inside a nonpointer/nonallocatable component,
      they were not deep copied, leading to bugs later when manipulating the
      value (or double free when applying #81117).
      
      Visit data components with allocatable components (using the
      noDestructionNeeded flag to avoid expensive and useless type visit when
      there are no such components).
      0d0bd3ef
    • jeanPerier's avatar
      [flang][runtime] Destroy nested allocatable components (#81117) · 5f6e0f35
      jeanPerier authored
      The runtime was currently only deallocating the direct allocatable
      components, which caused leaks when there are allocatable components
      nested in the direct components.
      
      Update Destroy to recursively destroy components.
      
      Also call Destroy from Assign to deallocate nested allocatable
      components before doing the assignment as required by F2018 9.7.3.2
      point 7.
      
      This lack of deallocation was visible if the nested components had user
      defined assignment "observing" the allocation state.
      5f6e0f35
    • Christian Sigg's avatar
      [bazel][libc] Fix BUILD after ff409d39. · 28d43850
      Christian Sigg authored
      28d43850
    • NAKAMURA Takumi's avatar
      [MC/DC] Refactor: Let MCDCConditionID int16_t with zero-origin (#81257) · ab76e48a
      NAKAMURA Takumi authored
      Also, Let `NumConditions` `uint16_t`.
      
      It is smarter to handle the ID as signed.
      Narrowing to `int16_t` will reduce costs of handling byvalue. (See also
      #81221 and #81227)
      
      External behavior doesn't change. They below handle values as internal
      values plus 1.
      * `-dump-coverage-mapping`
      * `CoverageMappingReader.cpp`
      * `CoverageMappingWriter.cpp`
      ab76e48a
    • Rohit Aggarwal's avatar
      Adding support of AMDLIBM vector library (#78560) · 36adfec1
      Rohit Aggarwal authored
      Hi,
      
      AMD has it's own implementation of vector calls. This patch include the
      changes to enable the use of AMD's math library using -fveclib=AMDLIBM.
      Please refer https://github.com/amd/aocl-libm-ose
      
       
      
      ---------
      
      Co-authored-by: default avatarRohit Aggarwal <Rohit.Aggarwal@amd.com>
      36adfec1
    • Timm Bäder's avatar
    • Timm Bäder's avatar
      [clang][Interp] Fix calling invalid function pointers · b200dfc1
      Timm Bäder authored
      Checking for isConstexpr() is wrong; we need to (try to) call
      the function and let later code diagnose the failure accordingly.
      b200dfc1
    • Prabhuk's avatar
      Revert "[lldb-dap] Add support for data breakpoint. (#81541)" (#81812) · 6c74a6f6
      Prabhuk authored
      This reverts commit 8c56e78e.
      
      Reverting to address the LLDB test failure in ARM64.
      6c74a6f6
    • riChar's avatar
      [LLVM][X86] Add EFLAGS Defs for VERR/VERW instructions (#81824) · 94f51649
      riChar authored
      VERR/VERW instructions will define ZF flag.
      94f51649
    • Owen Pan's avatar
      [clang-format][NFC] Sort options in Format.cpp · 6087d7bc
      Owen Pan authored
      6087d7bc
    • Abhinav271828's avatar
      [MLIR][Presburger] Implement vertex enumeration and chamber decomposition for... · 562790f3
      Abhinav271828 authored
      [MLIR][Presburger] Implement vertex enumeration and chamber decomposition for polytope generating function computation. (#78987)
      
      We implement a function to compute the generating function corresponding
      to a full-dimensional parametric polytope whose tangent cones are all
      unimodular.
      We fix a bug in unimodGenFunc to check the absolute value of the index.
      We also implement Matrix<T>::negateMatrix() and Matrix<T>::scaleRow for
      convenience.
      562790f3
    • Timm Bäder's avatar
      [clang][Interp] Fix variadic member functions · d53515af
      Timm Bäder authored
      For variadic member functions, the way we calculated the instance
      pointer and RVO pointer offsts on the stack was incorrect, due
      to Func->getArgSize() not returning the full size of all the
      passed arguments. When calling variadic functions, we need
      to pass the size of the passed (variadic) arguments to the Call*
      ops, so they can use that information to properly check the
      instance pointer, etc.
      
      This patch adds a bit of code duplication in Interp.h, which I
      will get rid of in later cleanup NFC patches.
      d53515af
    • Qfrost's avatar
      [clang][X86] X86::LAR X86::LSL add_implicate eflags (#80993) · bfe302c5
      Qfrost authored
      [@xia0ji233](https://github.com/xia0ji233) and I found that X86::LAR and
      X86::lSR implicit use eflags register. However, it was not been defined
      in LLVM, which means we will get wrong alive-result if we use these two
      instructions.
      ![T~
      _81W6A}J}{AP{DF%E}KY](https://github.com/llvm/llvm-project/assets/58380176/b84e758b-2978-49e7-a11c-726fd66e1976)
      bfe302c5
    • Joseph Huber's avatar
      4b5c21aa
    • Luke Lau's avatar
      [RISCV] Add cost model tests for llvm.vector.{insert,extract}. NFC · fc0b67e1
      Luke Lau authored
      For llvm.vector.extract, this tests combinations of inserting at a zero and
      non-zero index, and extracting from a fixed or scalable vector.
      
      For llvm.vector.insert, this tests the same combinations as extracts but with
      an additional configuration for an undef vector. This is because we can use a
      subregister insert if the index is 0 and the vector is undef, which should be
      free.
      fc0b67e1
    • Joseph Huber's avatar
      [ClangPackager] Fix passing in multiple instances of `file` · fa9e297b
      Joseph Huber authored
      Summary:
      This is necessary because CMake build tools might need to generate
      several files but are unable to put them in separate images. This patch
      sipmly moves the file handling out into a separate split iterator.
      fa9e297b
    • rmarker's avatar
      [clang-format][NFC] Drop "Always" in "AlwaysBreakAfterReturnType". (#81591) · d821650e
      rmarker authored
      Complete the switch from "AlwaysBreakAfterReturnType" to
      "BreakAfterReturnType".
      d821650e
    • Jessica Clarke's avatar
      [TableGen][NFCI] Simplify TypeSetByHwMode::intersect and make extensible (#81688) · de6fad51
      Jessica Clarke authored
      The current implementation considers both iPTR+iN and everything else
      all in one go, which leads to more special casing when iPTR is present
      in only one set than is described in the comment block. Moreover this
      makes it very difficult to add any new iPTR-like wildcards due to the
      exponential combinatorial explosion that occurs.
      
      Logically, iPTR+iN handling is entirely independent from everything
      else, so rewrite the code to do them separately. This removes special
      cases, making the core of the implementation more succinct, whilst more
      clearly implementing exactly what is described in the comment block, and
      allows for any number of (non-overlapping) wildcards to be added to the
      list, as needed by CHERI LLVM downstream (due to having a new capability
      type which, much like a normal integer pointer in LLVM, varies in size
      between targets and modes).
      
      In testing, this change results in identical TableGen output for all
      in-tree backends (including those in LLVM_ALL_EXPERIMENTAL_TARGETS), and
      it is intended that this implementation is entirely equivalent to the
      old one.
      de6fad51
    • Brianna Fan's avatar
      [analyzer] Teach scan-build to filter reports by file. · dcbb574c
      Brianna Fan authored
      That's a new GUI bell-and-whistle in the index.html page.
      dcbb574c
    • jkorous-apple's avatar
      [-Wunsafe-buffer-usage] Add fixits for array to pointer assignment (#81343) · 6fce42f8
      jkorous-apple authored
      Introducing CArrayToPtrAssignment gadget and implementing fixits for some cases
      of array being assigned to pointer.
      
      Key observations:
      - const size array can be assigned to std::span and bounds are propagated
      - const size array can't be on LHS of assignment
      This means array to pointer assignment has no strategy implications.
      
      Fixits are implemented for cases where one of the variables in the assignment is
      safe. For assignment of a safe array to unsafe pointer we know that the RHS will
      never be transformed since it's safe and can immediately emit the optimal fixit.
      Similarly for assignment of unsafe array to safe pointer.
      (Obviously this is not and can't be future-proof in regards to what
      variables we consider unsafe and that is fine.)
      
      Fixits for assignment from unsafe array to unsafe pointer (from Array to Span
      strategy) are not implemented in this patch as that needs to be properly designed
      first - we might possibly implement optimal fixits for partially transformed
      cases, put both variables in a single fixit group or do something else.
      6fce42f8
    • Ryosuke Niwa's avatar
      [analyzer] UncountedCallArgsChecker: Detect & ignore trivial function calls. (#81808) · a7982d5e
      Ryosuke Niwa authored
      This PR introduces the concept of a "trivial function" which applies to
      a function that only calls other trivial functions and contain literals
      and expressions that don't result in heap mutations (specifically it
      does not call deref). This is implemented using ConstStmtVisitor and
      checking each statement and expression's trivialness.
      
      This PR also introduces the concept of a "ingleton function", which is a
      static member function or a free standing function which ends with the
      suffix "singleton". Such a function's return value is understood to be
      safe to call any function with.
      a7982d5e
    • lntue's avatar
      [libc][math] Add C23 ldexpf128 math function and fix DyadicFloat conversions... · ff409d39
      lntue authored
      [libc][math] Add C23 ldexpf128 math function and fix DyadicFloat conversions for subnormal ranges and 80-bit floating points. (#81780)
      
      ff409d39
    • Jie Fu's avatar
      [clangd][test] Fix -Wmissing-field-initializers in DiagnosticsTests.cpp (NFC) · 8ce14480
      Jie Fu authored
      llvm-project/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp:921:45:
      error: missing field 'Annotations' initializer [-Werror,-Wmissing-field-initializers]
             TextEdit{Main.range("virtual1"), ""}}};
                                                  ^
      llvm-project/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp:926:45:
      error: missing field 'Annotations' initializer [-Werror,-Wmissing-field-initializers]
             TextEdit{Main.range("virtual2"), ""}}};
                                                  ^
      2 errors generated.
      8ce14480
    • jkorous-apple's avatar
      [-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (#80504) · 9a1e6373
      jkorous-apple authored
      [-Wunsafe-buffer-usage] Ignore safe array subscripts
      Don't emit warnings for array subscripts on constant size arrays where the index is constant and within bounds.
      
      Example:
      int arr[10];
      arr[5] = 0; //safe, no warning
      
      This patch recognizes only array indices that are integer literals - it doesn't understand more complex expressions (arithmetic on constants, etc.).
      
      -Warray-bounds implemented in Sema::CheckArrayAccess() already solves a similar
      (opposite) problem, handles complex expressions and is battle-tested.
      
      Adding -Wunsafe-buffer-usage diagnostics to Sema is a non-starter as we need to emit
      both the warnings and fixits and the performance impact of the fixit machine is
      unacceptable for Sema.
      
      CheckArrayAccess() as is doesn't distinguish between "safe" and "unknown" array
      accesses. It also mixes the analysis that decides if an index is out of bounds
      with crafting the diagnostics.
      
      A refactor of CheckArrayAccess() might serve both the original purpose
      and help us avoid false-positive with -Wunsafe-buffer-usage on constant
      size arrrays.
      9a1e6373
    • jkorous-apple's avatar
      [-Wunsafe-buffer-usage] Fixits for array args of func-ptr calls (#80358) · 4cd7616f
      jkorous-apple authored
      Currently we ignore calls on function pointers (unlike direct calls of
      functions and class methods). This patch adds support for function pointers as
      well.
      
      The change is to simply replace use of forEachArgumentWithParam matcher in UPC
      gadget with forEachArgumentWithParamType.
      
      from the documentation of forEachArgumentWithParamType:
      /// Matches all arguments and their respective types for a \c CallExpr or
      /// \c CXXConstructExpr. It is very similar to \c forEachArgumentWithParam but
      /// it works on calls through function pointers as well.
      
      Currently the matcher also uses hasPointerType() which checks that the
      canonical type of an argument is pointer and won't match on arrays decayed to
      pointer. Replacing hasPointerType() with isAnyPointerType() which allows
      implicit casts allows for the arrays to be matched as well and this way we get
      fixits for array arguments to function pointer calls too.
      4cd7616f
    • Philipp Tomsich's avatar
      [NFC][AArch64] fix whitespace in AArch64SchedNeoverseV1 (#81744) · 3369e341
      Philipp Tomsich authored
      One of the whitespace fixes didn't get added to the commit introducing
      the Ampere1B model.
      Clean it up.
      3369e341
    • Tom Stellard's avatar
    • Fangrui Song's avatar
      [ubsan,test] Disable static-link.cpp for i386 and internal_symbolizer · acdb4cdc
      Fangrui Song authored
      i386 has a `__tls_get_addr` link error.
      For internal_symbolizer, the x86_64 test would fail as well.
      acdb4cdc
    • Daniel Rodríguez Troitiño's avatar
      [llvm][compiler-rt] Connect lit dependencies to test-depends targets. (#81783) · 4eb092d9
      Daniel Rodríguez Troitiño authored
      compiler-rt was creating the test-depends targets and trying to fill its
      dependencies with a variable, but the variable was empty because it was
      supposed to take its value from a property. The changes in this commit
      grab the value of the property and add them as dependencies.
      
      The changes in llvm are to remove the usage of `DEPENDS` arguments from
      `add_custom_target`, which according to the documentation is reserved
      for files/outputs created by `add_custom_command`. Use
      `add_dependencies` instead.
      
      This is similar to the changes introduced in
      4eb84582 for runtimes.
      4eb092d9
    • Alexander Yermolovich's avatar
      [BOLT][DWARF] Add test for DW_AT_ranges input without function output (#81794) · 82ca7523
      Alexander Yermolovich authored
      Added a test that relies on -fbasic-block-sections=all and --gc-sections
      that exercises a code path that previously printed a warning.
      82ca7523