1. Jan 31, 2024
    • Joseph Huber's avatar
      [libc] Change the starting port index to use the SMID (#79200) · 5470ea4e
      Joseph Huber authored
      Summary:
      The RPC interface uses several ports to provide parallel access. Right
      now we begin the search at the beginning, which heavily contests the
      early ports. Using the SMID allows us to stagger the starting index
      based off of the cluster identifier that is executing the current warp.
      Multiple warps can share an SM, but it will guaruntee that the
      contention for the low indices is lower.
      
      This also increases the maximum port size to around 4096, this is
      because 512 isn't enough to cover the full hardare parallelism needed to
      guarantee this doesdn't deadlock.
      5470ea4e
    • Joseph Huber's avatar
      [AMDGPU] Do not emit arch dependent macros with unspecified cpu (#80035) · f2a78e68
      Joseph Huber authored
      Summary:
      Currently, the AMDGPU toolchain accepts not passing `-mcpu` as a means
      to create a sort of "generic" IR. The resulting IR will not contain any
      target dependent attributes and can then be inserted into another
      program via `-mlink-builtin-bitcode` to inherit its attributes.
      
      However, there are a handful of macros that can leak incorrect
      information when compiling for an unspecified architecture. Currently,
      things like the wavefront size will default to 64, which is actually
      variable. We should not expose these macros unless it is known.
      f2a78e68
    • Cyndy Ishida's avatar
      [TextAPI] Fix -Wdocumentation error, NFC · 97d72839
      Cyndy Ishida authored
      97d72839
    • Louis Dionne's avatar
      [libc++] Move __libcpp_timespec_t into namespace std (#80004) · e1ddc333
      Louis Dionne authored
      It was previously defined outside of namespace std for apparently no
      good reason.
      e1ddc333
    • Aaron Ballman's avatar
      Revert "[clang] static operators should evaluate object argument (#68485)" · 201eb2b5
      Aaron Ballman authored
      This reverts commit 30155fc0.
      
      It seems to have broken some tests in clangd:
      http://45.33.8.238/linux/129484/step_9.txt
      201eb2b5
    • Guray Ozen's avatar
    • Alexey Bataev's avatar
      [SLP]Fix PR80027: Fix costs processing for minbitwidth types. · 285bc698
      Alexey Bataev authored
      Need to switch the types, the destination is first in getCastInstrCost
      function.
      285bc698
    • Saiyedul Islam's avatar
      [OpenMP52][LIBOMPTARGET] Do not throw error in omp_get_mapped_ptr for the host (#80038) · 5f6640e2
      Saiyedul Islam authored
      OpenMP spec 5.2 specifies return value to be the host ptr
      in case of device_num being same as omp_get_initial_device().
      5f6640e2
    • Craig Topper's avatar
      [RISCV] Use Twine concatentation for error messages in RISCVISAInfo. (#79956) · 2e165009
      Craig Topper authored
      This avoids converting StringRef to std::string to const char*.
      2e165009
    • Piyou Chen's avatar
      Recommit "[RISCV] Relax march string order constraint (#78120)" · 7dc7fc08
      Piyou Chen authored
      With std::move added to fix build bot failure.
      
      Original commit message:
      
      Follow
      https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/14 by
      dropping the order requirement of `-march`.
      
      1. single-letter extension can be arbitrary order
          - march=rv32iamdf
      2. single-letter extension and multi-letter extension can be mixed
          - march=rv32i_zihintntl_m_a_f_d_svinval
      3. multi-letter extension need seperate the following extension by
      underscore, otherwise it will be intreprete as one extension.
          - march=rv32i_zbam -> i,zbam
          - march=rv32i_zba_m -> i,zba,m
      7dc7fc08
    • Pil Eghoff's avatar
      [Sema] Fix c23 not checking CheckBoolLikeConversion (#79588) · dcc37e79
      Pil Eghoff authored
      Fixes issue #79435 
      
      Checks for implicit conversion into boolean was previously triggered by
      `CheckBoolLikeConversion` for C.
      When `bool` as a keyword was introduced in C23,
      `CheckBoolLikeConversion` would no longer trigger when using `-std=c23`,
      but since logical operators and conditional statements still operate on
      scalar values, the checks for implicit conversion into bool were never
      triggered.
      
      This fix changes `CheckBoolLikeConversion` to not return early for C23,
      even though it has support for bools.
      dcc37e79
    • Nathan Lanza's avatar
      [profgen] Use a 64bit integer for &'ing the loadable address (#79930) · 7ff2dc3b
      Nathan Lanza authored
      For the linux kernel, the loadable segments start at 0xffff... and thus
      the 32 bit integer here was truncating all the meaningful bits. Grow it
      to 64 bits.
      7ff2dc3b
    • Tianlan Zhou's avatar
      [clang] static operators should evaluate object argument (#68485) · 30155fc0
      Tianlan Zhou authored
      
      
      ### Description
      
      clang don't evaluate the object argument of `static operator()` and
      `static operator[]` currently, for example:
      
      ```cpp
      #include <iostream>
      
      struct Foo {
          static int operator()(int x, int y) {
              std::cout << "Foo::operator()" << std::endl;
              return x + y;
          }
          static int operator[](int x, int y) {
              std::cout << "Foo::operator[]" << std::endl;
              return x + y;
          }
      };
      Foo getFoo() {
          std::cout << "getFoo()" << std::endl;
          return {};
      }
      int main() {
          std::cout << getFoo()(1, 2) << std::endl;
          std::cout << getFoo()[1, 2] << std::endl;
      }
      ```
      
      `getFoo()` is expected to be called, but clang don't call it currently
      (17.0.2). This PR fixes this issue.
      
      Fixes #67976.
      
      ### Walkthrough
      
      - **clang/lib/Sema/SemaOverload.cpp**
      - **`Sema::CreateOverloadedArraySubscriptExpr` &
      `Sema::BuildCallToObjectOfClassType`**
      Previously clang generate `CallExpr` for static operators, ignoring the
      object argument. In this PR `CXXOperatorCallExpr` is generated for
      static operators instead, with the object argument as the first
      argument.
        - **`TryObjectArgumentInitialization`**
      `const` / `volatile` objects are allowed for static methods, so that we
      can call static operators on them.
      - **clang/lib/CodeGen/CGExpr.cpp**
        - **`CodeGenFunction::EmitCall`**
      CodeGen changes for `CXXOperatorCallExpr` with static operators: emit
      and ignore the object argument first, then emit the operator call.
      - **clang/lib/AST/ExprConstant.cpp**
        - **`‎ExprEvaluatorBase::handleCallExpr‎`**
      Evaluation of static operators in constexpr also need some small changes
      to work, so that the arguments won't be out of position.
      - **clang/lib/Sema/SemaChecking.cpp**
        - **`Sema::CheckFunctionCall`**
      Code for argument checking also need to be modify, or it will fail the
      test `clang/test/SemaCXX/overloaded-operator-decl.cpp`.
      
      ### Tests
      
      - **Added:**
          - **clang/test/AST/ast-dump-static-operators.cpp**
            Verify the AST generated for static operators.
          - **clang/test/SemaCXX/cxx2b-static-operator.cpp**
      Static operators should be able to be called on const / volatile
      objects.
      - **Modified:**
          - **clang/test/CodeGenCXX/cxx2b-static-call-operator.cpp**
          - **clang/test/CodeGenCXX/cxx2b-static-subscript-operator.cpp**
            Matching the new CodeGen.
      
      ### Documentation
      
      - **clang/docs/ReleaseNotes.rst**
        Update release notes.
      
      ---------
      
      Co-authored-by: default avatarShafik Yaghmour <shafik@users.noreply.github.com>
      Co-authored-by: default avatarcor3ntin <corentinjabot@gmail.com>
      Co-authored-by: default avatarAaron Ballman <aaron@aaronballman.com>
      30155fc0
    • michaelrj-google's avatar
      [reland][libc] add epoll_wait functions (#79635) · 9f3854a0
      michaelrj-google authored
      The epoll_wait functions are syscall wrappers that were requested by
      upstream users. This patch adds them, as well as their header and types.
      
      The tests are currently incomplete since they require epoll_create to
      properly test epoll_wait. That will be added in a followup patch since
      this one is already very large.
      9f3854a0
    • Felipe de Azevedo Piovezan's avatar
      [DebugNames] Use hashes to quickly filter false positives (#79755) · 69cb99f9
      Felipe de Azevedo Piovezan authored
      The current implementation of DebugNames is _only_ using hashes to
      compute the bucket number. Once inside the bucket, it reverts back to
      string comparisons, even though not all hashes inside a bucket are
      identical.
      
      This commit changes the behavior so that we check the hash before
      comparing strings. Such check is so important that it speeds up a simple
      benchmark by 20%. In other words, the following expression evaluation
      time goes from 1100ms to 850ms.
      
      ```
      bin/lldb \
      		--batch \
      		-o "b CodeGenFunction::GenerateCode" \
      		-o run \
      		-o "expr Fn" \
      		-- \
      		clang++ -c -g test.cpp -o /dev/null &> output
      ```
      
      (Note, these numbers are considering the usage of IDX_parent)
      69cb99f9
    • Craig Topper's avatar
      [ValueTracking] Add experimental_get_vector_length to isKnownNonZero. (#79950) · d8e1b451
      Craig Topper authored
      If the input is non-zero, this intrinsic should also return a non-zero
      value.
      d8e1b451
    • Craig Topper's avatar
      [RISCV] Remove StackAlign attribute enum. NFC (#79946) · 80ee6083
      Craig Topper authored
      The alignment is directly encoded in the attribute. There doesn't seem
      to be a good reason to give the possible alignments a name.
      80ee6083
    • Craig Topper's avatar
      [IR] Add more efficient getOperand methods to some of the Operator subclasses. (#79943) · 8369f619
      Craig Topper authored
      ConstantExpr does not use HungOffUses. If we know that the Instruction
      the Operator subclass can represent also does not use HungOffUses, we
      can be more efficient than falling back to User::getOperand.
      8369f619
    • Zixu Wang's avatar
    • fabrizio-indirli's avatar
      [mlir][scf] Relax requirements for loops fusion (#79187) · d17b005e
      fabrizio-indirli authored
      
      
      Enable the fusion of parallel loops also when the 1st loop contains
      multiple write accesses to the same buffer, if the accesses are always
      on the same indices.
      Fix LIT test cases whose loops were not being fused.
      
      Signed-off-by: default avatarFabrizio Indirli <Fabrizio.Indirli@arm.com>
      d17b005e
    • Wanyi's avatar
      [llvm-gsymutil] Remove '--num-threads' in test (#79934) · 036a20cc
      Wanyi authored
      Number of threads will automatically be set to a good value
      036a20cc
    • Vyacheslav Levytskyy's avatar
      fix producing multiple identical opaque pointer types (#79060) · 9e02e8f1
      Vyacheslav Levytskyy authored
      This PR fixes https://github.com/llvm/llvm-project/issues/79057 and
      improves code generation for opaque pointers by replacing the culprit
      SPIRVGlobalRegistry::getOpTypePointer() call with a more appropriate
      SPIRVGlobalRegistry::getOrCreateSPIRVPointerType() call. The latter
      function works together with the `DuplicatesTracker`
      (`SPIRVGeneralDuplicatesTracker DT;` from `class SPIRVGlobalRegistry`)
      to trace existence of previous definitions of opaque pointers. This
      allows to produce just one `OpTypePointer` command for all identical
      opaque pointers definitions and to return the very same type record for
      subsequent `SPIRVGlobalRegistry::createSPIRVType()` invocations.
      
      This PR alone improves code generation by producing a single needed
      definition per all opaque pointers to i8 of the same address space
      instead of multiple identical definitions produced before the patch.
      From the root cause analysis of
      https://github.com/llvm/llvm-project/issues/79057 we see also that this
      PR resolves the problem of inconsistency between keeping multiple
      instruction for identical opaque pointer types and just a single record
      for all such instructions in the `DuplicatesTracker`, and so it also
      resolves the issue with crashes on creation of a struct with opaque
      pointer fields due to the fact that now such struct fields refer to the
      same operand `<id>` having a required record in the data structure used
      for dependencies analysis (see
      https://github.com/llvm/llvm-project/issues/79057).
      9e02e8f1
    • Vyacheslav Levytskyy's avatar
      prevent undefined behaviour of SPIR-V Backend non-asserts builds when dealing... · 39483797
      Vyacheslav Levytskyy authored
      prevent undefined behaviour of SPIR-V Backend non-asserts builds when dealing with token type (#78437)
      
      The goal of this PR is to fix the issue when use of token type in LLVM
      intrinsic causes undefined behavior of SPIR-V Backend code generator
      when assertions are disabled:
      https://github.com/llvm/llvm-project/issues/78434
      
      Among possible fix options, discussed in the
      https://github.com/llvm/llvm-project/issues/78434 issue description, the
      option to generate a meaningful error before execution arrives at the
      `llvm_unreachable` call looks like a better solution for now, because
      SPIR-V doesn't support token type anyway without additional extensions.
      
      The PR is to generate a user-friendly error message and exit without
      generating a stack dump when such a usage of token type was detected
      that would lead to undefined behavior of SPIR-V Backend code generator.
      39483797
    • Vyacheslav Levytskyy's avatar
      generate a name of an unnamed global variable for Instruction Selection (#78293) · b9d62310
      Vyacheslav Levytskyy authored
      The goal of this PR is to fix the issue of global unnamed variables
      causing SPIR-V Backend code generation to crash:
      https://github.com/llvm/llvm-project/issues/78278
      
      The reason for the crash is that GlobalValue's getGlobalIdentifier()
      would fail for unnamed global variable when trying to access the first
      character of the name (see lib/IR/Globals.cpp:150). This leads to assert
      in Debug and undefined behaviour in Release builds.
      
      The proposed fix generates a name of an unnamed global variable as
      __unnamed_<unsigned number>, in a style of similar existing LLVM
      implementation (see lib/IR/Mangler.cpp:131). A new class member variable
      is added into `SPIRVInstructionSelector` class to keep track of the
      number we give to anonymous global values to generate the same name
      every time when this is needed.
      
      The patch adds a new LIT test with the smallest implementation of
      reproducer ll code.
      b9d62310
    • Joel Wee's avatar
      [mlir] Fix after #75103 · fe0d16ff
      Joel Wee authored
      fe0d16ff
    • Daniel Chen's avatar
      [Flang]: Lowering reference to functions that return a procedure pointer (#78194) · cdb320b4
      Daniel Chen authored
      
      
      This PR adds lowering the reference to a function that returns a
      procedure pointer. It also fixed intrinsic ASSOCIATED to take such
      argument.
      
      ---------
      
      Co-authored-by: default avatarjeanPerier <jperier@nvidia.com>
      cdb320b4
    • Nick Desaulniers's avatar
      [libc][docs] add page for stdbit.h (#79908) · 223025a6
      Nick Desaulniers authored
      To build libc docs:
      - Configure with `-DLLVM_ENABLE_SPHINX=ON -DLIBC_INCLUDE_DOCS=ON`
      - Build with `ninja docs-libc-html`
      223025a6
    • Matthias Springer's avatar
      [mlir] Fix build after #75103 · c5edef62
      Matthias Springer authored
      After #75103, `MLPrgramTransforms` depends on `BufferizationDialect`.
      Also fix an unrelated compile error in `GreedyPatternRewriteDriver.cpp`.
      (This was not failing on CI. I may be running an old compiler locally.)
      c5edef62
    • Shengchen Kan's avatar
      [X86][NFC] Extract code for commute in foldMemoryOperandImpl into functions · 2960656e
      Shengchen Kan authored
      To share code for folding broadcast in #79761
      2960656e
    • Thomas Preud'homme's avatar
      Fix TOSA FP16->INT16 CAST lowering (#79299) · b23e518c
      Thomas Preud'homme authored
      Currently cast from FP to int is implemented by clamping on the min and
      max
      integer values in the floating-point domain and then converting to
      integer. However, the max int values are often non representable in the
      floating-point input type due to lack of mantissa bits.
      
      This patch instead use a select acting on a compare against max int + 1
      which is representable in floating-point. It also has a special lowering
      for cases where the integer range is wider than the floating-point range
      to clamp the infinite values.
      b23e518c
    • Stefan Gränitz's avatar
      [llvm-jitlink] Fix detectStubKind() for big endian systems (#79970) · 8a5bdd89
      Stefan Gränitz authored
      This function is used in `jitlink-check` lines in LIT tests. In #78371 I
      missed to swap initial instruction bytes for systems that store the
      constants as big-endian.
      8a5bdd89
  2. Jan 30, 2024