1. Mar 01, 2023
    • Peiming Liu's avatar
      [mlir][sparse] fix performance bug in matmul with a sparse rhs due to suboptimal iteration graphs. · 849529ba
      Peiming Liu authored
      While dense tensors support random accesses, it is critical to visit them in a row-major order for better cache locality. However, we previously consider dense inputs and outputs together when computing constraints for building iteration graph, it could lead us to less efficient iteration graphs.
      
      This patch adds a new `SortMask::kIncludeDenseInput` to treat dense inputs/outputs separately when building iteration graph, thus increasing the chance for use to construct a better iteration graph.
      
      A more fine-grained approach is to treat each input separately.
      
      Note, related to:
       https://github.com/llvm/llvm-project/issues/51651
      
      Reviewed By: aartbik
      
      Differential Revision: https://reviews.llvm.org/D144932
      849529ba
    • Med Ismail Bennani's avatar
    • Siva Chandra Reddy's avatar
      [libc][NFC] Refactor internal errno. · 110ee164
      Siva Chandra Reddy authored
      This is in preparation for the transition to a solution to make libc tests
      hermetic with respect to their use of errno. The implementation of strdup
      has been switched over to libc_errno as an example of what the code looks
      like in the new way.
      
      See #61037 for more information.
      
      Reviewed By: lntue
      
      Differential Revision: https://reviews.llvm.org/D144928
      110ee164
    • Alexey Bataev's avatar
      [OpenMP]Emit captured decls for target data if no devices were specified. · acc30a16
      Alexey Bataev authored
      If use_device_ptr/use_device_addr clauses are used on target data
      directive and no device was specified during the compilation, only host
      part should be emitted. But it still required to emit captured decls for
      partially mapped data fields.
      
      Differential Revision: https://reviews.llvm.org/D144993
      acc30a16
    • Fangrui Song's avatar
      [test] Add missing -### to Driver/config-file3.c · 37216b4b
      Fangrui Song authored
      Otherwise clang may invoke ld. If ld is a shell script using `~`, the
      command will fail since `HOME` is changed.
      37216b4b
    • Fangrui Song's avatar
      [Driver] Revert -mcpu=?/-mtune=? and make -mcpu=help/-mtune=help unnamed · fb166b44
      Fangrui Song authored
      Follow-up to D144914.
      -mcpu=help seems fine as a Clang extension not in GCC, because llc supports -mcpu=help.
      -mcpu=? is a bad choice as ? may be expanded by the shell.
      fb166b44
    • Anshil Gandhi's avatar
      [AMDGPU] Replace LegacyDA with Uniformity Analysis in AnnotateUniformValues · a7830156
      Anshil Gandhi authored
      Reviewed By: sameerds
      
      Differential Revision: https://reviews.llvm.org/D144162
      a7830156
    • Mehdi Amini's avatar
      Fix SimplifyAllocConst pattern when we have alloc of negative sizes · f35ac8a4
      Mehdi Amini authored
      This is UB, but we shouldn't crash the compiler either.
      
      Fixes #61056
      
      Reviewed By: jpienaar
      
      Differential Revision: https://reviews.llvm.org/D144978
      f35ac8a4
    • Med Ismail Bennani's avatar
      [lldb] Fix {break,watch}point command function stopping behaviour · 9a9fce1f
      Med Ismail Bennani authored
      In order to run a {break,watch}point command, lldb can resolve to the
      script interpreter to run an arbitrary piece of code or call into a
      user-provided function. To do so, we will generate a wrapping function,
      where we first copy lldb's internal dictionary keys into the
      interpreter's global dictionary, copied inline the user code before
      resetting the global dictionary to its previous state.
      
      However, {break,watch}point commands can optionally return a value that
      would tell lldb whether we should stop or not. This feature was
      only implemented for breakpoint commands and since we inlined the user
      code directly into the wrapping function, introducing an early return,
      that caused lldb to let the interpreter global dictionary tinted with the
      internal dictionary keys.
      
      This patch fixes that issue while also adding the stopping behaviour to
      watchpoint commands.
      
      To do so, this patch refactors the {break,watch}point command creation
      method, to let the lldb wrapper function generator know if the user code is
      a function call or a arbitrary expression.
      
      Then the wrapper generator, if the user input was a function call, the
      wrapper function will call the user function and save the return value into
      a variable. If the user input was an arbitrary expression, the wrapper  will
      inline it into a nested function, call the nested function and save the
      return value into the same variable. After resetting the interpreter global
      dictionary to its previous state, the generated wrapper function will return
      the varible containing the return value.
      
      rdar://105461140
      
      Differential Revision: https://reviews.llvm.org/D144688
      
      
      
      Signed-off-by: default avatarMed Ismail Bennani <medismail.bennani@gmail.com>
      9a9fce1f
    • Valery N Dmitriev's avatar
      [SLP] Add banner argument to SLP costs debug printer method - NFC. · ec7154fe
      Valery N Dmitriev authored
      Removed unnecessary warning workaround.
      
      Differential Revision: https://reviews.llvm.org/D144992
      ec7154fe
    • Sanjay Patel's avatar
      [InstCombine] reassociate subtract-from-constant to add-constant · 542e70f9
      Sanjay Patel authored
      (C - X) + Y --> (Y - X) + C
      
      Moving the constant operand to an 'add' gives more
      flexibility to subsequent reassociation patterns,
      and it may be better for codegen on targets that
      don't have subtract-from-immediate instructions.
      542e70f9
    • Sanjay Patel's avatar
      [IR] fix spelling/formatting; NFC · a721b6b1
      Sanjay Patel authored
      Even within this file, the usual spelling is 'Opcode',
      so make it consistent.
      a721b6b1
    • Sanjay Patel's avatar
      [InstCombine] simplify test for div/rem; NFC · 2ea0e530
      Sanjay Patel authored
      This is too conservative as noted in the TODO comment.
      2ea0e530
    • Craig Topper's avatar
      [Sema] Add missing entries to the arrays in GetImplicitConversionName and GetConversionRank. · 8ce68969
      Craig Topper authored
      It appears that ICK_Zero_Queue_Conversion was inserted into the ICK
      enum without updating this table. Easy to do since the table size
      was set to ICK_Num_Conversion_Kinds.
      
      I've used ICR_Exact_Match to match what was previously done for
      ICK_Zero_Event_Conversion that last time someone noticed this had happened.
      
      To prevent this from happening again, I've removed the explicit size
      and used a static_assert to check the size against ICK_Num_Conversion_Kinds.
      
      Differential Revision: https://reviews.llvm.org/D144990
      8ce68969
    • Mark de Wever's avatar
      Revert "Revert "[Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity"" · 33e18cb6
      Mark de Wever authored
      This fixes the Clang modular CI, but breaks other CIs.
      
      This reverts commit 2ae39902.
      33e18cb6
    • Michael Jones's avatar
      [libc] fix strtofloat test with 128 bit floats · 2dd527b6
      Michael Jones authored
      Differential Revision: https://reviews.llvm.org/D144991
      2dd527b6
    • Yitzhak Mandelbaum's avatar
      [clang][dataflow] Fix missed fields in field set construction. · 73c98831
      Yitzhak Mandelbaum authored
      When building the set of referenced fields for the `DataflowAnalysisContext`,
      include fields referenced only in default member initializers. These
      initializers are visited in the CFGs of constructors and so the fields must be
      included when analysing constructor bodies.
      
      Differential Revision: https://reviews.llvm.org/D144987
      73c98831
    • Michael Jones's avatar
      [libc] Refactor string to float return values · cb3c41c2
      Michael Jones authored
      The internal implementation of the string to float function previously
      used pointer arguments for returning several values. Additionally it
      set errno in several unexpected places. Now all of that goes through
      return structs. For readability I also moved the function away from raw
      pointer arithmetic towards proper indexing. I also added support for
      rounding modes.
      
      Reviewed By: sivachandra
      
      Differential Revision: https://reviews.llvm.org/D144597
      cb3c41c2
    • Michael Maitland's avatar
      [Clang][Driver] Add -mcpu=help and -mtune=help to clang · 003078b6
      Michael Maitland authored
      Clang currently uses `-mcpu=?` and `-mtune=?`. The `?` causes errors on some
      shells such as zsh since it is a special character. In order for it to work on
      shells such as zsh, the option must be passed in quotes or escaped. This patch
      adds `-mcpu=help` and `-mtune=help` as another alias for `--print-supported-cpus`.
      In llc, `-mcpu=help` is an alias to print supported cpus.
      
      Differential Revision: https://reviews.llvm.org/D144914
      003078b6
    • Mark de Wever's avatar
      Revert "[Modules] Don't check [temp.friend]p9 in ASTContext::isSameEntity" · 2ae39902
      Mark de Wever authored
      This commits breaks the libc++ modular build in the precommit CI.
      
      This reverts commit 74565c3a.
      2ae39902
    • Nikolas Klauser's avatar
      [libc++] Run clang-tidy in all configurations that are run in the Docker container · 4668dd8c
      Nikolas Klauser authored
      Reviewed By: ldionne, Mordante, #libc
      
      Spies: libcxx-commits, arichardson
      
      Differential Revision: https://reviews.llvm.org/D143333
      4668dd8c
    • V Donaldson's avatar
      [flang] Block construct · 2c143345
      V Donaldson authored
      A block construct is an execution control construct that supports
      declaration scopes contained within a parent subprogram scope or another
      block scope. (blocks may be nested.) This is implemented by applying
      basic scope processing to the block level.
      
      Name uniquing/mangling is extended to support this. The term "block" is
      heavily overloaded in Fortran standards. Prior name uniquing used tag `B`
      for common block objects. Existing tag choices were modified to free up `B`
      for block construct entities, and `C` for common blocks, and resolve
      additional issues with other tags. The "old tag -> new tag" changes can
      be summarized as:
      
           -> B  -- block construct -> new
        B  -> C  -- common block
        C  -> YI -- intrinsic type descriptor; not currently generated
        CT -> Y  -- nonintrinsic type descriptor; not currently generated
        G  -> N  -- namelist group
        L  ->    -- block data; not needed -> deleted
      
      Existing name uniquing components consist of a tag followed by a name
      from user source code, such as a module, subprogram, or variable name.
      Block constructs are different in that they may be anonymous. (Like other
      constructs, a block may have a `block-construct-name` that can be used
      in exit statements, but this name is optional.) So blocks are given a
      numeric compiler-generated preorder index starting with `B1`, `B2`,
      and so on, on a per-procedure basis.
      
      Name uniquing is also modified to include component names for all
      containing procedures rather than for just the immediate host. This
      fixes an existing name clash bug with same-named entities in same-named
      host subprograms contained in different-named containing subprograms,
      and variations of the bug involving modules and submodules.
      
      F18 clause 9.7.3.1 (Deallocation of allocatable variables) paragraph 1
      has a requirement that an allocated, unsaved allocatable local variable
      must be deallocated on procedure exit. The following paragraph 2 states:
      
        When a BLOCK construct terminates, any unsaved allocated allocatable
        local variable of the construct is deallocated.
      
      Similarly, F18 clause 7.5.6.3 (When finalization occurs) paragraph 3
      has a requirement that a nonpointer, nonallocatable object must be
      finalized on procedure exit. The following paragraph 4 states:
      
        A nonpointer nonallocatable local variable of a BLOCK construct
        is finalized immediately before it would become undefined due to
        termination of the BLOCK construct.
      
      These deallocation and finalization requirements, along with stack
      restoration requirements, require knowledge of block exits. In addition
      to normal block termination at an end-block-stmt, a block may be
      terminated by executing a branching statement that targets a statement
      outside of the block. This includes
      
      Single-target branch statements:
       - goto
       - exit
       - cycle
       - return
      
      Bounded multiple-target branch statements:
       - arithmetic goto
       - IO statement with END, EOR, or ERR specifiers
      
      Unbounded multiple-target branch statements:
       - call with alternate return specs
       - computed goto
       - assigned goto
      
      Lowering code is extended to determine if one of these branches exits
      one or more relevant blocks or other constructs, and adds a mechanism to
      insert any necessary deallocation, finalization, or stack restoration
      code at the source of the branch. For a single-target branch it suffices
      to generate the exit code just prior to taking the indicated branch.
      Each target of a multiple-target branch must be analyzed individually.
      Where necessary, the code must first branch to an intermediate basic
      block that contains exit code, followed by a branch to the original target
      statement.
      
      This patch implements an `activeConstructStack` construct exit mechanism
      that queries a new `activeConstruct` PFT bit to insert stack restoration
      code at block exits. It ties in to existing code in ConvertVariable.cpp
      routine `instantiateLocal` which has code for finalization, making block
      exit finalization on par with subprogram exit finalization. Deallocation
      is as yet unimplemented for subprograms or blocks. This may result in
      memory leaks for affected objects at either the subprogram or block level.
      Deallocation cases can be addressed uniformly for both scopes in a future
      patch, presumably with code insertion in routine `instantiateLocal`.
      
      The exit code mechanism is not limited to block construct exits. It is
      also available for use with other constructs. In particular, it is used
      to replace custom deallocation code for a select case construct character
      selector expression where applicable. This functionality is also added
      to select type and associate constructs. It is available for use with
      other constructs, such as select rank and image control constructs,
      if that turns out to be necessary.
      
      Overlapping nonfunctional changes include eliminating "FIR" from some
      routine names and eliminating obsolete spaces in comments.
      2c143345
    • Yaxun (Sam) Liu's avatar
      [SimplifyCFG] Do not hoist/sink convergent function calls · fbec8f04
      Yaxun (Sam) Liu authored
      Currently SimplifyCFG hoists/sink common instructions in then/else basic blocks
      when certain options are enabled, which is the case for default clang optimization
      pipelines for -O3. It tries to hoist/sink convergent function calls in divergent
      control flow, which causes incorrect ISA generated for GPU, e.g.
      https://github.com/ROCm-Developer-Tools/HIP/issues/3172
      
      This patch fixes that by conservatively disable hoisting/sinking common
      convergent function calls in then/else blocks.
      
      Reviewed by: Artem Belevich
      
      Differential Revision: https://reviews.llvm.org/D144756
      fbec8f04
    • Arthur Eubanks's avatar
      [gn build] Manually port D140588 · 83c0d652
      Arthur Eubanks authored
      83c0d652
    • Mark de Wever's avatar
      [libc++] Addresses LWG3782. · 853059a1
      Mark de Wever authored
        3782. Should <math.h> declare ::lerp?
      
      Libc++ doesn't declare ::lerp, adds tests to validate the requirement.
      
      Reviewed By: #libc, philnik
      
      Differential Revision: https://reviews.llvm.org/D142817
      853059a1
    • Philip Reames's avatar
      [RISCV] Use !listremove for LMUL lists in V scheduling info [nfc] · 27c3c6c4
      Philip Reames authored
      Using listremove makes it easier to confirm that the code matches the comments.  The only in tree users of these lists are not order sensative.
      27c3c6c4
    • Arthur O'Dwyer's avatar
      [libc++] Refactor allocator_mismatch.compile.fail.cpp -> .verify.cpp · ce32e057
      Arthur O'Dwyer authored
      compile.fail.cpp tests are an anti-feature since they are too easy to
      break when evolving code. This patch moves various allocator_mismatch
      tests to .verify.cpp and normalizes the error messages from various
      containers.
      
      Differential Revision: https://reviews.llvm.org/D144913
      ce32e057
    • Mark de Wever's avatar
      [clang] Documents clang-scan-deps requirements. · 8dbeb41f
      Mark de Wever authored
      This was discussed in https://llvm.org/PR61006.
      
      Reviewed By: ChuanqiXu
      
      Differential Revision: https://reviews.llvm.org/D144894
      8dbeb41f
    • Sacha Ballantyne's avatar
      [flang] Fix a bug with simplified minloc that treated logicals with even values > 1 as 0 · 242bb0b6
      Sacha Ballantyne authored
      Previously the mask would be loaded as the appropriate integer type and cast to I1 to pass to
      fir.if, however this truncates the integer and so would cast 6 to 0. By loading values as logicals
      and casting to I1 this problem is avoided.
      
      Reviewed By: Leporacanthicus
      
      Differential Revision: https://reviews.llvm.org/D144974
      242bb0b6
    • Alex Brachet's avatar
      [X86] Add DwarfRegNums for segment registers · f94fb267
      Alex Brachet authored
      Differential Revision: https://reviews.llvm.org/D144900
      f94fb267
    • Philip Reames's avatar
      [RISCV] Factor out multiclass definitions for V scheduling info [nfc] · 60f3703d
      Philip Reames authored
      Factoring out a shared multiclass imply makes it easier to see that all of these do the same thing, just on different lists. It also makes it easier to see differences - such as we don't define read related pieces for FWRed.
      
      Differential Revision: https://reviews.llvm.org/D144899
      60f3703d
    • Manupa Karunaratne's avatar
      [MLIR][AMDGPU][ROCDL] Adding raw.buffer.atomic.fmax/smax/umin support · 584f6436
      Manupa Karunaratne authored
      This commit adds support for atomic fmax/smax/umin support
      for AMDGPU dialect and the dependent dialects to allow such
      a lowering.
      
      Reviewed By: krzysz00
      
      Differential Revision: https://reviews.llvm.org/D144097
      584f6436
    • Chia-hung Duan's avatar
      Revert "Revert "[scudo] Only prepare PageMap entry for partial region"" · c6ef6bbd
      Chia-hung Duan authored
      Fixed the bug in merging BatchGroups back to the FreeList. Added DCHECKs
      to ensure the order of BatchGroups
      
      This reverts commit 387452ec.
      
      Reviewed By: cferris
      
      Differential Revision: https://reviews.llvm.org/D144920
      c6ef6bbd
    • Nikita Popov's avatar
      [Orc] Try to fix linker error · abdefc89
      Nikita Popov authored
      Try to fix flang-aarch64-sharedlibs build.
      
      7344f8a8 introduced a use of
      LLVMCreatePassBuilderOptions(), which is part of the Passes
      library, while previously only InstCombine was linked.
      abdefc89
    • ibricchi's avatar
      [unittest] Restructure plugin cmake target · e281d102
      ibricchi authored
      Move plugin source and cmake files into separate directory.
      Typically cmake targets in LLVM have a single target per directory.
      This change brings this unittest more inline with that structure.
      
      Reviewed By: thakis
      
      Differential Revision: https://reviews.llvm.org/D140588
      e281d102
    • bixia1's avatar
      [mlir][sparse] Add runtime support for reading a COO tensor and writing the... · 27ea470f
      bixia1 authored
      [mlir][sparse] Add runtime support for reading a COO tensor and writing the data to the given indices and values buffers.
      
      Reviewed By: aartbik
      
      Differential Revision: https://reviews.llvm.org/D143862
      27ea470f
    • Corentin Jabot's avatar
      [Clang] Implement CWG2518 - static_assert(false) · 00e2098b
      Corentin Jabot authored
      This allows `static_assert(false)` to not be ill-formed
      in template definitions.
      
      This change is applied as a DR in all C++ modes.
      
      Of notes, a couple of tests were relying of the eager nature
      of static_assert
      
      * test/SemaTemplate/instantiation-dependence.cpp
      * test/SemaTemplate/instantiate-var-template.cpp
      
      I don't know if the changes to `static_assert`
      still allow that sort of tests to be expressed.
      
      Reviewed By: #clang-language-wg, erichkeane, aaron.ballman
      
      Differential Revision: https://reviews.llvm.org/D144285
      00e2098b
  2. Feb 28, 2023