1. Oct 07, 2021
    • peter klausler's avatar
      [flang] Define IEEE_SCALB, IEEE_NEXT_AFTER, IEEE_NEXT_DOWN, IEEE_NEXT_UP · f5ab4bfb
      peter klausler authored
      These functions were missing from the standard intrinsic module
      IEEE_ARITHMETIC.  IEEE_SCALB is an alias for the standard intrinsic
      function SCALE(), and the others are defined as new builtin intrinsic
      functions.
      
      Differential Revision: https://reviews.llvm.org/D111253
      f5ab4bfb
    • Dan Liew's avatar
      Disable SANITIZER_CHECK_DEADLOCKS on Darwin platforms. · 9ed6b1cd
      Dan Liew authored
      Although THREADLOCAL variables are supported on Darwin they cannot be
      used very early on during process init (before dyld has set it up).
      
      Unfortunately the checked lock is used before dyld has setup TLS leading
      to an abort call (`_tlv_boostrap()` is never supposed to be called at
      runtime).
      
      To avoid this problem `SANITIZER_CHECK_DEADLOCKS` is now disabled on
      Darwin platforms. This fixes running TSan tests (an possibly other
      Sanitizers) when `COMPILER_RT_DEBUG=ON`.
      
      For reference the crashing backtrace looks like this:
      
      ```
      * thread #1, stop reason = signal SIGABRT
        * frame #0: 0x00000002044da0ae dyld`__abort_with_payload + 10
          frame #1: 0x00000002044f01af dyld`abort_with_payload_wrapper_internal + 80
          frame #2: 0x00000002044f01e1 dyld`abort_with_payload + 9
          frame #3: 0x000000010c989060 dyld_sim`abort_with_payload + 26
          frame #4: 0x000000010c94908b dyld_sim`dyld4::halt(char const*) + 375
          frame #5: 0x000000010c988f5c dyld_sim`abort + 16
          frame #6: 0x000000010c96104f dyld_sim`dyld4::APIs::_tlv_bootstrap() + 9
          frame #7: 0x000000010cd8d6d2 libclang_rt.tsan_iossim_dynamic.dylib`__sanitizer::CheckedMutex::LockImpl(this=<unavailable>, pc=<unavailable>) at sanitizer_mutex.cpp:218:58 [opt]
          frame #8: 0x000000010cd8a0f7 libclang_rt.tsan_iossim_dynamic.dylib`__sanitizer::Mutex::Lock() [inlined] __sanitizer::CheckedMutex::Lock(this=0x000000010d733c90) at sanitizer_mutex.h:124:5 [opt]
          frame #9: 0x000000010cd8a0ee libclang_rt.tsan_iossim_dynamic.dylib`__sanitizer::Mutex::Lock(this=0x000000010d733c90) at sanitizer_mutex.h:162:19 [opt]
          frame #10: 0x000000010cd8a0bf libclang_rt.tsan_iossim_dynamic.dylib`__sanitizer::GenericScopedLock<__sanitizer::Mutex>::GenericScopedLock(this=0x000000030c7479a8, mu=<unavailable>) at sanitizer_mutex.h:364:10 [opt]
          frame #11: 0x000000010cd89819 libclang_rt.tsan_iossim_dynamic.dylib`__sanitizer::GenericScopedLock<__sanitizer::Mutex>::GenericScopedLock(this=0x000000030c7479a8, mu=<unavailable>) at sanitizer_mutex.h:363:67 [opt]
          frame #12: 0x000000010cd8985b libclang_rt.tsan_iossim_dynamic.dylib`__sanitizer::LibIgnore::OnLibraryLoaded(this=0x000000010d72f480, name=0x0000000000000000) at sanitizer_libignore.cpp:39:8 [opt]
          frame #13: 0x000000010cda7aaa libclang_rt.tsan_iossim_dynamic.dylib`__tsan::InitializeLibIgnore() at tsan_interceptors_posix.cpp:219:16 [opt]
          frame #14: 0x000000010cdce0bb libclang_rt.tsan_iossim_dynamic.dylib`__tsan::Initialize(thr=0x0000000110141400) at tsan_rtl.cpp:403:3 [opt]
          frame #15: 0x000000010cda7b8e libclang_rt.tsan_iossim_dynamic.dylib`__tsan::ScopedInterceptor::ScopedInterceptor(__tsan::ThreadState*, char const*, unsigned long) [inlined] __tsan::LazyInitialize(thr=0x0000000110141400) at tsan_rtl.h:665:5 [opt]
          frame #16: 0x000000010cda7b86 libclang_rt.tsan_iossim_dynamic.dylib`__tsan::ScopedInterceptor::ScopedInterceptor(this=0x000000030c747af8, thr=0x0000000110141400, fname=<unavailable>, pc=4568918787) at tsan_interceptors_posix.cpp:247:3 [opt]
          frame #17: 0x000000010cda7bb9 libclang_rt.tsan_iossim_dynamic.dylib`__tsan::ScopedInterceptor::ScopedInterceptor(this=0x000000030c747af8, thr=<unavailable>, fname=<unavailable>, pc=<unavailable>) at tsan_interceptors_posix.cpp:246:59 [opt]
          frame #18: 0x000000010cdb72b7 libclang_rt.tsan_iossim_dynamic.dylib`::wrap_strlcpy(dst="\xd2", src="0xd1d398d1bb0a007b", size=20) at sanitizer_common_interceptors.inc:7386:3 [opt]
          frame #19: 0x0000000110542b03 libsystem_c.dylib`__guard_setup + 140
          frame #20: 0x00000001104f8ab4 libsystem_c.dylib`_libc_initializer + 65
          ...
      ```
      
      rdar://83723445
      
      Differential Revision: https://reviews.llvm.org/D111243
      9ed6b1cd
    • Philip Reames's avatar
      Returning poison from a function w/ noundef return attribute is UB · 67896f49
      Philip Reames authored
      This does for readability of returns within said function as what we do for the caller side when reasoning about what might be poison.
      
      Differential Revision: https://reviews.llvm.org/D111180
      67896f49
    • Wolfgang Pieb's avatar
      [UBSAN][PS4] For the PS4 target, emit the ud2 ocpode for ubsan traps. · f53d0513
      Wolfgang Pieb authored
      Reviewed By: probinson
      
      Differential Revision: https://reviews.llvm.org/D111172
      f53d0513
    • rdzhabarov's avatar
      [mlir] Fix redundant return in the void method. · fb3d83ac
      rdzhabarov authored
      clang-tidy, fix redundant return statement at the end of the void method.
      
      Reviewed By: jpienaar
      
      Differential Revision: https://reviews.llvm.org/D111251
      fb3d83ac
    • wlei's avatar
      [llvm-profgen] Support symbol list for accurate profile · 16516f89
      wlei authored
      Differential Revision: https://reviews.llvm.org/D110859
      16516f89
    • Arthur Eubanks's avatar
      Revert "Reland [IR] Increase max alignment to 4GB" · 569346f2
      Arthur Eubanks authored
      This reverts commit 8d64314f.
      569346f2
    • Arthur Eubanks's avatar
      Update some types after D110451 · 1b76312e
      Arthur Eubanks authored
      To fix mismatched size_t vs uint64_t on some platforms.
      1b76312e
    • Stefan Pintilie's avatar
      [PowerPC] Fix issue with lowering byval parameters. · 74008659
      Stefan Pintilie authored
      Lowering of byval parameters with sizes that are not represented by a single
      store require multiple stores to properly address the correct size of the
      parameter.
      
      Sizes that cannot be done with a single store are 3 bytes, 5 bytes, 6 bytes,
      7 bytes. It is not correct to simply perform an 8 byte store and for these
      elements because then the store would be larger than the element and alias
      analysis would assume that this is undefined behaivour and return NoAlias
      for them.
      
      This patch adds the correct stores so that the size of the store is not larger
      than the size of the element.
      
      Reviewed By: nemanjai, #powerpc
      
      Differential Revision: https://reviews.llvm.org/D108795
      74008659
    • Joe Loser's avatar
      [libc++] Implement P1391 for string_view · 4be7f489
      Joe Loser authored
      Implement P1391 (https://wg21.link/p1391) which allows
      `std::string_view` to be constructible from any contiguous range of
      characters.
      
      Note that a different paper (http://wg21.link/P1989) handles the generic
      range constructor for `std::string_view`.
      
      Reviewed By: ldionne, Quuxplusone, Mordante, #libc
      
      Differential Revision: https://reviews.llvm.org/D110718
      4be7f489
    • Philip Reames's avatar
      [SCEV] Infer flags from add/gep in any block · 0658bab8
      Philip Reames authored
      This patch removes a compile time restriction from isSCEVExprNeverPoison. We've strengthened our ability to reason about flags on scopes other than addrecs, and this bailout prevents us from using it. The comment is also suspect as well in that we're in the middle of constructing a SCEV for I. As such, we're going to visit all operands *anyways*.
      
      Differential Revision: https://reviews.llvm.org/D111186
      0658bab8
    • Simon Pilgrim's avatar
      [CostModel][TTI] Replace BAD_ICMP_PREDICATE with ICMP_NE for generic smulo/umulo cost expansion · 2ced9a42
      Simon Pilgrim authored
      Match the predicate used in TargetLowering::expandMULO to detect overflow
      2ced9a42
    • Simon Pilgrim's avatar
      [CostModel][TTI] Fix ops used for generic smulo/umulo cost expansion · 7bd097fd
      Simon Pilgrim authored
      Fix copy+pasta that was checking for smul_fix instead of smul_with_overflow to detected signed values.
      
      The LShr is performed on the extended type as we use it to truncate+extract the upper/hi bits of the extended multiply.
      
      More closely matches the default expansion from TargetLowering::expandMULO
      7bd097fd
    • Simon Pilgrim's avatar
      [CostModel][TTI] Replace BAD_ICMP_PREDICATE with ICMP_ULT/UGT for generic uadd/usubo cost expansion · 81b5da8c
      Simon Pilgrim authored
      Match the predicates used in TargetLowering::expandUADDSUBO
      81b5da8c
    • Leonard Chan's avatar
      [compiler-rt][test] Add shared_unwind requirement · 77d5ccdc
      Leonard Chan authored
      When using a static libunwind, the check_memcpy.c can fail because it checks
      that tsan intercepted all memcpy/memmoves in the final binary. Though if the
      static libunwind is not instrumented, then this will fail because it may contain
      regular memcpy/memmoves.
      
      This adds a new REQUIRES check for ensuring that this test won't run unless a
      dynamic libunwind.so is provided.
      
      Differential Revision: https://reviews.llvm.org/D111194
      77d5ccdc
    • Arthur Eubanks's avatar
      Reland [IR] Increase max alignment to 4GB · 8d64314f
      Arthur Eubanks authored
      Currently the max alignment representable is 1GB, see D108661.
      Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bits are clear which can be used for some optimizations, e.g. https://crbug.com/1016945.
      
      This uses an extra bit in instructions that carry an alignment. We can store 15 bits of "free" information, and with this change some instructions (e.g. AtomicCmpXchgInst) use 14 bits.
      We can increase the max alignment representable above 4GB (up to 2^62) since we're only using 33 of the 64 values, but I've just limited it to 4GB for now.
      
      The one place we have to update the bitcode format is for the alloca instruction. It stores its alignment into 5 bits of a 32 bit bitfield. I've added another field which is 8 bits and should be future proof for a while. For backward compatibility, we check if the old field has a value and use that, otherwise use the new field.
      
      Updating clang's max allowed alignment will come in a future patch.
      
      Reviewed By: hans
      
      Differential Revision: https://reviews.llvm.org/D110451
      8d64314f
    • Craig Topper's avatar
    • LLVM GN Syncbot's avatar
      [gn build] Port 10f16bc7 · 665662a7
      LLVM GN Syncbot authored
      665662a7
    • Stella Stamenova's avatar
      Revert "[lldb] [ABI/X86] Split base x86 and i386 classes" · 10f16bc7
      Stella Stamenova authored
      This change broke the windows lldb bot.
      
      This reverts commit a30a36f6.
      10f16bc7
    • Kevin P. Neal's avatar
      [FPEnv][InstSimplify] Fold constrained X + -0.0 ==> X · f86c930c
      Kevin P. Neal authored
      Currently the fadd optimizations in InstSimplify don't know how to do this
      "X + -0.0 ==> X" fold when using the constrained intrinsics. This adds the
      support.
      
      This commit is derived from D106362 with some improvements from D107285.
      
      Differential Revision: https://reviews.llvm.org/D111085
      f86c930c
    • Fangrui Song's avatar
      [Driver][test] Add Debian multiarch lib/clang/14.0.0/x86_64-linux-gnu and... · a2796f1e
      Fangrui Song authored
      [Driver][test] Add Debian multiarch lib/clang/14.0.0/x86_64-linux-gnu and include/x86_64-linux-gnu/c++/v1 tests
      a2796f1e
    • Vitaly Buka's avatar
      [sanitizer] Switch to StackDepotNode to 64bit hash · b5b1b3ae
      Vitaly Buka authored
      Now we can avoid scanning the stack on fast path.
      The price is the false stack trace with probability of the hash collision.
      This increase performance of lsan by 6% and pre-requirement for stack compression.
      
      Depends on D111182.
      
      Reviewed By: morehouse, dvyukov
      
      Differential Revision: https://reviews.llvm.org/D111183
      b5b1b3ae
    • natashaknk's avatar
      [mlir][tosa] Create basic dynamic shape support for several ops. · 4c48f7e2
      natashaknk authored
      Transpose, Matmul and Fully-connected dynamic shape support
      
      Reviewed By: rsuderman
      
      Differential Revision: https://reviews.llvm.org/D111167
      4c48f7e2
    • Craig Topper's avatar
      [X86] Add test cases for PR52093. NFC · fa7a1bea
      Craig Topper authored
      fa7a1bea
    • Mogball's avatar
      [MLIR] Update DRR doc with returnType directive · 0210a3de
      Mogball authored
      Add missing documentation.
      
      Reviewed By: Chia-hungDuan, jpienaar
      
      Differential Revision: https://reviews.llvm.org/D110964
      0210a3de
    • Arthur Eubanks's avatar
      Revert "[IR] Increase max alignment to 4GB" · 72cf8b60
      Arthur Eubanks authored
      This reverts commit df84c1fe.
      
      Breaks some bots
      72cf8b60
    • Michael Kruse's avatar
      [Clang][OpenMP] Allow loop-transformations with template parameters. · 2130117f
      Michael Kruse authored
      Clang would reject
      
          #pragma omp for
          #pragma omp tile sizes(P)
          for (int i = 0; i < 128; ++i) {}
      
      where P is a template parameter, but the loop itself is not
      template-dependent. Because P context-dependent, the TransformedStmt
      cannot be generated and therefore is nullptr (until the template is
      instantiated by TreeTransform). The OMPForDirective would still expect
      the a loop is the dependent context and trigger an error.
      
      Fix by introducing a NumGeneratedLoops field to OMPLoopTransformation.
      This is used to distinguish the case where no TransformedStmt will be
      generated at all (e.g. #pragma omp unroll full) and template
      instantiation is needed. In the latter case, delay resolving the
      iteration space like when the for-loop itself is template-dependent
      until the template instatiation.
      
      A more radical solution would always delay the iteration space analysis
      until template instantiation, but would also break many test cases.
      
      Reviewed By: ABataev
      
      Differential Revision: https://reviews.llvm.org/D111124
      2130117f
    • H.J. Lu's avatar
      [sanitizer] Support Intel CET · fdf4c035
      H.J. Lu authored
      1. Include <cet.h> in sanitizer_common/sanitizer_asm.h to mark Intel CET
      support when Intel CET is enabled.
      2. Add _CET_ENDBR to function entries in assembly codes so that ENDBR
      instruction will be generated when Intel CET is enabled.
      
      Reviewed By: dvyukov
      
      Differential Revision: https://reviews.llvm.org/D111185
      fdf4c035
    • Frederic Cambus's avatar
      [CMake] Fix typo in error message for LLD in bootstrap builds. · f0ffff43
      Frederic Cambus authored
      Reviewed By: xgupta
      
      Differential Revision: https://reviews.llvm.org/D110836
      f0ffff43
    • Shivam Gupta's avatar
    • Pengxuan Zheng's avatar
      [ARM] Fix a bug in finding a pair of extracts to create VMOVRRD · b0045f55
      Pengxuan Zheng authored
      D100244 missed a check on the ResNo of the extract's operand 0 when finding a
      pair of extracts to combine into a VMOVRRD (extract(x, n); extract(x, n+1) ->
      VMOVRRD(extract x, n/2)). As a result, it can incorrectly pair an extract(x, n)
      with another extract(x:3, n+1) for example. This patch fixes the bug by adding
      the proper check on ResNo.
      
      Reviewed By: dmgreen
      
      Differential Revision: https://reviews.llvm.org/D111188
      b0045f55
    • Arthur Eubanks's avatar
      [IR] Increase max alignment to 4GB · df84c1fe
      Arthur Eubanks authored
      Currently the max alignment representable is 1GB, see D108661.
      Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bits are clear which can be used for some optimizations, e.g. https://crbug.com/1016945.
      
      This uses an extra bit in instructions that carry an alignment. We can store 15 bits of "free" information, and with this change some instructions (e.g. AtomicCmpXchgInst) use 14 bits.
      We can increase the max alignment representable above 4GB (up to 2^62) since we're only using 33 of the 64 values, but I've just limited it to 4GB for now.
      
      The one place we have to update the bitcode format is for the alloca instruction. It stores its alignment into 5 bits of a 32 bit bitfield. I've added another field which is 8 bits and should be future proof for a while. For backward compatibility, we check if the old field has a value and use that, otherwise use the new field.
      
      Updating clang's max allowed alignment will come in a future patch.
      
      Reviewed By: hans
      
      Differential Revision: https://reviews.llvm.org/D110451
      df84c1fe
    • Arthur Eubanks's avatar
      [clang] Allow printing 64 bit ints in diagnostics · afdac5fb
      Arthur Eubanks authored
      Currently we're limited to 32 bit ints in diagnostics.
      With support for 4GB alignments coming soon, we need to report 4GB as the max alignment allowed.
      I've tested that this does indeed properly print 2^32.
      
      Reviewed By: rsmith
      
      Differential Revision: https://reviews.llvm.org/D111184
      afdac5fb
    • Max Kazantsev's avatar
      [Test] Add LoopPeel test for loops with profile data available · 00eec5c1
      Max Kazantsev authored
      Patch by Dmitry Makogon!
      00eec5c1
    • Gabor Marton's avatar
      [analyzer][NFC] Add RangeSet::dump · b8f6c85a
      Gabor Marton authored
      This tiny change improves the debugging experience of the solver a lot!
      
      Differential Revision: https://reviews.llvm.org/D110911
      b8f6c85a
    • Geoffrey Martin-Noble's avatar
      [MLIR] Improve debug messages in BuiltinTypes · b096ac90
      Geoffrey Martin-Noble authored
      It's nice for users to have more information when debugging failures and
      these are only triggered in a failure path.
      
      Reviewed By: mehdi_amini
      
      Differential Revision: https://reviews.llvm.org/D107676
      b096ac90
    • Alexandre Rames's avatar
      [MLIR] Rename Shape dialect's `join` to `meet`. · fd961332
      Alexandre Rames authored
      For the type lattice, we (now) use the "less specialized or equal" partial
      order, leading to the bottom representing the empty set, and the top
      representing any type.
      
      This naming is more in line with the generally used conventions, where the top
      of the lattice is the full set, and the bottom of the lattice is the empty set.
      A typical example is the powerset of a finite set: generally, meet would be the
      intersection, and join would be the union.
      
      ```
      top:  {a,b,c}
           /   |   \
       {a,b} {a,c} {b,c}
         |  X     X  |
         {a} { b } {c}
            \  |  /
      bottom: { }
      ```
      
      This is in line with the examined lattice representations in LLVM:
      * lattice for `BitTracker::BitValue` in `Hexagon/BitTracker.h`
      * lattice for constant propagation in `HexagonConstPropagation.cpp`
      * lattice in `VarLocBasedImpl.cpp`
      * lattice for address space inference code in `InferAddressSpaces.cpp`
      
      Reviewed By: silvas, jpienaar
      
      Differential Revision: https://reviews.llvm.org/D110766
      fd961332
    • Nikita Popov's avatar
      [BasicAA] Don't unnecessarily extend pointer size · 1301a8b4
      Nikita Popov authored
      BasicAA GEP decomposition currently performs all calculation on the
      maximum pointer size, but at least 64-bit, with an option to double
      the size. The code comment claims that this improves analysis power
      when working with uint64_t indices on 32-bit systems. However, I don't
      see how this can be, at least while maintaining correctness:
      
      When working on canonical code, the GEP indices will have GEP index
      size. If the original code worked on uint64_t with a 32-bit size_t,
      then there will be truncs inserted before use as a GEP index. Linear
      expression decomposition does not look through truncs, so this will
      be an opaque value as far as GEP decomposition is concerned. Working
      on a wider pointer size does not help here (or have any effect at all).
      
      When working on non-canonical code (before first InstCombine), the
      GEP indices are implicitly truncated to GEP index size. The BasicAA
      code currently just ignores this fact completely, and pretends that
      this truncation doesn't happen. This is incorrect and will be
      addressed by D110977.
      
      I believe that for correctness reasons, it is important to work on
      the actual GEP index size to properly model potential overflow.
      BasicAA tries to patch over the fact that it uses the wrong size
      (see adjustToPointerSize), but it only does that in limited cases
      (only for constant values, and not all of them either). I'd like to
      move this code towards always working on the correct size, and
      dropping these artificial pointer size adjustments is the first step
      towards that.
      
      Differential Revision: https://reviews.llvm.org/D110657
      1301a8b4
    • Sanjay Patel's avatar
      [InstSimplify] (x | y) & (x | !y) --> x · e36d351d
      Sanjay Patel authored
      https://alive2.llvm.org/ce/z/QagQMn
      
      This fold is handled by instcombine via SimplifyUsingDistributiveLaws(),
      but we are missing the sibliing fold for 'logical and' (implemented with
      'select'). Retrofitting the code in instcombine looks much harder
      than just adding a small adjustment here, and this is potentially more
      efficient and beneficial to other passes.
      e36d351d
    • Sanjay Patel's avatar