1. Jun 08, 2022
    • Christopher Bate's avatar
      Revert "[mlir][vector] Allow unroll of contraction in arbitrary order" · 53fe155b
      Christopher Bate authored
      Reverts commit 1469ebf8 (original commit)
      Reverts commit a392a39f (build fix for above commit)
      
      The commit broke tests in out-of-tree projects, indicating that some logical
      error was made in the previous change but not covered by current tests.
      53fe155b
    • Jason Molenda's avatar
      Track transition from launch dyld to shared-cache dyld · 8d5a6007
      Jason Molenda authored
      On macOS, a process will be launched with /usr/lib/dyld (the
      dynamic linker) and the main binary by the kernel.  The
      first thing the standalone dyld will do is call into the dyld
      in the shared cache image.  This patch tracks the transition
      between the dyld's at the very beginning of process startup.
      
      In DynamicLoaderMacOS::NotifyBreakpointHit() there are two new
      cases handled:
      
      `dyld_image_dyld_moved` which is the launch /usr/lib/dyld indicating
      that it is about call into the shared cache dyld ane evict itself.
      lldb will remove the notification breakpoint it set, clear the binary
      image list entirely, get the notification function pointer value out
      of the dyld_all_image_infos struct (which is the notification fptr
      in the to-be-run shared-cache dyld) and put an address breakpoint
      there.
      
      `dyld_notify_adding` is then called by shared-cache dyld, and we
      detect this case by noticing that we have an empty binary image list,
      normally impossibe, and treating this as if we'd just started a
      process attach/launch.
      
      Differential Revision: https://reviews.llvm.org/D127247
      rdar://84222158
      8d5a6007
    • Louis Dionne's avatar
      [libc++] Make the Debug mode a configuration-time only option · f3966eaf
      Louis Dionne authored
      The debug mode has been broken pretty much ever since it was shipped
      because it was possible to enable the debug mode in user code without
      actually enabling it in the dylib, leading to ODR violations that
      caused various kinds of failures.
      
      This commit makes the debug mode a knob that is configured when
      building the library and which can't be changed afterwards. This is
      less flexible for users, however it will actually work as intended
      and it will allow us, in the future, to add various kinds of checks
      that do not assume the same ABI as the normal library. Furthermore,
      this will make the debug mode more robust, which means that vendors
      might be more tempted to support it properly, which hasn't been the
      case with the current debug mode.
      
      This patch shouldn't break any user code, except folks who are building
      against a library that doesn't have the debug mode enabled and who try
      to enable the debug mode in their code. Such users will get a compile-time
      error explaining that this configuration isn't supported anymore.
      
      In the future, we should further increase the granularity of the debug
      mode checks so that we can cherry-pick which checks to enable, like we
      do for unspecified behavior randomization.
      
      Differential Revision: https://reviews.llvm.org/D122941
      f3966eaf
    • Philip Reames's avatar
      [GuardWidening] Fix a nasty cast bug in c2eccc67 · 89c4b29e
      Philip Reames authored
      c2eccc67 introduced a call to etHasNoUnsignedWrap which implicitly assumes that Inst is a OverflowingBinaryOperator.  This is frequently untrue, but was not caught because cast<Ty>(X) has been broken, see https://discourse.llvm.org/t/cast-x-is-broken-implications-and-proposal-to-address/63033 for context.
      
      I considered reverting this, but since doing so re-introduces a nasty miscompile of its own, I decided to fix forward instead.
      
      I'll note that this is a particularly nasty form of the cast<Ty>(X) issue.  Because the cast was succeeding unexpected, we were writing data to instructions which weren't OBOs.  This could result in near arbitrary data or memory corruption.  I'm a bit shocked that the sanitizers didn't find this TBH.
      89c4b29e
    • Philip Reames's avatar
      Revert "[MemDep][NFCI] Remove redundant dyn_cast, replace with cast" · 8a0cd233
      Philip Reames authored
      This reverts commit 180d3f25.  This commit is simply wrong.  IsLoad is set within the same file based on modref state, not whether the instruction is a LoadInst.
      
      This went uncaught because cast<Ty>(X) has been broken.  See https://discourse.llvm.org/t/cast-x-is-broken-implications-and-proposal-to-address/63033 for context.
      8a0cd233
    • Sunho Kim's avatar
      [JITLink][AArch64] Refactor isLoadStoreImm12 check out of getPageOffset12Shift. · 9f299161
      Sunho Kim authored
      The separate isLoadStoreImm12 predicate will be used for validating ELF/aarch64
      ldst relocation types.
      
      Reviewed By: lhames, sgraenitz
      
      Differential Revision: https://reviews.llvm.org/D126628
      9f299161
    • Florian Hahn's avatar
      [VPlan] Handle VPInst without underlying instr in VPInterleavedAccess. · b0c9a71b
      Florian Hahn authored
      This violation is hidden while `cast` is missing an isa assertion after
      D123901.
      b0c9a71b
    • Joseph Huber's avatar
      [Binary] Make the OffloadingImage type own the memory · f06731e3
      Joseph Huber authored
      Summary:
      The OffloadingBinary uses a convenience struct to help manage the memory
      that will be serialized using the binary format. This currently uses a
      reference to an existing buffer, but this should own the memory instead
      so it is easier to work with seeing as its only current use requires
      saving the buffer anyway.
      f06731e3
    • Joseph Huber's avatar
      [Binary] Align the image offset in OffloadBinary · 9db2f323
      Joseph Huber authored
      Summary:
      The OffloadBinary wraps around an embedded device image, commonly an ELF
      or LLVM BC file. These file formats have alignment requirements for
      parsing, so if the image is stored at an un-aligned offset from the
      beginning of the file we will be unable to parse the embeded image
      without copying the image buffer. This patch adds alignment padding
      before the binary image is appended to ensure we can parse the symbolic
      file it contains in-place without copying memory.
      9db2f323
    • Aaron Ballman's avatar
      Update the C2x status page from latest working draft · d46e7aec
      Aaron Ballman authored
      This adds the papers for the Jun, Sep, and Dec 2021 meetings. 2022
      papers will be handled in a follow-up.
      d46e7aec
    • Philip Reames's avatar
      Revert "[LLVM][Casting.h] Add trivial self-cast" · 781de11f
      Philip Reames authored
      This reverts commit 0809f638.  The patch appears not to have included corresponding isa<Ty> support.
      
      This was revealed when reintroducing the required isa<Ty> asserts in cast<Ty>.  See https://discourse.llvm.org/t/cast-x-is-broken-implications-and-proposal-to-address/63033 for context.
      
      Here's the template instantiation error:
      In file included from /home/preames/llvm-repo/llvm-project/llvm/unittests/Support/Casting.cpp:9:
      /home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h: In instantiation of ‘static bool llvm::isa_impl<To, From, Enabler>::doit(const From&) [with To = llvm::bar*; From = llvm::bar; Enabler = void]’:
      /home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:110:36:   required from ‘static bool llvm::isa_impl_cl<To, const From*>::doit(const From*) [with To = llvm::bar*; From = llvm::bar]’
      /home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:137:41:   required from ‘static bool llvm::isa_impl_wrap<To, FromTy, FromTy>::doit(const FromTy&) [with To = llvm::bar*; FromTy = const llvm::bar*]’
      /home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:129:13:   required from ‘static bool llvm::isa_impl_wrap<To, From, SimpleFrom>::doit(const From&) [with To = llvm::bar*; From = const llvm::bar* const; SimpleFrom = const llvm::bar*]’
      /home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:263:62:   required from ‘static bool llvm::CastIsPossible<To, From, Enable>::isPossible(const From&) [with To = llvm::bar*; From = const llvm::bar*; Enable = void]’
      /home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:517:38:   required from ‘static bool llvm::CastInfo<To, From, typename std::enable_if<(! llvm::is_simple_type<From>::value), void>::type>::isPossible(From&) [with To = llvm::bar*; From = llvm::bar* const]’
      /home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:556:46:   required from ‘bool llvm::isa(const From&) [with To = llvm::bar*; From = llvm::bar*]’
      /home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:585:3:   required from ‘decltype(auto) llvm::cast(From*) [with To = llvm::bar*; From = llvm::bar]’
      /home/preames/llvm-repo/llvm-project/llvm/unittests/Support/Casting.cpp:181:27:   required from here
      /home/preames/llvm-repo/llvm-project/llvm/include/llvm/Support/Casting.h:64:64: error: ‘classof’ is not a member of ‘llvm::bar*’
         64 |   static inline bool doit(const From &Val) { return To::classof(&Val); }
      781de11f
    • Martin Sebor's avatar
      [InstCombine] Fold memchr of sequences of same characters · dd2a6d78
      Martin Sebor authored
      Enhance memchr libcall folder to handle constant arrays consisting
      of one or two sequences of cosecutive equal characters.
      
      Reviewed By: nikic
      
      Differential Revision: https://reviews.llvm.org/D126515
      dd2a6d78
    • Martin Sebor's avatar
      [InstCombine] Add substr helper function (NFC). · fb6627fa
      Martin Sebor authored
      Reviewed By: nikic
      
      Differential Revision: https://reviews.llvm.org/D126515
      fb6627fa
    • Sam Estep's avatar
      [clang][dataflow][NFC] Fix filename typos in tests · dcb4950d
      Sam Estep authored
      Reviewed By: ymandel
      
      Differential Revision: https://reviews.llvm.org/D127008
      dcb4950d
    • Joe Nash's avatar
      Reland [AMDGPU] gfx11 vop3dpp instructions · e243ead6
      Joe Nash authored
      There was an issue with encoding wide (>64 bit) instructions on
      BigEndian hosts, which is fixed in D127195. Therefore reland this.
      
      gfx11 adds the ability to use dpp modifiers on vop3 instructions.
      This patch adds machine code layer support for that. The MCCodeEmitter
      is changed to use APInt instead of uint64_t to support these wider
      instructions.
      
      Patch 16/N for upstreaming of AMDGPU gfx11 architecture
      
      Differential Revision: https://reviews.llvm.org/D126483
      e243ead6
    • Derek Schuff's avatar
      [WebAssembly] Add WASM_SEC_LAST_KNOWN to BinaryFormat section types list [NFC] · 2ae385e5
      Derek Schuff authored
      There are 3 places where we were using WASM_SEC_TAG as the "last" known
      section type, which requires updating (or leaves a bug) when a new known
      section type is added. Instead add a "last type" to the enum for this
      purpose.
      
      Differential Revision: https://reviews.llvm.org/D127164
      2ae385e5
    • Sunho Kim's avatar
      [JITLink][ELF][AArch64] Lift MachO/arm64 edges into aarch64.h, reuse for ELF. · b6553f59
      Sunho Kim authored
      This patch moves the aarch64 fixup logic from the MachO/arm64 backend to
      aarch64.h header so that it can be re-used in the ELF/aarch64 backend. This
      significantly expands relocation support in the ELF/aarch64 backend.
      
      Reviewed By: lhames, sgraenitz
      
      Differential Revision: https://reviews.llvm.org/D126286
      b6553f59
    • William Huang's avatar
      [ValueTracking] Add support to deduce a PHI node being a power of 2 if each... · ba26e45c
      William Huang authored
      [ValueTracking] Add support to deduce a PHI node being a power of 2 if each incoming value is a power of 2.
      
      Reviewed By: davidxl
      
      Differential Revision: https://reviews.llvm.org/D124889
      ba26e45c
    • Reid Kleckner's avatar
      [config] Remove vestigial LLVM_VERSION_INFO · 570e76bb
      Reid Kleckner authored
      This has been superseded by the llvm/Support/VCSRevision.h header. So
      far as I can tell, nothing in the CMake build sets LLVM_VERSION_INFO. It
      was always undefined, and the ifdefs using it were dead. However, CMake
      is very flexible, so it's possible that I missed some ways to set this
      variable. One could, for example, probably pass -DLLVM_VERSION_INFO=x on
      the command line and get that through to configure_file, or set the
      variable in an obscure way (`set(${proj}_VERSION_INFO "x")`). I'm
      reasonably confident that isn't happening, but I'd like a second
      opinion.
      
      Update the Bazel and gn builds accordingly.
      
      Differential Revision: https://reviews.llvm.org/D126977
      570e76bb
    • Reid Kleckner's avatar
      [config] Remove RETSIGTYPE from config.h.cmake, NFC · b1c7889f
      Reid Kleckner authored
      This doesn't need to be configurable. It was hardcoded to void in all
      LLVM build systems.
      b1c7889f
    • Erich Keane's avatar
      [CodeGen] Fix an issue when the 'extern C' replacement names broke · 5c3bde96
      Erich Keane authored
      Originally broken by me in D122608, this is a regression where we
      attempt to replace an extern-C thing with 'itself'.  The problem is that
      we end up deleting it, causing the value to fail when it gets put into
      llvm.used.
      5c3bde96
    • Philip Reames's avatar
      [PointerUnionTest] Fix an incorrectly written test · 4f5648ad
      Philip Reames authored
      The test being change appears to have been intended to exercise PointerUnion, but what it actually did was cast<> a double to a double*.  This only worked because cast<> was missing the required assertion.  Adding the assertion reveals a template error where isa<const double*>(double) fails to compile.
      4f5648ad
    • Kaining Zhong's avatar
      [clang-diff] Fix assertion error when dealing with wide strings · e80748ff
      Kaining Zhong authored
      Directly using StringLiteral::getString for wide string is not
      currently supported; therefore in ASTDiff, getStmtValue will fail when
      asserting that the StringLiteral has a width of 1. This patch also
      covers cases for UTF16 and UTF32 encoding, along with corresponding
      test cases.
      
      Fixes https://github.com/llvm/llvm-project/issues/55771.
      
      Reviewed By: johannes
      
      Differential Revision: https://reviews.llvm.org/D126651
      e80748ff
    • Jay Foad's avatar
      [CodeEmitter] Fix encoding wide instructions on big-endian hosts · 4561352f
      Jay Foad authored
      For instructions wider than 64 bits the InstBits table is initialized in
      64-bit chunks from APInt::getRawData, but it was being read with
      LoadIntFromMemory which is byte-based.
      
      Fix this by reading the table with the APInt constructor that takes an
      ArrayRef to the raw data instead.
      
      This is currently NFC for in-tree targets but fixes AMDGPU failures on
      big-endian hosts that were caused by D126483 until it was reverted.
      
      Differential Revision: https://reviews.llvm.org/D127195
      4561352f
    • David Green's avatar
      [AArch64] Remove isDef32 · bccbf527
      David Green authored
      isDef32 would attempt to make a guess at which SelectionDag nodes were
      32bit sources, and use the nature of 32bit AArch64 instructions
      implicitly zeroing the upper register half to not emit zext that were
      expected to already be zero. This was a bit fragile though, needing to
      guess at the correct opcodes that do not become 32bit defs later in
      ISel.
      
      This patch removed isDef32, relying on the AArch64MIPeephole optimizer
      to remove redundant SUBREG_TO_REG nodes. A part of
      SelectArithExtendedRegister was left with the same logic as a heuristic
      to prevent some regressions from it picking less optimal sequences.
      The AArch64MIPeepholeOpt pass also needs to be taught that a COPY from a
      FPR will become a FMOVSWr, which it lowers immediately to make sure that
      remains true through register allocation.
      
      Fixes #55833
      
      Differential Revision: https://reviews.llvm.org/D127154
      bccbf527
    • Vince Bridgers's avatar
      [analyzer] Fix null pointer deref in CastValueChecker · c7fa4e8a
      Vince Bridgers authored
      A crash was seen in CastValueChecker due to a null pointer dereference.
      
      The fix uses QualType::getAsString to avoid the null dereference
      when a CXXRecordDecl cannot be obtained. A small reproducer is added,
      and cast value notes LITs are updated for the new debug messages.
      
      Reviewed By: steakhal
      
      Differential Revision: https://reviews.llvm.org/D127105
      c7fa4e8a
    • Sanjay Patel's avatar
      [InstCombine] reduce right-shift-of-left-shifted constant via demanded bits · 82040d41
      Sanjay Patel authored
      If we don't demand high bits (zeros) and it is valid to pre-shift a constant:
      (C2 << X) >> C1 --> (C2 >> C1) << X
      
      https://alive2.llvm.org/ce/z/P3dWDW
      
      There are a variety of related patterns, but I haven't found a single solution
      that gets all of the motivating examples - so pulling this piece out of
      D126617 along with more tests.
      
      We should also handle the case where we shift-right followed by shift-left,
      but I'll make that a follow-on patch assuming this one is ok. It seems likely
      that we would want to add this to the SDAG version of the code too to keep it
      on par with IR.
      
      Differential Revision: https://reviews.llvm.org/D127122
      82040d41
    • Sanjay Patel's avatar
      [InstCombine] add vector tests for shift-shift; NFC · 8956f80e
      Sanjay Patel authored
      D127122
      8956f80e
    • Groverkss's avatar
      [MLIR][Presburger] Fix subtract processing extra inequalities · 445e2b2a
      Groverkss authored
      This patch fixes a bug in PresburgeRelation::subtract that made it process the
      inequality at index 0, multiple times. This was caused by allocating memory
      instead of reserving memory in llvm::SmallVector.
      
      Reviewed By: arjunp
      
      Differential Revision: https://reviews.llvm.org/D127228
      445e2b2a
    • Alan Zhao's avatar
      [llvm-ml] Remove all file extension restrictions · ae38e488
      Alan Zhao authored
      After D126425 was submitted, hans@ observed that MSVC's ml.exe doesn't
      care about the file's extension at all. Now, we check if the file exists
      to determine whether an input filename is a valid assembly file.
      
      To keep things consistent with clang-cl and lld-link, llvm-ml will treat
      everything that's not a flag as a filename.
      
      Reviewed By: hans
      
      Differential Revision: https://reviews.llvm.org/D126931
      ae38e488
    • Mark de Wever's avatar
      [libc++] Removes _LIBCPP_AVAILABILITY_TO_CHARS. · b968c345
      Mark de Wever authored
      After moving the std::to_chars base 10 implementation from the dylib to
      the header the integral overloads of std::to_chars are available on all
      platforms.
      
      Remove the _LIBCPP_AVAILABILITY_TO_CHARS availability macro and update
      the tests.
      
      Depends on D125704
      
      Reviewed By: ldionne, #libc
      
      Differential Revision: https://reviews.llvm.org/D125745
      b968c345
    • Philip Reames's avatar
      Add initial coverage for invalid instruction costs in LoopRotate · d20f3fb6
      Philip Reames authored
      Once extended with a case which requires duplication, will serve as test for crash being fixed in D127131.
      d20f3fb6
    • Mark de Wever's avatar
      [libc++][CI] Updates Docker image. · f2f0dba8
      Mark de Wever authored
      - Updates the image to use Ubuntu Jammy.
      - Installs GCC-12 as preparation to migrate to that GCC version.
      
      Reviewed By: ldionne, #libc, jloser
      
      Differential Revision: https://reviews.llvm.org/D126666
      f2f0dba8
    • Mark de Wever's avatar
      [libc++] Don't use static constexpr in headers. · dea7a8e6
      Mark de Wever authored
      This was noticed in the review of D125704. In that commit only the new
      table has been adapted. This adapts the existing tables.
      
      Note since libc++'s charconv is backported to C++11 it's not possible to
      use inline constexpr variables. The were introduced in C++17.
      
      Reviewed By: #libc, ldionne
      
      Differential Revision: https://reviews.llvm.org/D126887
      dea7a8e6
    • David Penry's avatar
      [NFC] Fix spelling/newlines in comments/debug messages · 907aedbb
      David Penry authored
      Just a few spelling mistakes and missing newlines
      
      Reviewed By: dmgreen
      
      Differential Revision: https://reviews.llvm.org/D127162
      907aedbb
    • Benjamin Kramer's avatar
      [format] Fix an uninitialized variable · 1fd6f06b
      Benjamin Kramer authored
      parseBlock may decide to leave it unchanged. Found by msan.
      1fd6f06b
    • Joseph Huber's avatar
      [Libomptarget] Do not use retaining attributes for the static library · 421b1f55
      Joseph Huber authored
      When we build the libomptarget device runtime library targeting bitcode,
      we need special care to make sure that certain functions are not
      optimized out. This is because we manually internalize and optimize
      these definitions, ignoring their standard linkage semantics. When we
      build with the static library, we can maintain these semantics and we do
      not need these to be kept-alive. Furthermore, if they are kept-alive it
      prevents them from being removed during LTO. This prevents us from
      completely internalizing `IsSPMDMode` and removing several other
      functions. This patch removes these for the static library target by
      using a macro definition to enable them.
      
      Reviewed By: JonChesterfield
      
      Differential Revision: https://reviews.llvm.org/D126701
      421b1f55
  2. Jun 07, 2022
    • Simon Pilgrim's avatar
      [DAG] combineShuffleOfSplatVal - fold shuffle(splat,undef) -> splat, iff the... · a083f3ca
      Simon Pilgrim authored
      [DAG] combineShuffleOfSplatVal - fold shuffle(splat,undef) -> splat, iff the splat contains no UNDEF elements
      
      As noticed on D127115 - we were missing this fold, instead just having the shuffle(shuffle(x,undef,splatmask),undef) fold. We should be able to merge these into one using SelectionDAG::isSplatValue, but we'll need to match the shuffle's undef handling first.
      
      This also exposed an issue in SelectionDAG::isSplatValue which was incorrectly propagating the undef mask across a bitcast (it was trying to just bail with a APInt::isSubsetOf if it found any undefs but that was actually the wrong way around so didn't fire for partial undef cases).
      a083f3ca
    • Muhammad Omair Javaid's avatar
      [LLDB] Remove decorator from XPASSes AArch64/Windows · 7daa9a9b
      Muhammad Omair Javaid authored
      This patch remove XFAIL decorator from tests which as passing on AArch64
      Windows. This is tested on surface pro x using tot llvm and clang 14.0.3
      as compiler with visual studio 2019 x86_arm64 environment.
      7daa9a9b
    • Muhammad Omair Javaid's avatar
      [LLDB] Fix TestBase.generateSource for AArch64/Windows · d3d9bbd1
      Muhammad Omair Javaid authored
      This patch adds a minor fix in lldbtest.py TestBase.generateSource
      function. Generated Python source with directory paths was not being
      escaped properly. This fix makes sure we treat dir path as raw string.
      d3d9bbd1