1. Apr 06, 2024
    • Amara Emerson's avatar
      [GlobalISel] Don't form anyextending atomic loads. · 60fc4ac6
      Amara Emerson authored
      Until we can reliably check the legality and improve our selection of these,
      don't form them at all.
      60fc4ac6
    • Craig Topper's avatar
      [RISCV] Add tests for opportunities to reassociate to form more shXadd instructions. NFC · 4abb722f
      Craig Topper authored
      These tests consist of patterns like (sh3add Z, (add X, (slli Y, 6)))
      that can be reassociated to form (sh3add (sh3add Y, Z), X).
      4abb722f
    • Craig Topper's avatar
      [RISCV] Add Zca predicate to BrccCompressOpt patterns used for MinSize. · 0a6a40d6
      Craig Topper authored
      Previously we only checked for C.
      0a6a40d6
    • Craig Topper's avatar
      [RISCV] Remove uses of sed from compress-opt-branch.ll. NFC · e7e78274
      Craig Topper authored
      sed was being used to use the same test functions with eq/ne branch
      condition.
      
      This commit duplicates the test functions so that we have a version
      with each condition. This allows us to remove 2 RUN lines.
      
      I plan to add a Zca testing to this file which now requires 1 new
      RUN line instead of 2.
      e7e78274
    • Slava Zakharin's avatar
    • Shourya Goel's avatar
      reland: [libc] Added transitive bindings for OffsetType (#87680) · 9f075840
      Shourya Goel authored
      
      Followup to issues addressed here: #87397
      9f075840
    • Haojian Wu's avatar
      [clang] CTAD: build aggregate deduction guides for alias templates. (#85904) · 5e77dfec
      Haojian Wu authored
      Fixes https://github.com/llvm/llvm-project/issues/85767.
      
      The aggregate deduction guides are handled in a separate code path. We
      don't generate dedicated aggregate deduction guides for alias templates
      (we just reuse the ones from the underlying template decl by accident).
      The patch fixes this incorrect issue.
      
      Note: there is a small refactoring change in this PR, where we move the
      cache logic from `Sema::DeduceTemplateSpecializationFromInitializer` to
      `Sema::DeclareImplicitDeductionGuideFromInitList`
      5e77dfec
    • Daniel Paoliello's avatar
      Prepend all library intrinsics with `#` when building for Arm64EC (#87542) · 43ba568d
      Daniel Paoliello authored
      While attempting to build some Rust code, I was getting linker errors
      due to missing functions that are implemented in `compiler-rt`. Turns
      out that when `compiler-rt` is built for Arm64EC, all its function names
      are mangled with the leading `#`.
      
      This change removes the hard-coded list of library-implemented
      intrinsics to mangle for Arm64EC, and instead assumes that they all must
      be mangled.
      43ba568d
    • Hristo Hristov's avatar
    • Craig Topper's avatar
      [RISCV] Fix comment in compress-opt-branch.ll to match description. NFC · 3c37f926
      Craig Topper authored
      Test description says constant does not fit in 12 bits, but the constant
      used was -2048 which does fit in 12 bits. Update to -2049.
      
      Also remove uses of -NOT in favor of positive checks. One of the -NOT
      should have been using RESBROPT instead of "c.beqz" so that it would
      check for the absense of the correct instruction based on the sed
      replacement on the RUN line.
      3c37f926
    • Daniil Kovalev's avatar
      [test][lld][ELF] Enhance pack-dyn-relocs.s test (#87756) · 3989e224
      Daniil Kovalev authored
      Use symbol `.data` (STT_SECTION) instead of `__ehdr_start` for some
      relocation entries. See discussion in
      
      [72714/#discussion_r1517127619](https://github.com/llvm/llvm-project/pull/72714/#discussion_r1517127619)
      3989e224
    • Chris B's avatar
      [HLSL] Implement floating literal suffixes (#87270) · 0a0fccfc
      Chris B authored
      This change implements the HLSL floating literal suffixes for half and
      double literals. The PR for the HLSL language specification for this
      behavior is https://github.com/microsoft/hlsl-specs/pull/175.
      
      The TL;DR is that the `h` suffix on floating literals means `half`, and
      the `l` suffix means `double`.
      
      The expected behavior and diagnostics are different if native half is
      supported. When native half is not enabled half is 32-bit so implicit
      conversions to float do not lose precision and do not warn.
      
      In all cases `half` and `float` are distinct types.
      
      Resolves #85712
      0a0fccfc
    • Dmitry Vasilyev's avatar
      [Support][Windows] Use the original path if GetFinalPathNameByHandleW() failed (#87749) · 225e14e5
      Dmitry Vasilyev authored
      The commit f11b056c (#76304) breaks `clang` and other tools if they are
      used from a RAMDrive. `GetFinalPathNameByHandleW()` may return 0 and
      GetLastError 0x28. This patch fixes that issue. Note `real_path()` uses
      `openFileForRead()` but it reports the error only if failed to open a
      file. Getting `RealPath` is optional functionality.
      
      BTW, `sys::fs::real_path()` resolves not only symlinks, but also network
      drives and virtual drives created by the `subst` tool. It may break an
      automation. It is better to detect symlinks and resolve only symlinks.
      225e14e5
    • David Green's avatar
      e4169f79
    • Alexey Bataev's avatar
      [SLP]Improve minbitwidth analysis for abs/smin/smax/umin/umax intrinsics. · 66b52807
      Alexey Bataev authored
      https://alive2.llvm.org/ce/z/ivPZ26 for the abs transformations.
      
      Reviewers: RKSimon
      
      Reviewed By: RKSimon
      
      Pull Request: https://github.com/llvm/llvm-project/pull/86135
      66b52807
    • Haojian Wu's avatar
      [Sema] Remove the duplicated `DeduceTemplateArguments` for partial specialization, NFC (#87782) · 9264c85b
      Haojian Wu authored
      We have two identical "DeduceTemplateArguments" implementations for
      class and variable partial template specializations, this patch removes
      the duplicated code.
      9264c85b
    • Aaron Ballman's avatar
      [C99] Claim conformance to WG14 N717 (#87228) · 2606c877
      Aaron Ballman authored
      This was the paper that added Universal Character Names to C.
      2606c877
    • Fangrui Song's avatar
      [ELF,test] Add test for R_AARCH64_* implicit addends · e915b7d8
      Fangrui Song authored
      to support certain static relocations in the REL format. See #87328 for
      the armasm need.
      
      Note: `R_AARCH64_{ABS64,PREL32,PREL64}` have been implemented by https://reviews.llvm.org/D120535
      
      Pull Request: https://github.com/llvm/llvm-project/pull/87733
      e915b7d8
    • Arthur Eubanks's avatar
      [gn build] Add missing dependency · 5772fc89
      Arthur Eubanks authored
      5772fc89
    • Arthur Eubanks's avatar
      [gn build] Port f5960c16 · 965e053e
      Arthur Eubanks authored
      965e053e
    • Arthur Eubanks's avatar
      [gn build] Port e84a7572 · 6411aaf9
      Arthur Eubanks authored
      6411aaf9
    • Arthur Eubanks's avatar
      [gn build] Port 30f6eafa · 666fd665
      Arthur Eubanks authored
      666fd665
    • Arthur Eubanks's avatar
      [gn build] Manually port 68b939f9 · 0e60cf7f
      Arthur Eubanks authored
      0e60cf7f
    • Argyrios Kyrtzidis's avatar
      [clang][deps] Remove pgo profile flags from modules (#87724) · c7eede5d
      Argyrios Kyrtzidis authored
      These are not necessary when not performing codegen.
      c7eede5d
    • Ian Anderson's avatar
      [clang][modules] Headers meant to be included multiple times can be completely... · 0cd0aa02
      Ian Anderson authored
      [clang][modules] Headers meant to be included multiple times can be completely invisible in clang module builds (#83660)
      
      Once a file has been `#import`'ed, it gets stamped as if it was `#pragma
      once` and will not be re-entered, even on #include. This means that any
      errant #import of a file designed to be included multiple times, such as
      <assert.h>, will incorrectly mark it as include-once and break the
      multiple include functionality. Normally this isn't a big problem, e.g.
      <assert.h> can't have its NDEBUG mode changed after the first #import,
      but it is still mostly functional. However, when clang modules are
      involved, this can cause the header to be hidden entirely.
      
      Objective-C code most often uses #import for everything, because it's
      required for most Objective-C headers to prevent double inclusion and
      redeclaration errors. (It's rare for Objective-C headers to use macro
      guards or `#pragma once`.) The problem arises when a submodule includes
      a multiple-include header. The "already included" state is global across
      all modules (which is necessary so that non-modular headers don't get
      compiled into multiple translation units and cause redeclaration
      errors). If another module or the main file #import's the same header,
      it becomes invisible from then on. If the original submodule is not
      imported, the include of the header will effectively do nothing and the
      header will be invisible. The only way to actually get the header's
      declarations is to somehow figure out which submodule consumed the
      header, and import that instead. That's basically impossible since it
      depends on exactly which modules were built in which order.
      
      #import is a poor indicator of whether a header is actually
      include-once, as the #import is external to the header it applies to,
      and requires that all inclusions correctly and consistently use #import
      vs #include. When modules are enabled, consider a header marked
      `textual` in its module as a stronger indicator of multiple-include than
      #import's indication of include-once. This will allow headers like
      <assert.h> to always be included when modules are enabled, even if
      #import is erroneously used somewhere.
      0cd0aa02
    • Erich Keane's avatar
      [OpenACC][NFC] Add OpenACC Clause AST Nodes/infrastructure (#87675) · 30f6eafa
      Erich Keane authored
      As a first step in adding clause support for OpenACC to Semantic
      Analysis, this patch adds the 'base' AST nodes required for clauses.
      
      This patch has no functional effect at the moment, but followup patches
      will add the semantic analysis of clauses (plus individual clauses).
      30f6eafa
    • Jakub Chlanda's avatar
      [NFC][Doc] Fix typo in new pass manager snippet (#87765) · b7593b2e
      Jakub Chlanda authored
      Add missing closing parenthesis and re-flow the snippet to what clang
      format would generate.
      b7593b2e
    • Cassie Jones's avatar
      [driver] Make --version show if assertions, etc. are enabled (#87585) · 68b939f9
      Cassie Jones authored
      It's useful to have some significant build options visible in the
      version when investigating problems with a specific compiler artifact.
      This makes it easy to see if assertions, expensive checks, sanitizers,
      etc. are enabled when checking a compiler version.
      
      Example config line output:
      Build configuration: +unoptimized, +assertions, +asan, +ubsan
      68b939f9
    • Eric Li's avatar
      [libTooling] Fix `getFileRangeForEdit` for inner nested template types (#87673) · 345c4822
      Eric Li authored
      When there is `>>` in source from the right brackets of a nested
      template, the end location of the inner template points into a scratch
      space with a single `>` token. This prevents the lexer from seeing the
      `>>` token in the original source.
      
      However, this causes the range to appear to be partially in a macro, and
      is problematic if we are trying to avoid ranges with any macro
      expansions.
      
      This change detects these split tokens in token ranges, converting it to the
      corresponding character range without the expansion.
      345c4822
    • Paul Kirth's avatar
      [llvm][NFC] Update URL in comment about Android ABI · f0724f07
      Paul Kirth authored
      The previous URL was stale, and referenced 'master' instead of 'main',
      which will never be updated.
      
      Reviewers: topperc, enh-google
      
      Reviewed By: enh-google
      
      Pull Request: https://github.com/llvm/llvm-project/pull/87726
      f0724f07
    • Fangrui Song's avatar
      [llvm-ranlib] Change -v (alias for --version) to -V · 7e4883f8
      Fangrui Song authored
      -V prints the version information in both BSD and GNU ar/ranlib.
      
      BSD ranlib rejects -v while -v enables verbose output in GNU ar but is
      another alias for --version in GNU ranlib. The GNU ranlib behavior is
      inconsistent: `ranlib -v` is different from `ar -sv`. But it's not a
      major concern in practice:
      
      * Users typically use ranlib solely for creating archive symbol tables,
        and they don't need verbose output.
      * Verbose output in ranlib seems a no-op.
      * GNU ar creates an archive symbol table by default. Many ranlib uses
        have been eliminated.
      * Modern linkers like lld/ELF (since version 14) and mold don't rely on
        archive symbol tables anymore.
      
      https://reviews.llvm.org/D71554 introduced -v. This patch removes it so
      that `llvm-ranlib -v` and `llvm-ranlib -version` lead to errors (GNU
      ranlib rejects `-version` as well). -V is added as an alias for
      --version.
      
      Close #87654
      
      Pull Request: https://github.com/llvm/llvm-project/pull/87661
      7e4883f8
    • Eric's avatar
      Fix issue with never-constexpr __construct_at in C++ < 20. (#87403) · 29cc80f4
      Eric authored
      The application of constexpr to __construct_at triggers weird linker
      errors when building LLVM with modules enabled and C++ < 20.
      
      > ld.lld: error: undefined hidden symbol: void*
      std::__1::__voidify[abi:nn190000]<llvm::sys::ProcessStatistics>(llvm::sys::ProcessStatistics&)
      >>>> referenced by construct_at.h:52
      (/usr/local/bin/../include/c++/v1/__memory/construct_at.h:52)
      >>>> Program.cpp.o:(llvm::sys::Wait(llvm::sys::ProcessInfo const&,
      std::__1::optional<unsigned int>, std::__1::basic_string<char,
      std::__1::char_traits<char>, std::__1::allocator<char>>*,
      std::__1::optional<llvm::sys::ProcessStatistics>*, bool)) in archive
      lib/libLLVMSupport.a
      
      I suspect this is related to undefined behavior caused by the fact that
      construct_at is never really constexpr (which is UB NDR).
      
      I'm unsure how to meaningfully write a test for this, as I haven't been
      able to trigger it in smaller unit tests
      29cc80f4
    • Lang Hames's avatar
      [ORC] Fix an EDU-update bug in ExecutionSession::IL_failSymbols. · a671ceec
      Lang Hames authored
      We were catching a local variable, SymMI, by value instead of by reference
      during EDU cleanup and this was leaving the dependence graph in an
      inconsistent state that could lead to crashes on subsequent emits. Fixing this
      bug required us to also avoid aliasing between SymMI and MI (which would have
      caused cleanup to clear the MI.DependantEDUs set that we're iterating over).
      
      No testcase: the crash only triggered in very specific circumstances
      (including concurrent linking) in an out-of-tree ORC client. I'm working on a
      session state verifier that could be turned on when compiling with
      expensive-checks turned on and that should help us catch issues like this in
      the future.
      
      rdar://125164262
      
      Coding my way home: 0.89527S, 89.61313W
      a671ceec
    • Valentin Clement (バレンタイン クレメン)'s avatar
      [flang][cuda] Lower device to host and device to device transfer (#87387) · 953aa102
      Add more support for CUDA data transfer in assignment. This patch adds
      device to device and device to host support. If device symbols are
      present on the rhs, some implicit data transfer are initiated. A
      temporary is created and the data are transferred to the host. The
      expression is evaluated on the host and the assignment is done.
      953aa102
    • Vitaly Buka's avatar
      [clang][CodeGen] Guard ubsan checks with `llvm.allow.ubsan.check` (#87436) · 5f9ed2ff
      Vitaly Buka authored
      Intrinsic inserted into CodeGenFunction::EmitCheck, which
      is not mostly used by CFI.
      
      CFI is not the goal, and fixing inconsistencies with CFI is outside of
      the cope of the patch.
      
      RFC:
      https://discourse.llvm.org/t/rfc-add-llvm-experimental-hot-intrinsic-or-llvm-hot/77641
      5f9ed2ff
    • Brian Cain's avatar
      [libcxx] coerce formatter precision to int (#87738) · e1830f58
      Brian Cain authored
      __precision_ is declared as an int32_t which on some hexagon platforms
      is defined as a long.
      
      This change fixes errors like the ones below:
      
      In file included from
      /local/mnt/workspace/hex/llvm-project/libcxx/test/libcxx/diagnostics/format.nodiscard_extensions.compile.pass.cpp:19:
      In file included from
      /local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/format:202:
      In file included from
      /local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/format_functions.h:29:
      
      /local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/formatter_floating_point.h:700:17:
      error: no matching function for call to 'max'
      700 | int __p = std::max(1, (__specs.__has_precision() ?
      __specs.__precision_ : 6));
                |                 ^~~~~~~~
      
      /local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/formatter_floating_point.h:771:25:
      note: in instantiation of function template specialization
      'std::__formatter::__format_floating_point<float, char,
      std::format_context>' requested here
      771 | return __formatter::__format_floating_point(__value, __ctx,
      __parser_.__get_parsed_std_specifications(__ctx));
                |                         ^
      
      /local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/format_functions.h:284:42:
      note: in instantiation of function template specialization
      'std::__formatter_floating_point<char>::format<float,
      std::format_context>' requested here
      284 | __ctx.advance_to(__formatter.format(__arg, __ctx));
                |                                          ^
      
      /local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/format_functions.h:429:15:
      note: in instantiation of function template specialization
      'std::__vformat_to<std::back_insert_iterator<std::string>, char,
      std::back_insert_iterator<std::__format::__output_buffer<char>>>'
      requested here
      429 | return std::__vformat_to(std::move(__out_it), __fmt, __args);
                |               ^
      
      /local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__format/format_functions.h:462:8:
      note: in instantiation of function template specialization
      'std::vformat_to<std::back_insert_iterator<std::string>>' requested here
            462 |   std::vformat_to(std::back_inserter(__res), __fmt, __args);
                |        ^
      
      /local/mnt/workspace/hex/llvm-project/libcxx/test/libcxx/diagnostics/format.nodiscard_extensions.compile.pass.cpp:29:8:
      note: in instantiation of function template specialization
      'std::vformat<void>' requested here
             29 |   std::vformat("", std::make_format_args());
                |        ^
      
      /local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__algorithm/max.h:35:1:
      note: candidate template ignored: deduced conflicting types for
      parameter '_Tp' ('int' vs. 'int32_t' (aka 'long'))
      35 | max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND
      const _Tp& __b) {
                | ^
      
      /local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__algorithm/max.h:43:1:
      note: candidate template ignored: could not match
      'initializer_list<_Tp>' against 'int'
             43 | max(initializer_list<_Tp> __t, _Compare __comp) {
                | ^
      
      /local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__algorithm/max.h:48:86:
      note: candidate function template not viable: requires single argument
      '__t', but 2 arguments were provided
      48 | _LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI
      _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp max(initializer_list<_Tp> __t) {
      | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
      
      /local/mnt/workspace/hex/obj_runtimes_hex88_qurt_v75_ON_ON_shared/include/c++/v1/__algorithm/max.h:29:1:
      note: candidate function template not viable: requires 3 arguments, but
      2 were provided
      29 | max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND
      const _Tp& __b, _Compare __comp) {
      | ^
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      e1830f58
  2. Apr 05, 2024